Fixed TDS's incident_faces() using the wrong index for the first vertex

(and added consts)

(cherry picked from commit e312d7ddae0188ed0d99b4247f73871a57124f41)
This commit is contained in:
Mael Rouxel-Labbé 2015-01-02 17:35:36 +01:00 committed by Clement Jamin
parent 2f4bb69e0a
commit 7a11937b97
2 changed files with 8 additions and 8 deletions

View File

@ -567,7 +567,7 @@ public:
}
template< typename OutputIterator >
OutputIterator incident_faces(Vertex_const_handle v, int d, OutputIterator out)
OutputIterator incident_faces(Vertex_const_handle v, int d, OutputIterator out) const
{
return tds().incident_faces(v, d, out);
}

View File

@ -624,10 +624,10 @@ public:
return incident_faces(v, dim, out, std::less<Vertex_const_handle>(), true);
}
template< typename OutputIterator, typename Comparator >
OutputIterator incident_faces(Vertex_const_handle, const int, OutputIterator, Comparator = Comparator(), bool = false);
OutputIterator incident_faces(Vertex_const_handle, const int, OutputIterator, Comparator = Comparator(), bool = false) const;
template< typename OutputIterator >
OutputIterator incident_faces(Vertex_const_handle, const int, OutputIterator,
std::less<Vertex_const_handle> = std::less<Vertex_const_handle>(), bool = false);
std::less<Vertex_const_handle> = std::less<Vertex_const_handle>(), bool = false) const;
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - INPUT / OUTPUT
@ -723,7 +723,7 @@ template< typename OutputIterator >
OutputIterator
Triangulation_data_structure<Dim, Vb, Fcb>
::incident_faces(Vertex_const_handle v, const int dim, OutputIterator out,
std::less<Vertex_const_handle> cmp, bool upper_faces)
std::less<Vertex_const_handle> cmp, bool upper_faces) const
{
return incident_faces<OutputIterator, std::less<Vertex_const_handle> >(v, dim, out, cmp, upper_faces);
}
@ -733,7 +733,7 @@ template< class Dim, class Vb, class Fcb >
template< typename OutputIterator, typename Comparator >
OutputIterator
Triangulation_data_structure<Dim, Vb, Fcb>
::incident_faces(Vertex_const_handle v, const int dim, OutputIterator out, Comparator cmp, bool upper_faces)
::incident_faces(Vertex_const_handle v, const int dim, OutputIterator out, Comparator cmp, bool upper_faces) const
{
CGAL_precondition( 0 < dim );
if( dim >= current_dimension() )
@ -787,13 +787,13 @@ Triangulation_data_structure<Dim, Vb, Fcb>
// init state for enumerating all candidate faces:
internal::Combination_enumerator f_idx(dim, v_idx + 1, current_dimension());
Face f(*s);
f.set_index(0, v_idx);
f.set_index(0, sorted_idx[v_idx]);
while( ! f_idx.end() )
{
// check if face has already been found
for( int i = 0; i < dim; ++i )
f.set_index(1 + i, sorted_idx[f_idx[i]]);
face_set.insert(f);
face_set.insert(f); // checks if face has already been found
// compute next sorted face (lexicographic enumeration)
++f_idx;
}