This commit is contained in:
Andreas Fabri 2019-04-11 10:54:00 +02:00
parent dd6691b2ce
commit 66437517c9
7 changed files with 16 additions and 190 deletions

View File

@ -88,8 +88,7 @@ the resulting sequence of polygons is returned.
\cgalHeading{Requirements} \cgalHeading{Requirements}
<OL> <OL>
<LI>`Traits` is a model of the concepts `PartitionTraits_2` <LI>`Traits` is a model of the concepts `PartitionTraits_2`.
and `YMonotonePartitionTraits_2`.
For the purpose of For the purpose of
checking the validity of the \f$ y\f$-monotone partition produced as checking the validity of the \f$ y\f$-monotone partition produced as
a preprocessing step for the convex partitioning, it must also a preprocessing step for the convex partitioning, it must also
@ -232,8 +231,7 @@ the resulting sequence of polygons is returned.
\cgalHeading{Requirements} \cgalHeading{Requirements}
<OL> <OL>
<LI>`Traits` is a model of the concept <LI>`Traits` is a model of the concept `PartitionTraits_2`
`YMonotonePartitionTraits_2`
and, for the purposes and, for the purposes
of checking the postcondition that the partition is valid, it should of checking the postcondition that the partition is valid, it should
also be a model of `YMonotonePartitionIsValidTraits_2`. also be a model of `YMonotonePartitionIsValidTraits_2`.

View File

@ -1,89 +0,0 @@
/*!
\ingroup PkgPartition2Concepts
\cgalConcept
Requirements of a traits class to be
used with the function `y_monotone_partition_2()`.
\cgalRefines `PartitionTraits_2`
\cgalHasModel `CGAL::Partition_traits_2<R>`
*/
class YMonotonePartitionTraits_2 {
public:
/// \name Types
/// In addition to the types defined for the concept `PartitionTraits_2`, the following types are also required:
/// @{
/*!
*/
typedef unspecified_type Line_2;
/*!
Predicate object type that provides
`CGAL::Comparision_result operator()(Point_2 p, Line_2 h)` to compare
the \f$ x\f$ coordinate of `p` and the horizontal projection of `p`
on `h`.
*/
typedef unspecified_type Compare_x_at_y_2;
/*!
Function object type that provides
`Line_2 operator()(Point_2 p, Point_2 q)`, which constructs and
returns the line defined by the points \f$ p\f$ and \f$ q\f$.
*/
typedef unspecified_type Construct_line_2;
/*!
Function object type that provides
`bool operator()(Line_2 l)`, which returns `true` iff the
line `l` is horizontal.
*/
typedef unspecified_type Is_horizontal_2;
/// @}
/// \name Creation
/// A copy constructor and default constructor are required.
/// @{
/*!
*/
YMonotonePartitionTraits();
/*!
*/
YMonotonePartitionTraits(const YMonotonePartitionTraits tr);
/// @}
/// \name Operations
/// In addition to the functions required for the concept
/// `PartitionTraits_2`, the following functions that create instances
/// of the above function object types must exist.
/// @{
/*!
*/
Construct_line_2 construct_line_2_object();
/*!
*/
Compare_x_at_y_2 compare_x_at_y_2_object();
/*!
*/
Is_horizontal_2 is_horizontal_2_object();
/// @}
}; /* end YMonotonePartitionTraits_2 */

View File

@ -75,7 +75,6 @@ original polygon).
- `PartitionTraits_2` - `PartitionTraits_2`
- `PartitionIsValidTraits_2` - `PartitionIsValidTraits_2`
- `YMonotonePartitionIsValidTraits_2` - `YMonotonePartitionIsValidTraits_2`
- `YMonotonePartitionTraits_2`
\cgalCRPSection{Function Object Concepts} \cgalCRPSection{Function Object Concepts}
- `PolygonIsValid` - `PolygonIsValid`

View File

@ -40,16 +40,16 @@ class Indirect_edge_compare
typedef typename Traits::Orientation_2 Orientation_2; typedef typename Traits::Orientation_2 Orientation_2;
typedef typename Traits::Compare_y_2 Compare_y_2; typedef typename Traits::Compare_y_2 Compare_y_2;
typedef typename Traits::Compare_x_2 Compare_x_2; typedef typename Traits::Compare_x_2 Compare_x_2;
typedef typename Traits::Construct_line_2 Construct_line_2; // typedef typename Traits::Construct_line_2 Construct_line_2;
typedef typename Traits::Compare_x_at_y_2 Compare_x_at_y_2; // typedef typename Traits::Compare_x_at_y_2 Compare_x_at_y_2;
typedef typename Traits::Line_2 Line_2; // typedef typename Traits::Line_2 Line_2;
typedef typename Traits::Point_2 Point_2; typedef typename Traits::Point_2 Point_2;
Indirect_edge_compare(const Traits& traits) : Indirect_edge_compare(const Traits& traits) :
_compare_y_2(traits.compare_y_2_object()), _compare_y_2(traits.compare_y_2_object()),
_compare_x_2(traits.compare_x_2_object()), _compare_x_2(traits.compare_x_2_object())
_construct_line_2(traits.construct_line_2_object()), // _construct_line_2(traits.construct_line_2_object()),
_compare_x_at_y_2(traits.compare_x_at_y_2_object()) //_compare_x_at_y_2(traits.compare_x_at_y_2_object())
{ } { }
// determines if the edge (edge_vtx_1, edge_vtx_1++) has a larger // determines if the edge (edge_vtx_1, edge_vtx_1++) has a larger
@ -72,7 +72,7 @@ class Indirect_edge_compare
else else
{ {
// construct supporting line for edge // construct supporting line for edge
Line_2 line = _construct_line_2(Point_2(*edge_vtx_1), Point_2(*edge_vtx_2)); // Line_2 line = _construct_line_2(Point_2(*edge_vtx_1), Point_2(*edge_vtx_2));
return compare_x_at_y(Point_2(*vertex), Point_2(*edge_vtx_1), Point_2(*edge_vtx_2)) == SMALLER; return compare_x_at_y(Point_2(*vertex), Point_2(*edge_vtx_1), Point_2(*edge_vtx_2)) == SMALLER;
} }
} }
@ -120,11 +120,11 @@ class Indirect_edge_compare
// else neither endpoint is shared // else neither endpoint is shared
// construct supporting line // construct supporting line
Line_2 l_p = _construct_line_2(Point_2(*p), Point_2(*after_p)); // Line_2 l_p = _construct_line_2(Point_2(*p), Point_2(*after_p));
//if (_is_horizontal_2(l_p)) //if (_is_horizontal_2(l_p))
if(_compare_y_2(Point_2(*p), Point_2(*after_p)) == EQUAL) if(_compare_y_2(Point_2(*p), Point_2(*after_p)) == EQUAL)
{ {
Line_2 l_q = _construct_line_2(Point_2(*q), Point_2(*after_q)); // Line_2 l_q = _construct_line_2(Point_2(*q), Point_2(*after_q));
//if (_is_horizontal_2(l_q)) //if (_is_horizontal_2(l_q))
if(_compare_y_2(Point_2(*q), Point_2(*after_q)) == EQUAL) if(_compare_y_2(Point_2(*q), Point_2(*after_q)) == EQUAL)
@ -156,7 +156,7 @@ class Indirect_edge_compare
return q_larger_x; return q_larger_x;
// else one smaller and one larger // else one smaller and one larger
// construct the other line // construct the other line
Line_2 l_q = _construct_line_2(Point_2(*q), Point_2(*after_q)); // Line_2 l_q = _construct_line_2(Point_2(*q), Point_2(*after_q));
//if (_is_horizontal_2(l_q)) // p is not horizontal //if (_is_horizontal_2(l_q)) // p is not horizontal
if(_compare_y_2(Point_2(*q), Point_2(*after_q)) == EQUAL) if(_compare_y_2(Point_2(*q), Point_2(*after_q)) == EQUAL)
{ {
@ -169,8 +169,8 @@ class Indirect_edge_compare
Orientation_2 _orientation_2; Orientation_2 _orientation_2;
Compare_y_2 _compare_y_2; Compare_y_2 _compare_y_2;
Compare_x_2 _compare_x_2; Compare_x_2 _compare_x_2;
Construct_line_2 _construct_line_2; // Construct_line_2 _construct_line_2;
Compare_x_at_y_2 _compare_x_at_y_2; // Compare_x_at_y_2 _compare_x_at_y_2;
}; };
} }

View File

@ -61,8 +61,6 @@
#include <CGAL/license/Partition_2.h> #include <CGAL/license/Partition_2.h>
#include <CGAL/Segment_2.h>
#include <CGAL/Partition_2/Rotation_tree_2.h> #include <CGAL/Partition_2/Rotation_tree_2.h>
#include <CGAL/Partition_2/Indirect_less_xy_2.h> #include <CGAL/Partition_2/Indirect_less_xy_2.h>
#include <CGAL/Partition_2/Iterator_list.h> #include <CGAL/Partition_2/Iterator_list.h>
@ -85,7 +83,6 @@ class Vertex_visibility_graph_2
private: private:
typedef Vertex_visibility_graph_2<Traits> Self; typedef Vertex_visibility_graph_2<Traits> Self;
typedef typename Traits::Point_2 Point_2; typedef typename Traits::Point_2 Point_2;
typedef typename Traits::Segment_2 Segment_2;
typedef typename Traits::Left_turn_2 Left_turn_2; typedef typename Traits::Left_turn_2 Left_turn_2;
typedef typename Traits::Less_xy_2 Less_xy_2; typedef typename Traits::Less_xy_2 Less_xy_2;
typedef typename Traits::Orientation_2 Orientation_2; typedef typename Traits::Orientation_2 Orientation_2;

View File

@ -52,11 +52,6 @@ class Partition_traits_2 : public Partition_traits_2_base<Kernel_>
typedef CGAL::Is_convex_2<Self> Is_convex_2; typedef CGAL::Is_convex_2<Self> Is_convex_2;
typedef CGAL::Is_y_monotone_2<Self> Is_y_monotone_2; typedef CGAL::Is_y_monotone_2<Self> Is_y_monotone_2;
// needed by Indirect_edge_compare, used in y_monotone and greene_approx
typedef typename Kernel::Line_2 Line_2;
typedef typename Kernel::Construct_line_2 Construct_line_2;
typedef typename Kernel::Compare_x_at_y_2 Compare_x_at_y_2;
typedef typename Kernel::Is_horizontal_2 Is_horizontal_2;
// needed by visibility graph and thus by optimal convex // needed by visibility graph and thus by optimal convex
typedef typename Kernel::Collinear_are_ordered_along_line_2 typedef typename Kernel::Collinear_are_ordered_along_line_2
@ -64,30 +59,6 @@ class Partition_traits_2 : public Partition_traits_2_base<Kernel_>
typedef typename Kernel::Are_strictly_ordered_along_line_2 typedef typename Kernel::Are_strictly_ordered_along_line_2
Are_strictly_ordered_along_line_2; Are_strictly_ordered_along_line_2;
// needed by approx_convex (for constrained triangulation)
// and optimal convex (for vis. graph)
typedef typename Kernel::Segment_2 Segment_2;
// needed by optimal convex (for vis. graph)
typedef typename Kernel::Construct_segment_2 Construct_segment_2;
typedef typename Kernel::Construct_ray_2 Construct_ray_2;
Construct_line_2
construct_line_2_object() const
{ return Construct_line_2(); }
Compare_x_at_y_2
compare_x_at_y_2_object() const
{ return Compare_x_at_y_2(); }
Construct_segment_2
construct_segment_2_object() const
{ return Construct_segment_2(); }
Construct_ray_2
construct_ray_2_object() const
{ return Construct_ray_2(); }
Collinear_are_ordered_along_line_2 Collinear_are_ordered_along_line_2
collinear_are_ordered_along_line_2_object() const collinear_are_ordered_along_line_2_object() const
{ return Collinear_are_ordered_along_line_2(); } { return Collinear_are_ordered_along_line_2(); }
@ -96,10 +67,6 @@ class Partition_traits_2 : public Partition_traits_2_base<Kernel_>
are_strictly_ordered_along_line_2_object() const are_strictly_ordered_along_line_2_object() const
{ return Are_strictly_ordered_along_line_2(); } { return Are_strictly_ordered_along_line_2(); }
Is_horizontal_2
is_horizontal_2_object() const
{ return Is_horizontal_2(); }
Is_convex_2 Is_convex_2
is_convex_2_object(const Self& traits) const is_convex_2_object(const Self& traits) const
{ return Is_convex_2(traits); } { return Is_convex_2(traits); }

