revised the definition of TDS::Facet and TDS::Rotor to avoid problems with automatic casting of Full_cell_handle to Facet, and fix Facet_iterator to not use the equality comparison of two Facets, which is not in the TDS concept

This commit is contained in:
Samuel Hornus 2012-07-19 13:46:48 +00:00
parent a545a766f7
commit 475ca91c6a
5 changed files with 51 additions and 34 deletions

View File

@ -52,9 +52,9 @@ Two full cells are {\em adjacent} if they share a facet. Two faces are
\ccc{CGAL::Triangulation_data_structure<Dimensionality, TriangulationDSVertex, TriangulationDSFullCell>}
\ccTypes
\ccThree{typedef std::pair<Full_cell_handle, int>}{Facet;}{}
\ccThreeToTwo
%\ccTypes
%\ccThree{typedef std::pair<Full_cell_handle, int>}{Facet;}{}
%\ccThreeToTwo
\ccNestedType{Vertex}
{
@ -70,13 +70,13 @@ The concept \ccRefName\ also defines a type for describing facets of the
triangulation with codimension~1:
\ccThree{typedef std::pair<Full_cell_handle, int>}{Facet;}{}
\ccTypedef{typedef std::pair<Full_cell_handle, int> Facet;}
%\ccNestedType{Facet}
%\ccThree{typedef std::pair<Full_cell_handle, int>}{Facet;}{}
%\ccTypedef{typedef std::pair<Full_cell_handle, int> Facet;}
\ccNestedType{Facet}
{
\ccc{Facet f(c,i)} represents the facet of
full cell \ccc{c} opposite to its \ccc{i}-th vertex.
Its dimension is \ccc{current_dimension()-1}.
The constructor \ccc{Facet(c,i)} constructs a \ccc{Facet} representing the facet of
full cell \ccc{c} opposite to its \ccc{i}-th vertex. Its dimension is
\ccc{current_dimension()-1}.
}
\ccThreeToTwo

View File

@ -121,19 +121,24 @@ public:
// A co-dimension 2 sub-simplex. called a Rotor because we can rotate
// the two "covertices" around the sub-simplex. Useful for traversing the
// boundary of a hole. NOT DOCUMENTED
typedef cpp0x::tuple<Full_cell_handle, int, int> Rotor;
// NOT DOCUMENTED
// A Rotor has two covertices
int index_of_second_covertex(const Rotor & f) const
typedef cpp11::tuple<Full_cell_handle, int, int> Rotor;
Full_cell_handle full_cell(const Rotor & r) const // NOT DOCUMENTED
{
return cpp0x::get<2>(f);
return cpp11::get<0>(r);
}
// NOT DOCUMENTED...
Rotor rotate_rotor(Rotor & f)
int index_of_covertex(const Rotor & r) const // NOT DOCUMENTED
{
int opposite = full_cell(f)->mirror_index(index_of_covertex(f));
Full_cell_handle s = full_cell(f)->neighbor(index_of_covertex(f));
int new_second = s->index(full_cell(f)->vertex(index_of_second_covertex(f)));
return cpp11::get<1>(r);
}
int index_of_second_covertex(const Rotor & r) const // NOT DOCUMENTED
{
return cpp11::get<2>(r);
}
Rotor rotate_rotor(Rotor & r) // NOT DOCUMENTED...
{
int opposite = full_cell(r)->mirror_index(index_of_covertex(r));
Full_cell_handle s = full_cell(r)->neighbor(index_of_covertex(r));
int new_second = s->index(full_cell(r)->vertex(index_of_second_covertex(r)));
return Rotor(s, new_second, opposite);
}

View File

@ -138,20 +138,14 @@ public:
// FACETS OPERATIONS
// works for Face_ = Facet and Face_ = Rotor.
// NOT DOCUMENTED for the Rotor case...
template< typename Face_ >
Full_cell_handle full_cell(const Face_ & f) const
Full_cell_handle full_cell(const Facet & f) const
{
return tds().full_cell(f);
}
// works for Face_ = Facet and Face_ = Rotor.
// NOT DOCUMENTED for the Rotor case...
template< class Face_ >
int index_of_covertex(const Face_ & f) const
int index_of_covertex(const Facet & f) const
{
return tds().index_of_covertex<Face_>(f);
return tds().index_of_covertex(f);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CREATION

View File

@ -111,12 +111,28 @@ public:
|rotate_rotor| and |insert_in_tagged_hole|) */
// A co-dimension 1 sub-simplex.
typedef cpp0x::tuple<Full_cell_handle, int> Facet; /* Concept */
class Facet /* Concept */
{
Full_cell_handle full_cell_;
int index_of_covertex_;
public:
Facet() : full_cell_(), index_of_covertex_(0) {}
Facet(Full_cell_handle f, int i) : full_cell_(f), index_of_covertex_(i) {}
Full_cell_handle full_cell() const { return full_cell_; }
int index_of_covertex() const { return index_of_covertex_; }
};
// A co-dimension 2 sub-simplex. called a Rotor because we can rotate
// the two "covertices" around the sub-simplex. Useful for traversing the
// boundary of a hole. NOT DOCUMENTED
typedef cpp0x::tuple<Full_cell_handle, int, int> Rotor;
class Rotor : public Facet
{
int index_of_second_covertex_;
public:
Rotor() : Facet(), index_of_second_covertex_(0) {}
Rotor(Full_cell_handle f, int first, int second) : Facet(f, first), index_of_second_covertex_(second) {}
int index_of_second_covertex() const { return index_of_second_covertex_; }
};
typedef Triangulation_face<Self> Face; /* Concept */
@ -306,7 +322,7 @@ public:
template< typename Face_ >
Full_cell_handle full_cell(const Face_ & f) const /* Concept */
{
return cpp0x::get<0>(f);
return f.full_cell();
}
// works for Face_ = Facet and Face_ = Rotor.
@ -314,14 +330,14 @@ public:
template< class Face_ >
int index_of_covertex(const Face_ & f) const /* Concept */
{
return cpp0x::get<1>(f);
return f.index_of_covertex();
}
// NOT DOCUMENTED
// A Rotor has two covertices
int index_of_second_covertex(const Rotor & f) const
{
return cpp0x::get<2>(f);
return f.index_of_second_covertex();
}
// works for Face_ = Facet and Face_ = Rotor.

View File

@ -86,7 +86,9 @@ public:
bool operator==(const Facet_iterator & fi) const
{
return (&tds_ == &fi.tds_) && (ft_ == fi.ft_);
return (&tds_ == &fi.tds_) &&
(tds_.index_of_covertex(ft_) == fi.tds_.index_of_covertex(fi.ft_)) &&
(tds_.full_cell(ft_) == fi.tds_.full_cell(fi.ft_));
}
bool operator!=(const Facet_iterator & fi) const