unify API

This commit is contained in:
Andreas Fabri 2014-05-20 17:39:56 +02:00
parent 999b9a861a
commit 6b129f3ad0
5 changed files with 55 additions and 42 deletions

View File

@ -111,7 +111,7 @@ Constrained_Delaunay_triangulation_2& cdt1);
A templated constructor which introduces and builds A templated constructor which introduces and builds
a constrained triangulation with constrained edges in the range a constrained triangulation with constrained edges in the range
`[first,last)`. `[first,last)`.
\tparam InputIterator must be an input iterator with the value type `Constraint`. \tparam InputIterator must be an input iterator with the value type `std::pair<Point,Point>`.
*/ */
template<class InputIterator> Constrained_Delaunay_triangulation_2( template<class InputIterator> Constrained_Delaunay_triangulation_2(
InputIterator first, InputIterator first,
@ -186,7 +186,7 @@ Once endpoints have been inserted, the segments are inserted in the order of the
using the vertex handles of its endpoints using the vertex handles of its endpoints
\return the number of inserted points. \return the number of inserted points.
\tparam ConstraintIterator must be an input iterator with `Constraint` or `Segment_2` as value type. \tparam ConstraintIterator must be an input iterator with `std::pair<Point,Point>` or `Segment_2` as value type.
*/ */
template <class ConstraintIterator> template <class ConstraintIterator>
std::size_t insert_constraints(ConstraintIterator first, ConstraintIterator beyond); std::size_t insert_constraints(ConstraintIterator first, ConstraintIterator beyond);
@ -194,7 +194,7 @@ std::size_t insert_constraints(ConstraintIterator first, ConstraintIterator beyo
/*! /*!
Same as above except that each constraints is given as a pair of indices of the points Same as above except that each constraints is given as a pair of indices of the points
in the range [points_first, points_beyond). The indices must go from 0 to `std::distance(points_first, points_beyond)` in the range [points_first, points_beyond). The indices must go from 0 to `std::distance(points_first, points_beyond)`
\tparam PointIterator is an input iterator with `Point_2` as value type. \tparam PointIterator is an input iterator with `Point` as value type.
\tparam IndicesIterator is an input iterator with `std::pair<Int, Int>` where `Int` is an integral type implicitly convertible to `std::size_t` \tparam IndicesIterator is an input iterator with `std::pair<Int, Int>` where `Int` is an integral type implicitly convertible to `std::size_t`
*/ */
template <class PointIterator, class IndicesIterator> template <class PointIterator, class IndicesIterator>
@ -204,7 +204,7 @@ std::size_t insert_constraints(PointIterator points_first, PointIterator points_
/*! /*!
Inserts the line segment between the points `c.first` and `c.second` as a constrained edge in the triangulation. Inserts the line segment between the points `c.first` and `c.second` as a constrained edge in the triangulation.
*/ */
void push_back(const Constraint& c); void push_back(const std::pair<Point,Point>& c);
/*! /*!
Inserts the line segment whose endpoints are the vertices `va` and Inserts the line segment whose endpoints are the vertices `va` and
@ -212,6 +212,22 @@ Inserts the line segment whose endpoints are the vertices `va` and
*/ */
void insert_constraint(Vertex_handle va, Vertex_handle vb); void insert_constraint(Vertex_handle va, Vertex_handle vb);
/*!
Inserts a polyline defined by the points in the range `[first,last)`.
\tparam PointIterator must be an `InputIterator` with the value type `Point`.
*/
template < class PointIterator>
void insert_constraint(PointIterator first, PointIterator last);
/*!
Inserts the polygon.
*/
template <typename Polygon_2>
void insert_constraint(const Polygon_2& polygon);
/*! /*!
Removes vertex v. Removes vertex v.
\pre Vertex `v` is not incident to a constrained edge. \pre Vertex `v` is not incident to a constrained edge.

View File

@ -33,8 +33,8 @@ A constrained triangulation is a triangulation of a set of points
which has to include among its edges which has to include among its edges
a given set of polylines a given set of polylines
joining the points. The given polylines are joining the points. The given polylines are
called <I>constraints</I> and the corresponding called *constraints* and the corresponding
edges in the triangulation are called <I>constrained edges</I>. edges in the triangulation are called *constrained edges* or *sub-constraints*.
The endpoints of constrained edges are of course vertices of the The endpoints of constrained edges are of course vertices of the
triangulation. However the triangulation may include triangulation. However the triangulation may include
@ -57,23 +57,22 @@ is a proper intersection point of two
constraints. A single constraint intersecting other constraints. A single constraint intersecting other
constraints will then appear as the union of several constraints will then appear as the union of several
constrained edges of the triangulation. constrained edges of the triangulation.
The two versions dealing with intersecting constraints, slightly differ There are two ways to deal with intersecting constraints.
in the way intersecting constraints are dealt with.
<UL> <UL>
<LI>One of them is <LI>The first one is robust when predicates are evaluated exactly but
designed to be robust when predicates are evaluated exactly but
constructions (i. e. intersection computations) are constructions (i. e. intersection computations) are
approximate. approximate.
<LI>The other one is designed to be used <LI>The second one should be used with exact arithmetic (meaning exact
with an exact arithmetic (meaning exact evaluation of predicates and exact computation of intersections.)
evaluation of predicates and exact computation of intersections.)
This last version finds its full efficiency when used in conjunction
with a constraint hierarchy data structure
as provided in the class
`Polylne_constrained_triangulation_2`. See
Section \ref Section_2D_Triangulations_Constrained_Plus.
</UL> </UL>
</UL> </UL>
In order to retrieve the constrained edges of a constraint, or
the constraints overlapping with a constrained edge, we provide
the class `Constrained_triangulation_plus_2`. This class maintains
a constraint hierarchy data structure. See
Section \ref Section_2D_Triangulations_Constrained_Plus for details.
This class should also be used when doing exact intersection computations
as it avoids the cascading of intersection computations.
\image html constraints.png \image html constraints.png
\image latex constraints.png \image latex constraints.png
@ -277,22 +276,18 @@ are removed and new ones are created.
void insert_constraint(const Vertex_handle & va, const Vertex_handle & vb); void insert_constraint(const Vertex_handle & va, const Vertex_handle & vb);
/*! /*!
Inserts the polyline defined by the iterator range `[begin,end)`. Inserts a polyline defined by the points in the range `[first,last)`.
\tparam InputIterator must be an input iterator with value type `Point`.
\tparam PointIterator must be an `InputIterator` with the value type `Point`.
*/ */
template <typename InputIterator> template < class PointIterator>
void insert_constraint(InputIterator begin, InputIterator end); void insert_constraint(PointIterator first, PointIterator last);
/*! /*!
Inserts the polyline defined by the iterator range `range`. Inserts the polygon.
\tparam IteratorRange must be an iterator range with value type `Point`.
*/
template <typename IteratorRange>
void insert_constraint(IteratorRange range);
/*!
Inserts the polygon.
*/ */
template <typename Polygon_2>
void insert_constraint(const Polygon_2& polygon); void insert_constraint(const Polygon_2& polygon);

View File

@ -5,9 +5,9 @@ namespace CGAL {
\ingroup PkgTriangulation2TriangulationClasses \ingroup PkgTriangulation2TriangulationClasses
The class `Constrained_triangulation_plus_2` The class `Constrained_triangulation_plus_2`
implements a constrained triangulation where the constraints are polylines. implements a constrained triangulation that
It maintains an additional data structure, called the constraint hierarchy, maintains an additional data structure, called the constraint hierarchy,
that keeps track of the input constraints and of their refinement which keeps track of the input constraints and of their refinement
in the triangulation. in the triangulation.
The class `Constrained_triangulation_plus_2<Tr>` The class `Constrained_triangulation_plus_2<Tr>`
@ -225,17 +225,18 @@ void insert_constraint(Vertex_handle va, Vertex_handle vb);
Inserts a polyline defined by the points in the range `[first,last)`. Inserts a polyline defined by the points in the range `[first,last)`.
Returns the constraint id. Returns the constraint id.
\tparam InputIterator must be an input iterator with the value type `Point`. \tparam PointIterator must be an `InputIterator` with the value type `Point`.
*/ */
template < class InputIterator> template < class PointIterator>
Constraint_id insert_constraint(InputIterator first, InputIterator last); Constraint_id insert_constraint(PointIterator first, PointIterator last);
/*! /*!
Inserts the polyline defined by the iterator range `range`. Inserts the polygon. Returns the constraint id.
\tparam IteratorRange must be an iterator range with value type `Point`.
*/ */
template <typename IteratorRange> template < class Polygon_2>
void insert_constraint(IteratorRange range); Constraint_id insert_constraint(const Polygon_2& polygon);
/*! /*!
Removes the constraint `cid`, without removing the points from the triangulation. Removes the constraint `cid`, without removing the points from the triangulation.

View File

@ -820,8 +820,7 @@ There are two ways to deal with intersecting constraints.
<UL> <UL>
<LI>The first one is robust when predicates are evaluated exactly but <LI>The first one is robust when predicates are evaluated exactly but
constructions (i. e. intersection computations) are approximate. constructions (i. e. intersection computations) are approximate.
<LI>The second one is designed to be used <LI>The second one should be used with exact arithmetic (meaning exact
with exact arithmetic (meaning exact
evaluation of predicates and exact computation of intersections.) evaluation of predicates and exact computation of intersections.)
</UL> </UL>
</UL> </UL>

View File

@ -426,6 +426,8 @@ public:
segment_indices.end() ); segment_indices.end() );
} }
template <class OutputItFaces, class OutputItBoundaryEdges> template <class OutputItFaces, class OutputItBoundaryEdges>
std::pair<OutputItFaces,OutputItBoundaryEdges> std::pair<OutputItFaces,OutputItBoundaryEdges>
get_conflicts_and_boundary(const Point &p, get_conflicts_and_boundary(const Point &p,