View File

@ -77,23 +77,6 @@ public:
} }
}; };
template <typename K>
struct Pmap_compare_x_at_y_2 {
PointPropertyMap ppmap;
typename K::Compare_x_at_y_2 fct;
Pmap_compare_x_at_y_2(const PointPropertyMap& ppmap,typename K::Compare_x_at_y_2 fct)
: ppmap(ppmap), fct(fct)
{}
typename K::Compare_x_at_y_2::result_type
operator()(Arg_type p, const typename K::Line_2& line) const
{
return fct(get(ppmap,p),line);
}
};
template <typename K> template <typename K>
@ -132,24 +115,12 @@ public:
typedef CGAL::Is_convex_2<Self> Is_convex_2; typedef CGAL::Is_convex_2<Self> Is_convex_2;
typedef CGAL::Is_y_monotone_2<Self> Is_y_monotone_2; typedef CGAL::Is_y_monotone_2<Self> Is_y_monotone_2;
// needed by Indirect_edge_compare, used in y_monotone and greene_approx
typedef typename Kernel::Line_2 Line_2;
typedef Pmap_fct<typename Kernel::Construct_line_2> Construct_line_2;
typedef Pmap_compare_x_at_y_2<Kernel> Compare_x_at_y_2;
typedef typename Kernel::Is_horizontal_2 Is_horizontal_2;
// needed by visibility graph and thus by optimal convex // needed by visibility graph and thus by optimal convex
typedef Pmap_collinear_are_ordered_along_line_2<Kernel> Collinear_are_ordered_along_line_2; typedef Pmap_collinear_are_ordered_along_line_2<Kernel> Collinear_are_ordered_along_line_2;
typedef Pmap_fct<typename Kernel::Are_strictly_ordered_along_line_2> typedef Pmap_fct<typename Kernel::Are_strictly_ordered_along_line_2>
Are_strictly_ordered_along_line_2; Are_strictly_ordered_along_line_2;
// needed by approx_convex (for constrained triangulation)
// and optimal convex (for vis. graph)
typedef typename Kernel::Segment_2 Segment_2;
// needed by optimal convex (for vis. graph)
typedef Pmap_fct<typename Kernel::Construct_segment_2> Construct_segment_2;
Equal_2 Equal_2
equal_2_object() const equal_2_object() const
@ -180,19 +151,6 @@ public:
{ return Compare_x_2(ppmap,static_cast<const Base_traits*>(this)->compare_x_2_object()); } { return Compare_x_2(ppmap,static_cast<const Base_traits*>(this)->compare_x_2_object()); }
Construct_line_2
construct_line_2_object() const
{ return Construct_line_2(ppmap,static_cast<const Base_traits*>(this)->construct_line_2_object()); }
Compare_x_at_y_2
compare_x_at_y_2_object() const
{ return Compare_x_at_y_2(ppmap,static_cast<const Base_traits*>(this)->compare_x_at_y_2_object()); }
Construct_segment_2
construct_segment_2_object() const
{ return Construct_segment_2(); }
Collinear_are_ordered_along_line_2 Collinear_are_ordered_along_line_2
collinear_are_ordered_along_line_2_object() const collinear_are_ordered_along_line_2_object() const
{ return Collinear_are_ordered_along_line_2(ppmap,static_cast<const Base_traits*>(this)->collinear_are_ordered_along_line_2_object()); } { return Collinear_are_ordered_along_line_2(ppmap,static_cast<const Base_traits*>(this)->collinear_are_ordered_along_line_2_object()); }
@ -202,10 +160,6 @@ public:
{ return Are_strictly_ordered_along_line_2(ppmap,static_cast<const Base_traits*>(this)->are_strictly_ordered_along_line_2_object()); } { return Are_strictly_ordered_along_line_2(ppmap,static_cast<const Base_traits*>(this)->are_strictly_ordered_along_line_2_object()); }
Is_horizontal_2
is_horizontal_2_object() const
{ return Is_horizontal_2(); }
Is_convex_2 Is_convex_2
is_convex_2_object(const Self& traits) const is_convex_2_object(const Self& traits) const
{ return Is_convex_2(traits); } { return Is_convex_2(traits); }