Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix implicit gmp to double conversion failures #8087

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ namespace internal {
for(edge_descriptor e : edge_range)
{
const halfedge_descriptor he = halfedge(e, mesh_);
std::optional<double> sqlen = sizing.is_too_long(source(he, mesh_), target(he, mesh_), mesh_);
auto sqlen = sizing.is_too_long(source(he, mesh_), target(he, mesh_), mesh_);
if(sqlen != std::nullopt)
long_edges.emplace(he, sqlen.value());
long_edges.emplace(he, CGAL::to_double(sqlen.value()));
}

//split long edges
Expand Down Expand Up @@ -437,14 +437,14 @@ namespace internal {

//check sub-edges
//if it was more than twice the "long" threshold, insert them
std::optional<double> sqlen_new = sizing.is_too_long(source(hnew, mesh_), target(hnew, mesh_), mesh_);
auto sqlen_new = sizing.is_too_long(source(hnew, mesh_), target(hnew, mesh_), mesh_);
if(sqlen_new != std::nullopt)
long_edges.emplace(hnew, sqlen_new.value());
long_edges.emplace(hnew, CGAL::to_double(sqlen_new.value()));

const halfedge_descriptor hnext = next(hnew, mesh_);
sqlen_new = sizing.is_too_long(source(hnext, mesh_), target(hnext, mesh_), mesh_);
if (sqlen_new != std::nullopt)
long_edges.emplace(hnext, sqlen_new.value());
long_edges.emplace(hnext, CGAL::to_double(sqlen_new.value()));

//insert new edges to keep triangular faces, and update long_edges
if (!is_border(hnew, mesh_))
Expand Down Expand Up @@ -500,9 +500,9 @@ namespace internal {
if (!is_split_allowed(e))
continue;
const halfedge_descriptor he = halfedge(e, mesh_);
std::optional<double> sqlen = sizing.is_too_long(source(he, mesh_), target(he, mesh_), mesh_);
auto sqlen = sizing.is_too_long(source(he, mesh_), target(he, mesh_), mesh_);
if(sqlen != std::nullopt)
long_edges.emplace(halfedge(e, mesh_), sqlen.value());
long_edges.emplace(halfedge(e, mesh_), CGAL::to_double(sqlen.value()));
}

//split long edges
Expand Down Expand Up @@ -554,14 +554,14 @@ namespace internal {

//check sub-edges
//if it was more than twice the "long" threshold, insert them
std::optional<double> sqlen_new = sizing.is_too_long(source(hnew, mesh_), target(hnew, mesh_), mesh_);
auto sqlen_new = sizing.is_too_long(source(hnew, mesh_), target(hnew, mesh_), mesh_);
if(sqlen_new != std::nullopt)
long_edges.emplace(hnew, sqlen_new.value());
long_edges.emplace(hnew, CGAL::to_double(sqlen_new.value()));

const halfedge_descriptor hnext = next(hnew, mesh_);
sqlen_new = sizing.is_too_long(source(hnext, mesh_), target(hnext, mesh_), mesh_);
if (sqlen_new != std::nullopt)
long_edges.emplace(hnext, sqlen_new.value());
long_edges.emplace(hnext, CGAL::to_double(sqlen_new.value()));

//insert new edges to keep triangular faces, and update long_edges
if (!is_on_border(hnew))
Expand All @@ -580,9 +580,9 @@ namespace internal {

if (snew == PATCH)
{
std::optional<double> sql = sizing.is_too_long(source(hnew2, mesh_), target(hnew2, mesh_), mesh_);
auto sql = sizing.is_too_long(source(hnew2, mesh_), target(hnew2, mesh_), mesh_);
if(sql != std::nullopt)
long_edges.emplace(hnew2, sql.value());
long_edges.emplace(hnew2, CGAL::to_double(sql.value()));
}
}

Expand All @@ -603,9 +603,9 @@ namespace internal {

if (snew == PATCH)
{
std::optional<double> sql = sizing.is_too_long(source(hnew2, mesh_), target(hnew2, mesh_), mesh_);
auto sql = sizing.is_too_long(source(hnew2, mesh_), target(hnew2, mesh_), mesh_);
if (sql != std::nullopt)
long_edges.emplace(hnew2, sql.value());
long_edges.emplace(hnew2, CGAL::to_double(sql.value()));
}
}
}
Expand Down Expand Up @@ -648,10 +648,10 @@ namespace internal {
Boost_bimap short_edges;
for(edge_descriptor e : edges(mesh_))
{
std::optional<double> sqlen = sizing.is_too_short(halfedge(e, mesh_), mesh_);
auto sqlen = sizing.is_too_short(halfedge(e, mesh_), mesh_);
if(sqlen != std::nullopt
&& is_collapse_allowed(e, collapse_constraints))
short_edges.insert(short_edge(halfedge(e, mesh_), sqlen.value()));
short_edges.insert(short_edge(halfedge(e, mesh_), CGAL::to_double(sqlen.value())));
}
#ifdef CGAL_PMP_REMESHING_VERBOSE_PROGRESS
std::cout << "done." << std::endl;
Expand Down Expand Up @@ -747,8 +747,7 @@ namespace internal {
for(halfedge_descriptor ha : halfedges_around_target(va, mesh_))
{
vertex_descriptor va_i = source(ha, mesh_);
std::optional<double> sqha = sizing.is_too_long(vb, va_i, mesh_);
if (sqha != std::nullopt)
if (sizing.is_too_long(vb, va_i, mesh_))
{
collapse_ok = false;
break;
Expand Down Expand Up @@ -813,10 +812,10 @@ namespace internal {
//insert new/remaining short edges
for (halfedge_descriptor ht : halfedges_around_target(vkept, mesh_))
{
std::optional<double> sqlen = sizing.is_too_short(ht, mesh_);
auto sqlen = sizing.is_too_short(ht, mesh_);
if (sqlen != std::nullopt
&& is_collapse_allowed(edge(ht, mesh_), collapse_constraints))
short_edges.insert(short_edge(ht, sqlen.value()));
short_edges.insert(short_edge(ht, CGAL::to_double(sqlen.value())));
}
}
}//end if(collapse_ok)
Expand Down Expand Up @@ -1761,9 +1760,9 @@ namespace internal {
//insert new edges in 'short_edges'
if (is_collapse_allowed(edge(hf, mesh_), collapse_constraints))
{
std::optional<double> sqlen = sizing.is_too_short(hf, mesh_);
auto sqlen = sizing.is_too_short(hf, mesh_);
if (sqlen != std::nullopt)
short_edges.insert(typename Bimap::value_type(hf, sqlen.value()));
short_edges.insert(typename Bimap::value_type(hf, CGAL::to_double(sqlen.value())));
}

if(!is_border(hf, mesh_) &&
Expand Down