mirror of https://github.com/CGAL/cgal
Fixed choice of fixed vertices for different types of lambda
Not too sure about that change, but it (sort of) makes sense to only fix one point when lambda !=0, it works, and looking -now- at the other branch on ARAP, they had done the same.
This commit is contained in:
parent
95bc5f4b91
commit
8afe8af986
|
|
@ -233,43 +233,26 @@ private:
|
||||||
Error_code parameterize_border(const TriangleMesh& mesh,
|
Error_code parameterize_border(const TriangleMesh& mesh,
|
||||||
const Vertex_set& vertices,
|
const Vertex_set& vertices,
|
||||||
halfedge_descriptor bhd,
|
halfedge_descriptor bhd,
|
||||||
VertexUVmap uvmap,
|
|
||||||
VertexParameterizedMap vpmap)
|
VertexParameterizedMap vpmap)
|
||||||
{
|
{
|
||||||
// Compute (u,v) for (at least two) border vertices and mark them as "parameterized"
|
|
||||||
Error_code status = Base::OK;
|
Error_code status = Base::OK;
|
||||||
|
CGAL_precondition(!vertices.empty());
|
||||||
|
|
||||||
#define FIXED_VERTICES_IN_PARAMETERIZATION_SPACE
|
if(m_lambda != 0.){
|
||||||
#ifdef FIXED_VERTICES_IN_PARAMETERIZATION_SPACE
|
// Fix a random vertex, the value in uvmap is already set
|
||||||
// Find the two farthest vertices in the initial parameterization
|
vertex_descriptor vd = *(vertices.begin());
|
||||||
|
put(vpmap, vd, true);
|
||||||
|
} else {
|
||||||
|
// This fixes two vertices that are far in the original geometry
|
||||||
|
|
||||||
// @fixme unefficient: brute force algorithm; use Convex hull + rotating caliphers instead
|
// A local uvmap (that is then discarded) is passed to avoid changing
|
||||||
NT max_dist = (std::numeric_limits<NT>::min)();
|
// the values of the real uvmap
|
||||||
vertex_descriptor vd1_max, vd2_max;
|
CGAL::Unique_hash_map<vertex_descriptor, Point_2> useless_uvmap;
|
||||||
|
status = get_border_parameterizer().parameterize_border(mesh, bhd,
|
||||||
BOOST_FOREACH(vertex_descriptor vd1, vertices){
|
VertexUVMap(useless_uvmap),
|
||||||
BOOST_FOREACH(vertex_descriptor vd2, vertices){
|
vpmap);
|
||||||
Point_2 uv1 = get(uvmap, vd1);
|
|
||||||
Point_2 uv2 = get(uvmap, vd2);
|
|
||||||
|
|
||||||
NT sq_d = CGAL::squared_distance(uv1, uv2);
|
|
||||||
if(sq_d > max_dist)
|
|
||||||
{
|
|
||||||
max_dist = sq_d;
|
|
||||||
vd1_max = vd1;
|
|
||||||
vd2_max = vd2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// the value in uvmap is already set
|
|
||||||
put(vpmap, vd1_max, true);
|
|
||||||
put(vpmap, vd2_max, true);
|
|
||||||
#else
|
|
||||||
// This fixes two vertices that are far in the original geometry. We lose
|
|
||||||
// the UV information of the initial param
|
|
||||||
status = get_border_parameterizer().parameterize_border(mesh, bhd, uvmap, vpmap);
|
|
||||||
#endif
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1169,12 +1152,9 @@ public:
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
// Handle the boundary condition depending on lambda
|
// Handle the boundary condition depending on lambda
|
||||||
if(true || m_lambda == 0)
|
status = parameterize_border<VertexUVMap>(mesh, vertices, bhd, vpmap);
|
||||||
{
|
|
||||||
status = parameterize_border(mesh, vertices, bhd, uvmap, vpmap);
|
|
||||||
if(status != Base::OK)
|
if(status != Base::OK)
|
||||||
return status;
|
return status;
|
||||||
}
|
|
||||||
|
|
||||||
// Compute all cotangent angles
|
// Compute all cotangent angles
|
||||||
Cot_hm cthm;
|
Cot_hm cthm;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue