mirror of https://github.com/CGAL/cgal
BUGFIX: One has to choose the lexicographically smallest/largest vertex
This commit is contained in:
parent
a5b09f4197
commit
a4927e5d6a
|
|
@ -123,12 +123,12 @@ Two_vertices_parameterizer_3<Adaptor>::parameterize_border(Adaptor& mesh)
|
|||
return Parameterizer_traits_3<Adaptor>::ERROR_BORDER_TOO_SHORT;
|
||||
|
||||
// Get mesh's bounding box
|
||||
double xmin = 1e30 ;
|
||||
double ymin = 1e30 ;
|
||||
double zmin = 1e30 ;
|
||||
double xmax = -1e30 ;
|
||||
double ymax = -1e30 ;
|
||||
double zmax = -1e30 ;
|
||||
double xmin = (std::numeric_limits<double>::max)() ;
|
||||
double ymin = (std::numeric_limits<double>::max)() ;
|
||||
double zmin = (std::numeric_limits<double>::max)() ;
|
||||
double xmax = (std::numeric_limits<double>::min)() ;
|
||||
double ymax = (std::numeric_limits<double>::min)() ;
|
||||
double zmax = (std::numeric_limits<double>::min)() ;
|
||||
for (it = mesh.mesh_vertices_begin(); it != mesh.mesh_vertices_end(); it++)
|
||||
{
|
||||
Point_3 position = mesh.get_vertex_position(it);
|
||||
|
|
@ -220,9 +220,10 @@ Two_vertices_parameterizer_3<Adaptor>::parameterize_border(Adaptor& mesh)
|
|||
// Project onto longest bounding box axes,
|
||||
// Set extrema vertices' (u,v) in unit square and mark them as "parameterized"
|
||||
Vertex_handle vxmin = NULL ;
|
||||
double umin = DBL_MAX ;
|
||||
double umin = (std::numeric_limits<double>::max)() ;
|
||||
double vmin = (std::numeric_limits<double>::max)(), vmax= (std::numeric_limits<double>::min)();
|
||||
Vertex_handle vxmax = NULL ;
|
||||
double umax = DBL_MIN ;
|
||||
double umax = (std::numeric_limits<double>::min)() ;
|
||||
for (it = mesh.mesh_vertices_begin(); it != mesh.mesh_vertices_end(); it++)
|
||||
{
|
||||
Point_3 position = mesh.get_vertex_position(it);
|
||||
|
|
@ -240,13 +241,15 @@ Two_vertices_parameterizer_3<Adaptor>::parameterize_border(Adaptor& mesh)
|
|||
|
||||
mesh.set_vertex_uv(it, Point_2(u,v)) ; // useful only for vxmin and vxmax
|
||||
|
||||
if(u < umin) {
|
||||
if(u < umin || (u==umin && v < vmin) ) {
|
||||
vxmin = it ;
|
||||
umin = u ;
|
||||
vmin = v ;
|
||||
}
|
||||
if(u > umax) {
|
||||
if(u > umax || (u==umax && v > vmax) ){
|
||||
vxmax = it ;
|
||||
umax = u ;
|
||||
vmax = v ;
|
||||
}
|
||||
}
|
||||
mesh.set_vertex_parameterized(vxmin, true) ;
|
||||
|
|
|
|||
Loading…
Reference in New Issue