I'm struggling to generate UV coordinates on a closed triangle mesh using LSCM with the latest CGAL in header-only mode, on Windows, with VS 2017. The code I have is pretty simple since I can't really have two fixed vertices for the seams, so I'm relying on the default constructor of SMP::Two_vertices_parameterizer_3
.
typedef CGAL::Simple_cartesian<double> Kerneld;
typedef Kerneld::Point_3 Pointd;
typedef CGAL::Surface_mesh<Pointd> Meshd;
// ...
if (parameterizeMesh)
{
std::cout << "Parameterizing mesh with Least-Squares Conformal Mapping ... " << std::endl;
Meshd meshd;
PMP::polygon_soup_to_polygon_mesh(vd, polys, meshd);
SMP::LSCM_parameterizer_3<Meshd, SMP::Two_vertices_parameterizer_3<Meshd>> param;
Meshd::Property_map<Meshd::Vertex_index, Kerneld::Point_2> uvmap = meshd.add_property_map<Meshd::vertex_index, Kerneld::Point_2>("v:uv").first;
SMP::parameterize(meshd, param, PMP::longest_border(meshd).first, uvmap);
}
And it's failing with :
CGAL error: assertion violation!
Expression : _idx < data_.size()
File : C:\dev\CGAL-4.14\include\CGAL/Surface_mesh/Properties.h
Line : 206
Explanation:
Refer to the bug-reporting instructions at https://www.cgal.org/bug_report.html
I then printed the values of both _idx
and data_.size()
right before the assertion violation and got the interesting results of 4294967294
(ie 2^32 - 2
) and 49128
respectively. Worthy of note is that the mesh in question holds 16376 triangular faces, and 16376 * 3 = 49128. I'm pretty stuck there ; I read the many CGAL examples that deal with planar parameterization, to no avail.
EDIT : upon further inspection, it appears that the biggest number is actually the number returned by PMP::longest_border
, which makes sense since I'm using a closed mesh. I'm looking into Seam_mesh
to introduce a virtual seam in my mesh.