mirror of https://github.com/CGAL/cgal
Add a geometric traits class TODO: Make it complete
Made Direction_2 public as it in the API Removed a typename
This commit is contained in:
parent
3cf3803435
commit
bd02f8a544
|
|
@ -0,0 +1,59 @@
|
|||
/*!
|
||||
\ingroup PkgConeBasedSpannersConcepts
|
||||
\cgalConcept
|
||||
|
||||
All convex hull and extreme point algorithms provided in \cgal are
|
||||
parameterized with a traits class `Traits`, which defines the
|
||||
primitives (objects and predicates) that the cone based spanner algorithms use.
|
||||
|
||||
\cgalHasModel any model of a \cgal %kernel.
|
||||
|
||||
*/
|
||||
|
||||
class ConeBasedSpannerTraits {
|
||||
public:
|
||||
|
||||
/// \name Types
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
The point type.
|
||||
*/
|
||||
typedef unspecified_type Point_2;
|
||||
|
||||
|
||||
/*!
|
||||
Predicate object type that must provide
|
||||
`bool operator()(Point_2 p, Point_2 q,
|
||||
Point_2 r,Point_2 s)`, which returns `true` iff
|
||||
the signed distance from \f$ r\f$ to the line \f$ l_{pq}\f$ through \f$ p\f$ and \f$ q\f$
|
||||
is smaller than the distance from \f$ s\f$ to \f$ l_{pq}\f$. It is used to
|
||||
compute the point right of a line with maximum unsigned distance to
|
||||
the line. The predicate must provide a total order compatible
|
||||
with convexity, <I>i.e.</I>, for any line segment \f$ s\f$ one of the
|
||||
endpoints
|
||||
of \f$ s\f$ is the smallest point among the points on \f$ s\f$, with respect to
|
||||
the order given by `Less_signed_distance_to_line_2`.
|
||||
*/
|
||||
typedef unspecified_type Less_signed_distance_to_line_2;
|
||||
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
|
||||
/// \name Operations
|
||||
/// The following member functions to create instances of the above predicate
|
||||
/// object types must exist.
|
||||
/// @{
|
||||
|
||||
|
||||
/*!
|
||||
|
||||
*/
|
||||
Less_signed_distance_to_line_2 less_signed_distance_to_line_2_object();
|
||||
|
||||
|
||||
/// @}
|
||||
|
||||
}; /* end ConeBasedSpannerTraits */
|
||||
|
|
@ -41,6 +41,7 @@ a global function to generate the data and script files used by Gnuplot to plot
|
|||
\cgalClassifedRefPages
|
||||
|
||||
## Concepts ##
|
||||
- `ConeBasedSpannerTraits`
|
||||
- `ComputeConeBoundaries_2`
|
||||
- `ConstructConeBasedSpanner_2`
|
||||
|
||||
|
|
|
|||
|
|
@ -136,9 +136,9 @@ private:
|
|||
//typedef typename Kernel_type::FT FT;
|
||||
//typedef typename Kernel_type::Direction_2 Direction_2;
|
||||
//typedef typename Kernel_type::Aff_transformation_2 Transformation;
|
||||
typedef typename Exact_predicates_exact_constructions_kernel_with_sqrt::FT FT;
|
||||
typedef typename Exact_predicates_exact_constructions_kernel_with_sqrt::Direction_2 Direction_2;
|
||||
typedef typename Exact_predicates_exact_constructions_kernel_with_sqrt::Aff_transformation_2 Transformation;
|
||||
typedef Exact_predicates_exact_constructions_kernel_with_sqrt::FT FT;
|
||||
typedef Exact_predicates_exact_constructions_kernel_with_sqrt::Direction_2 Direction_2;
|
||||
typedef Exact_predicates_exact_constructions_kernel_with_sqrt::Aff_transformation_2 Transformation;
|
||||
|
||||
public:
|
||||
/* No member variables in this class, so a Constructor is not needed. */
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public:
|
|||
typedef typename Graph_::vertex_descriptor second_argument_type;
|
||||
typedef bool result_type;
|
||||
|
||||
// typedef for Diretion_2 and Line_2
|
||||
// typedef for Direction_2 and Line_2
|
||||
typedef typename Kernel_::Direction_2 Direction_2;
|
||||
typedef typename Kernel_::Line_2 Line_2;
|
||||
typedef typename Kernel_::Point_2 Point_2;
|
||||
|
|
|
|||
|
|
@ -49,21 +49,21 @@ namespace CGAL {
|
|||
|
||||
\cgalModels `ConstructConeBasedSpanner_2`
|
||||
*/
|
||||
template <typename Kernel_, typename Graph_>
|
||||
template <typename Traits, typename Graph_>
|
||||
class Construct_theta_graph_2 {
|
||||
|
||||
public:
|
||||
/*! Indicate the \cgal kernel type. */
|
||||
typedef Kernel_ Kernel_type;
|
||||
/*! is the geometric traits which must be a model of the concept `ConeBasedSpannerTraits` */
|
||||
typedef Traits Geom_traits;
|
||||
/*! Indicate the specific type of `boost::adjacency_list`. */
|
||||
typedef Graph_ Graph_type;
|
||||
|
||||
typedef typename Geom_traits::Direction_2 Direction_2;
|
||||
private:
|
||||
typedef typename Kernel_::Direction_2 Direction_2;
|
||||
typedef typename Kernel_::Point_2 Point_2;
|
||||
typedef typename Kernel_::Line_2 Line_2;
|
||||
typedef typename Kernel_::Aff_transformation_2 Transformation;
|
||||
typedef Less_by_direction_2<Kernel_, Graph_> Less_by_direction;
|
||||
typedef typename Geom_traits::Point_2 Point_2;
|
||||
typedef typename Geom_traits::Line_2 Line_2;
|
||||
typedef typename Geom_traits::Aff_transformation_2 Transformation;
|
||||
typedef Less_by_direction_2<Geom_traits, Graph_> Less_by_direction;
|
||||
|
||||
/* Store the number of cones. */
|
||||
unsigned int cone_number;
|
||||
|
|
@ -95,7 +95,7 @@ public:
|
|||
rays.reserve(k);
|
||||
/* Initialize a functor, specialization will happen here depending on the kernel type to
|
||||
compute the cone boundaries either exactly or inexactly */
|
||||
Compute_cone_boundaries_2<Kernel_> compute_cones;
|
||||
Compute_cone_boundaries_2<Geom_traits> compute_cones;
|
||||
// compute the rays using the functor
|
||||
compute_cones(k, initial_direction, rays.begin());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,20 +47,20 @@ namespace CGAL {
|
|||
|
||||
\cgalModels `ConstructConeBasedSpanner_2`
|
||||
*/
|
||||
template <typename Kernel_, typename Graph_>
|
||||
template <typename Traits, typename Graph_>
|
||||
class Construct_yao_graph_2 {
|
||||
|
||||
public:
|
||||
/*! Indicate the \cgal kernel type. */
|
||||
typedef Kernel_ Kernel_type;
|
||||
/*! is the geometric traits which must be a model of the concept `ConeBasedSpannerTraits` */
|
||||
typedef Traits Geom_traits;
|
||||
/*! Indicate the specific type of `boost::adjacency_list`. */
|
||||
typedef Graph_ Graph_type;
|
||||
|
||||
typedef typename Geom_traits::Direction_2 Direction_2;
|
||||
private:
|
||||
typedef typename Kernel_::Direction_2 Direction_2;
|
||||
typedef typename Kernel_::Point_2 Point_2;
|
||||
typedef typename Kernel_::Line_2 Line_2;
|
||||
typedef Less_by_direction_2<Kernel_, Graph_> Less_by_direction;
|
||||
typedef typename Geom_traits::Point_2 Point_2;
|
||||
typedef typename Geom_traits::Line_2 Line_2;
|
||||
typedef Less_by_direction_2<Geom_traits, Graph_> Less_by_direction;
|
||||
// a type for the set to store vertices sorted by a direction
|
||||
typedef std::set<typename Graph_::vertex_descriptor, Less_by_direction> Point_set;
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ public:
|
|||
rays.reserve(k);
|
||||
/* Initialize a functor, specialization will happen here depending on the kernel type to
|
||||
compute the cone boundaries either exactly or inexactly */
|
||||
Compute_cone_boundaries_2<Kernel_> compute_cones;
|
||||
Compute_cone_boundaries_2<Geom_traits> compute_cones;
|
||||
// compute the rays using the functor
|
||||
compute_cones(k, initial_direction, rays.begin());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue