Initialize m_is_valid when expensive preconditions are off!

This commit is contained in:
Laurent Saboret 2007-01-15 15:17:08 +00:00
parent e6ddc1f499
commit be8a4eb8a8
1 changed files with 11 additions and 10 deletions

View File

@ -169,7 +169,7 @@ public:
/// - first_seam_vertex -> end_seam_vertex defines the outer seam, /// - first_seam_vertex -> end_seam_vertex defines the outer seam,
/// ie Parameterization_mesh_patch_3 will export the "right" of the seam. /// ie Parameterization_mesh_patch_3 will export the "right" of the seam.
/// - The "seam" is given as a container of Adaptor::Vertex_handle elements. /// - The "seam" is given as a container of Adaptor::Vertex_handle elements.
/// - The "seam" is implicitely a loop. The first vertex should *not* be /// - The "seam" is implicitely a loop. The first vertex should *not* be
/// duplicated at the end. /// duplicated at the end.
template<class InputIterator> template<class InputIterator>
Parameterization_mesh_patch_3(Adaptor& mesh, Parameterization_mesh_patch_3(Adaptor& mesh,
@ -191,6 +191,7 @@ public:
set_mesh_seaming(first_seam_vertex, end_seam_vertex); set_mesh_seaming(first_seam_vertex, end_seam_vertex);
// Check that the cut mesh is 2-manifold // Check that the cut mesh is 2-manifold
m_is_valid = true;
CGAL_surface_mesh_parameterization_expensive_precondition_code( \ CGAL_surface_mesh_parameterization_expensive_precondition_code( \
m_is_valid = mesh.is_valid() && check_seam(first_seam_vertex, end_seam_vertex); \ m_is_valid = mesh.is_valid() && check_seam(first_seam_vertex, end_seam_vertex); \
); );
@ -619,7 +620,7 @@ private:
/// - first_seam_vertex -> end_seam_vertex defines the outer seam, /// - first_seam_vertex -> end_seam_vertex defines the outer seam,
/// ie Parameterization_mesh_patch_3 will export the "right" of the seam. /// ie Parameterization_mesh_patch_3 will export the "right" of the seam.
/// - The "seam" is given as a container of Adaptor::Vertex_handle elements. /// - The "seam" is given as a container of Adaptor::Vertex_handle elements.
/// - The "seam" is implicitely a loop. The first vertex should *not* be /// - The "seam" is implicitely a loop. The first vertex should *not* be
/// duplicated at the end. /// duplicated at the end.
template<class InputIterator> template<class InputIterator>
void set_mesh_seaming(InputIterator first_seam_vertex, void set_mesh_seaming(InputIterator first_seam_vertex,
@ -765,7 +766,7 @@ private:
/// - first_seam_vertex -> end_seam_vertex defines the outer seam, /// - first_seam_vertex -> end_seam_vertex defines the outer seam,
/// ie Parameterization_mesh_patch_3 will export the "right" of the seam. /// ie Parameterization_mesh_patch_3 will export the "right" of the seam.
/// - The "seam" is given as a container of Adaptor::Vertex_handle elements. /// - The "seam" is given as a container of Adaptor::Vertex_handle elements.
/// - The "seam" is implicitely a loop. The first vertex should *not* be /// - The "seam" is implicitely a loop. The first vertex should *not* be
/// duplicated at the end. /// duplicated at the end.
/// - The seaming flag of all vertices and edges to INNER, BORDER or OUTER /// - The seaming flag of all vertices and edges to INNER, BORDER or OUTER
/// wrt the first_seam_vertex -> end_seam_vertex border is set /// wrt the first_seam_vertex -> end_seam_vertex border is set
@ -774,15 +775,15 @@ private:
bool check_seam(InputIterator first_seam_vertex, bool check_seam(InputIterator first_seam_vertex,
InputIterator end_seam_vertex) const InputIterator end_seam_vertex) const
{ {
// The input vertices list can be either a "seam along a line" // The input vertices list can be either a "seam along a line"
// (that virtually cut the mesh along a line) or a "cut-out seam" // (that virtually cut the mesh along a line) or a "cut-out seam"
// (loop that cuts out a part of the mesh). // (loop that cuts out a part of the mesh).
// A "seam along a line" is given as a 2-ways list of vertices. // A "seam along a line" is given as a 2-ways list of vertices.
InputIterator second_seam_vertex = first_seam_vertex; second_seam_vertex++; InputIterator second_seam_vertex = first_seam_vertex; second_seam_vertex++;
bool is_seam_along_a_line bool is_seam_along_a_line
= (m_mesh_adaptor.get_halfedge_seaming(*second_seam_vertex, = (m_mesh_adaptor.get_halfedge_seaming(*second_seam_vertex,
*first_seam_vertex) == BORDER); *first_seam_vertex) == BORDER);
// One cannot mix "seam along a line" and "cut-out seam" // One cannot mix "seam along a line" and "cut-out seam"
int seam_length = 0; int seam_length = 0;
for (InputIterator border_it = first_seam_vertex; for (InputIterator border_it = first_seam_vertex;
@ -790,21 +791,21 @@ private:
border_it++) border_it++)
{ {
seam_length++; // compute seam length seam_length++; // compute seam length
// Get next iterator (looping) // Get next iterator (looping)
InputIterator next_border_it = border_it; InputIterator next_border_it = border_it;
next_border_it++; next_border_it++;
if (next_border_it == end_seam_vertex) if (next_border_it == end_seam_vertex)
next_border_it = first_seam_vertex; next_border_it = first_seam_vertex;
// Opposite halfedges are on seam iff this is a "seam along a line" // Opposite halfedges are on seam iff this is a "seam along a line"
if ( is_seam_along_a_line != if ( is_seam_along_a_line !=
(m_mesh_adaptor.get_halfedge_seaming(*next_border_it, (m_mesh_adaptor.get_halfedge_seaming(*next_border_it,
*border_it) == BORDER) ) *border_it) == BORDER) )
{ {
return false; return false;
} }
// In a "cut-out seam", a vertex cannot belong twice to the seam // In a "cut-out seam", a vertex cannot belong twice to the seam
// (see e.g. "8" shape seam) // (see e.g. "8" shape seam)
if (!is_seam_along_a_line) if (!is_seam_along_a_line)
@ -824,7 +825,7 @@ private:
if (seam_length < 3) if (seam_length < 3)
return false; return false;
} }
// else: ok // else: ok
return true; return true;
} }