code refactoring

This commit is contained in:
Pavel Emeliyanenko
2008-06-25 16:55:02 +00:00
parent 8eb8fcb96f
commit 329c14dd0e
10 changed files with 720 additions and 917 deletions
@@ -199,14 +199,15 @@ public:
*/
template < class CurvedKernelViaAnalysis_2 >
class Is_bounded_2 :
public CurvedKernelViaAnalysis_2::Base::Is_bounded_2 {
public CurvedKernelViaAnalysis_2::Functor_base::Is_bounded_2 {
public:
//! this instance' first template parameter
typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
//! the bae type
typedef typename Curved_kernel_via_analysis_2::Base::Is_bounded_2 Base;
typedef typename Curved_kernel_via_analysis_2::Functor_base::Is_bounded_2
Base;
CGAL_DC_CKvA_2_GRAB_BASE_FUNCTOR_TYPES;
@@ -236,14 +237,14 @@ public:
*/
template < class CurvedKernelViaAnalysis_2 >
class Equal_2 :
public CurvedKernelViaAnalysis_2::Base::Equal_2 {
public CurvedKernelViaAnalysis_2::Functor_base::Equal_2 {
public:
//! this instance' first template parameter
typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
//! the bae type
typedef typename Curved_kernel_via_analysis_2::Base::Equal_2 Base;
typedef typename Curved_kernel_via_analysis_2::Functor_base::Equal_2 Base;
CGAL_DC_CKvA_2_GRAB_BASE_FUNCTOR_TYPES;
@@ -332,7 +333,8 @@ protected:
*/
template < class CurvedKernelViaAnalysis_2 >
class Compare_y_at_x_right_2 :
public CurvedKernelViaAnalysis_2::Base::Compare_y_at_x_right_2 {
public CurvedKernelViaAnalysis_2::Functor_base::Compare_y_at_x_right_2
{
public:
//! this instance' first template parameter
@@ -340,7 +342,7 @@ public:
//! the base type
typedef typename
Curved_kernel_via_analysis_2::Base::Compare_y_at_x_right_2 Base;
Curved_kernel_via_analysis_2::Functor_base::Compare_y_at_x_right_2 Base;
CGAL_DC_CKvA_2_GRAB_BASE_FUNCTOR_TYPES;
@@ -445,7 +447,7 @@ public:
*/
template < class CurvedKernelViaAnalysis_2 >
class Compare_y_at_x_left_2 :
public CurvedKernelViaAnalysis_2::Base::Compare_y_at_x_left_2 {
public CurvedKernelViaAnalysis_2::Functor_base::Compare_y_at_x_left_2 {
public:
//! this instance' first template parameter
@@ -453,7 +455,7 @@ public:
//! the base type
typedef typename
Curved_kernel_via_analysis_2::Base::Compare_y_at_x_left_2 Base;
Curved_kernel_via_analysis_2::Functor_base::Compare_y_at_x_left_2 Base;
CGAL_DC_CKvA_2_GRAB_BASE_FUNCTOR_TYPES;
@@ -558,14 +560,15 @@ public:
*/
template < class CurvedKernelViaAnalysis_2 >
class Intersect_2 :
public CurvedKernelViaAnalysis_2::Base::Intersect_2 {
public CurvedKernelViaAnalysis_2::Functor_base::Intersect_2 {
public:
//! this instance' first template parameter
typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
//! the bae type
typedef typename Curved_kernel_via_analysis_2::Base::Intersect_2 Base;
typedef typename Curved_kernel_via_analysis_2::Functor_base::Intersect_2
Base;
CGAL_DC_CKvA_2_GRAB_BASE_FUNCTOR_TYPES;
@@ -655,7 +658,7 @@ protected:
template < class CurvedKernelViaAnalysis_2 >
class Make_x_monotone_2 :
public CurvedKernelViaAnalysis_2::Base::Make_x_monotone_2 {
public CurvedKernelViaAnalysis_2::Functor_base::Make_x_monotone_2 {
public:
//! this instance' first template parameter
@@ -663,7 +666,7 @@ public:
//! the base type
typedef typename
Curved_kernel_via_analysis_2::Base::Make_x_monotone_2 Base;
Curved_kernel_via_analysis_2::Functor_base::Make_x_monotone_2 Base;
CGAL_DC_CKvA_2_GRAB_BASE_FUNCTOR_TYPES;
@@ -838,23 +841,77 @@ public:
} // namespace Dupin_cyclide_via_analysis_2_Functors
template <class ASiDC_traits_2, class BaseCKvA>
struct Dupin_cyclide_functor_base :
public BaseCKvA::template rebind< ASiDC_traits_2 >::Functor_base {
typedef ASiDC_traits_2 Self;
typedef typename BaseCKvA::template rebind< Self >::Functor_base
Functor_base;
#if 0
// TODO add special construct_point_2 and construct_arc_2 functors
// -> points/curves on identifications
CGAL_CKvA_2_functor_cons(Construct_point_2,
construct_point_2_object);
CGAL_CKvA_2_functor_cons(Construct_arc_2,
construct_arc_2_object);
#endif
// declares curved kernel functors, for each functor defines a member function
// returning an instance of this functor
#define CGAL_DC_CKvA_2_functor_pred(Y, Z) \
typedef Dupin_cyclide_via_analysis_2_Functors::Y< Self > Y; \
Y Z() const { \
return Y(&Self::instance()); \
}
#define CGAL_DC_CKvA_2_functor_cons(Y, Z) \
CGAL_DC_CKvA_2_functor_pred(Y, Z)
CGAL_DC_CKvA_2_functor_pred(Compare_x_on_identification_2,
compare_x_on_identification_2_object);
CGAL_DC_CKvA_2_functor_pred(Compare_y_on_identification_2,
compare_y_on_identification_2_object);
CGAL_DC_CKvA_2_functor_pred(Equal_2, equal_2_object);
CGAL_DC_CKvA_2_functor_pred(Intersect_2, intersect_2_object);
CGAL_DC_CKvA_2_functor_pred(Compare_y_at_x_right_2,
compare_y_at_x_right_2_object);
CGAL_DC_CKvA_2_functor_pred(Compare_y_at_x_left_2,
compare_y_at_x_left_2_object);
CGAL_DC_CKvA_2_functor_cons(Make_x_monotone_2,
make_x_monotone_2_object);
#undef CGAL_DC_CKvA_2_functor_pred
#undef CGAL_DC_CKvA_2_functor_cons
};
} // namespace CGALi
/*!\brief
* Derived ArrangmentTraits class for points and segments embedded on
* a given Dupin cyclide.
*/
template < class CurvedKernelViaAnalysis_2 >
template < class BaseCKvA_2 >
class Arr_surfaces_intersecting_dupin_cyclide_traits_2 :
public CurvedKernelViaAnalysis_2::template
rebind<
Arr_surfaces_intersecting_dupin_cyclide_traits_2 <
CurvedKernelViaAnalysis_2 > >::Other
public CGALi::Curved_kernel_via_analysis_2_base<
Arr_surfaces_intersecting_dupin_cyclide_traits_2< BaseCKvA_2 >,
BaseCKvA_2, typename BaseCKvA_2::Curve_kernel_2,
CGALi::Dupin_cyclide_functor_base >
{
public:
//! this instance's template parameter
typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
typedef BaseCKvA_2 Curved_kernel_via_analysis_2;
//! the class itself
typedef Arr_surfaces_intersecting_dupin_cyclide_traits_2
@@ -889,12 +946,17 @@ public:
//! type of x-monotone curve
typedef Arc_2 X_monotone_curve_2;
//! type of Base
typedef typename Curved_kernel_via_analysis_2::template
rebind< Self >::Other Base;
//! Tag to tell that the boundary functors are implemented
//! Tag to tell that the boundary functors are implemented
typedef CGAL::Arr_bounded_boundary_tag Boundary_category;
protected:
//! base kernel type
typedef CGALi::Curved_kernel_via_analysis_2_base<
Self, Curved_kernel_via_analysis_2, Curve_kernel_2,
CGALi::Dupin_cyclide_functor_base >
Base_kernel;
public:
//!\name Constructors
@@ -931,54 +993,6 @@ public:
//!@}
//!\name Predicates and Constructions
//!@{
#if 0
// TODO add special construct_point_2 and construct_arc_2 functors
// -> points/curves on identifications
CGAL_CKvA_2_functor_cons(Construct_point_2,
construct_point_2_object);
CGAL_CKvA_2_functor_cons(Construct_arc_2,
construct_arc_2_object);
#endif
// declares curved kernel functors, for each functor defines a member function
// returning an instance of this functor
#define CGAL_DC_CKvA_2_functor_pred(Y, Z) \
typedef CGAL::CGALi::Dupin_cyclide_via_analysis_2_Functors::Y< Self > Y; \
Y Z() const { \
return Y(&Self::instance()); \
} \
#define CGAL_DC_CKvA_2_functor_cons(Y, Z) \
CGAL_DC_CKvA_2_functor_pred(Y, Z)
CGAL_DC_CKvA_2_functor_pred(Compare_x_on_identification_2,
compare_x_on_identification_2_object);
CGAL_DC_CKvA_2_functor_pred(Compare_y_on_identification_2,
compare_y_on_identification_2_object);
CGAL_DC_CKvA_2_functor_pred(Equal_2, equal_2_object);
CGAL_DC_CKvA_2_functor_pred(Intersect_2, intersect_2_object);
CGAL_DC_CKvA_2_functor_pred(Compare_y_at_x_right_2,
compare_y_at_x_right_2_object);
CGAL_DC_CKvA_2_functor_pred(Compare_y_at_x_left_2,
compare_y_at_x_left_2_object);
CGAL_DC_CKvA_2_functor_cons(Make_x_monotone_2,
make_x_monotone_2_object);
#undef CGAL_DC_CKvA_2_functor_pred
#undef CGAL_DC_CKvA_2_functor_cons
//!@}
protected:
//! the stored base Dupin cyclide
mutable Dupin_cyclide_3 _m_base;
@@ -23,9 +23,6 @@
#include <CGAL/basic.h>
#include <boost/mpl/if.hpp>
#include <boost/type_traits.hpp>
#include <CGAL/Arr_enums.h>
#include <CGAL/Arr_tags.h>
#include <CGAL/Curved_kernel_via_analysis_2/Point_2.h>
@@ -40,41 +37,42 @@ CGAL_BEGIN_NAMESPACE
namespace CGALi {
// todo mode to another file
/*!\brief
* Provides basic types for Curved_kernel_via_analysis_2
*/
template < class CurvedKernelViaAnalysis_2, class CurveKernel_2 >
template < class NewCKvA, class BaseCKvA, class CurveKernel_2,
template <class, class> class FunctorBase =
Curved_kernel_via_analysis_2_functors >
class Curved_kernel_via_analysis_2_base
: public Curved_kernel_via_analysis_2_functors <
CurvedKernelViaAnalysis_2 >
{
: public FunctorBase< NewCKvA, BaseCKvA > {
public:
//!\name Global types
//!@{
//! the Curved_kernel_via_analysis_2
typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
//! type of curve kernel
typedef CurveKernel_2 Curve_kernel_2;
//! rebinds functor base to a new CKvA
template <class X>
struct rebind {
typedef FunctorBase<X, typename
BaseCKvA::Curved_kernel_via_analysis_2> Functor_base;
};
//!\name Embedded types to fulfill \c ArrangementTraits_2 concept
//! type of curve that can be analyzed
typedef typename Curve_kernel_2::Curve_analysis_2 Curve_2;
//! type of non x-monotone arc on a curve that can be analyzed
typedef CGALi::Non_x_monotone_arc_2<Curved_kernel_via_analysis_2>
typedef CGALi::Non_x_monotone_arc_2<NewCKvA>
Non_x_monotone_arc_2;
//! this instance itself
typedef
Curved_kernel_via_analysis_2_base<
Curved_kernel_via_analysis_2, CurveKernel_2
>
Self;
typedef Curved_kernel_via_analysis_2_base< NewCKvA, BaseCKvA,
CurveKernel_2, FunctorBase > Self;
//! the multiplicity type
typedef unsigned int Multiplicity;
@@ -106,8 +104,8 @@ public:
//!@{
//! type of inverval arcno cache
typedef CGALi::Curve_interval_arcno_cache< Self >
Curve_interval_arcno_cache;
typedef CGALi::Curve_interval_arcno_cache< Curve_kernel_2 >
Curve_interval_arcno_cache;
//!@}
@@ -117,12 +115,12 @@ public:
//! default constructor
Curved_kernel_via_analysis_2_base() :
_m_kernel(Curve_kernel_2()), _m_interval_arcno_cache(this) {
_m_kernel(Curve_kernel_2()) {
}
//! construct using specific Curve_kernel_2 instance \c kernel
Curved_kernel_via_analysis_2_base(const Curve_kernel_2& kernel) :
_m_kernel(kernel), _m_interval_arcno_cache(this) {
_m_kernel(kernel) {
}
//!@}
@@ -134,7 +132,7 @@ public:
* access to static Curve_interval_arcno_cache
*/
const Curve_interval_arcno_cache& interval_arcno_cache() const {
return this->_m_interval_arcno_cache;
return _m_interval_arcno_cache;
}
/*!\brief
@@ -169,7 +167,7 @@ public:
*
* \return static instance of \c Curved_kernel_via_analysis_2
*/
static Curved_kernel_via_analysis_2& instance() {
static NewCKvA& instance() {
return set_instance(_set_instance());
}
@@ -179,11 +177,11 @@ public:
* \param ckva The instance that should be stored
* \return the stored instance
*/
static Curved_kernel_via_analysis_2& set_instance(
const Curved_kernel_via_analysis_2& ckva
static NewCKvA& set_instance(
const NewCKvA& ckva
) {
static Curved_kernel_via_analysis_2 instance;
static Curved_kernel_via_analysis_2 binstance;
static NewCKvA instance;
static NewCKvA binstance;
if (&ckva == &_reset_instance()) {
instance = binstance;
@@ -201,39 +199,13 @@ public:
static void reset_instance() {
set_instance(_reset_instance());
}
//!\name Additional functors
//!@{
// declares curved kernel functors, for each functor defines a member function
// returning an instance of this functor
#define CGAL_CKvA_2_functor_pred(Y, Z) \
typedef CGALi::Curved_kernel_via_analysis_2_Functors::Y< \
Curved_kernel_via_analysis_2 > Y; \
Y Z() const { return Y(&Curved_kernel_via_analysis_2::instance()); }
#define CGAL_CKvA_2_functor_cons(Y, Z) CGAL_CKvA_2_functor_pred(Y, Z)
public:
CGAL_CKvA_2_functor_cons(Construct_point_2,
construct_point_2_object);
CGAL_CKvA_2_functor_cons(Construct_point_on_arc_2,
construct_point_on_arc_2_object);
CGAL_CKvA_2_functor_cons(Construct_arc_2,
construct_arc_2_object);
#undef CGAL_CKvA_2_functor_pred
#undef CGAL_CKvA_2_functor_cons
private:
/*!\brief
* sets instance to default for internal purposes
*/
static Curved_kernel_via_analysis_2& _set_instance() {
static Curved_kernel_via_analysis_2 instance;
static NewCKvA& _set_instance() {
static NewCKvA instance;
return instance;
}
@@ -241,8 +213,8 @@ private:
/*!\brief
* sets instance to default for internal purposes
*/
static Curved_kernel_via_analysis_2& _reset_instance() {
static Curved_kernel_via_analysis_2 instance;
static NewCKvA& _reset_instance() {
static NewCKvA instance;
return instance;
}
@@ -251,94 +223,27 @@ private:
} // namespace CGALi
/*!\brief
* Kernel for curves in a two-dimensional space, and points and arcs of them.
*
* It expects a CurveKernel_2 type that fulfills the CurveKernel_2 concept.
* The other template parameters can be left default. They are used during
* rebind to exchange certain point and arc type.
*
* Is a model of CGAL's ArrangementTraits_2 concept.
*/
template < class CurveKernel_2, class CKvA_ = void>
class Curved_kernel_via_analysis_2 :
public CGALi::Curved_kernel_via_analysis_2_base <
CKvA_, CurveKernel_2 >
{
public:
//! type of curve kernel
typedef CurveKernel_2 Curve_kernel_2;
//! this instance itself
typedef Curved_kernel_via_analysis_2< Curve_kernel_2, CKvA_> Self;
//! allows to rebind CKvA_2 wrt to NewCKvA
template < class NewCKvA_2 >
struct rebind {
//! the rebound type
typedef Curved_kernel_via_analysis_2< Curve_kernel_2, NewCKvA_2 >
Other;
};
protected:
//!\name Protected base types
//!@{
//! class collecting basic types
typedef CGALi::Curved_kernel_via_analysis_2_base < CKvA_, Curve_kernel_2 >
Base_kernel;
//!@}
public:
//! \name Constructors
//!@{
/*!\brief
* default constructor
*/
Curved_kernel_via_analysis_2() :
Base_kernel() {
}
/*!\brief
* construct from \c kernel
*
* \param kernel Kernel to use internally
*/
Curved_kernel_via_analysis_2(const Curve_kernel_2& kernel) :
Base_kernel(kernel) {
}
//!@}
}; // class Curved_kernel_via_analysis_2
template <class CurveKernel_2>
class Curved_kernel_via_analysis_2<CurveKernel_2, void> :
class Curved_kernel_via_analysis_2 :
public CGALi::Curved_kernel_via_analysis_2_base<
Curved_kernel_via_analysis_2<CurveKernel_2, void>, CurveKernel_2 > {
Curved_kernel_via_analysis_2<CurveKernel_2>,
void, CurveKernel_2 >
{
public:
//! type of curve kernel
typedef CurveKernel_2 Curve_kernel_2;
//! this instance itself
typedef Curved_kernel_via_analysis_2< Curve_kernel_2, void> Self;
typedef Curved_kernel_via_analysis_2< Curve_kernel_2 > Self;
//!\name Rebind
//!@{
//! allows to rebind CKvA_2 wrt to NewCKvA
template < class NewCKvA_2 >
//! redefine rebind to terminate unrolling nested templates
template <class X>
struct rebind {
//! the rebound type
typedef Curved_kernel_via_analysis_2< Curve_kernel_2, NewCKvA_2 >
Other;
typedef CGALi::Curved_kernel_via_analysis_2_functors< X >
Functor_base;
};
//!@}
public:
//!\name Embedded types to fulfill \c ArrangementTraits_2 concept
//!@{
@@ -356,8 +261,8 @@ protected:
//!@{
//! class collecting basic types
typedef CGALi::Curved_kernel_via_analysis_2_base < Self, CurveKernel_2 >
Base_kernel;
typedef CGALi::Curved_kernel_via_analysis_2_base < Self, void,
CurveKernel_2 > Base_kernel;
//!@}
public:
@@ -633,9 +633,9 @@ public:
//!@}
#define CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(X, Y, Z) \
#define CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(X, Y) \
typename Curved_kernel_via_analysis_2::X Y = \
Curved_kernel_via_analysis_2::instance().Z(); \
Curved_kernel_via_analysis_2::instance().Y##_object(); \
public:
@@ -862,7 +862,7 @@ public:
//!@}
private:
public:
//! \name Shortcuts for code readability
//!@{
@@ -923,8 +923,7 @@ public:
) const {
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_near_boundary_2,
compare_x_near_boundary_2,
compare_x_near_boundary_2_object);
compare_x_near_boundary_2);
CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this));
return compare_x_near_boundary_2(
p, *dynamic_cast< const Kernel_arc_2* >(this), ce
@@ -979,8 +978,7 @@ public:
const Kernel_arc_2& cv2, CGAL::Arr_curve_end ce2) const {
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_near_boundary_2,
compare_x_near_boundary_2,
compare_x_near_boundary_2_object);
compare_x_near_boundary_2);
CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this));
return compare_x_near_boundary_2(
*dynamic_cast< const Kernel_arc_2* >(this), ce1, cv2, ce2
@@ -1007,8 +1005,7 @@ public:
) const {
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_y_near_boundary_2,
compare_y_near_boundary_2,
compare_y_near_boundary_2_object);
compare_y_near_boundary_2);
CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this));
return compare_y_near_boundary_2(
*dynamic_cast< const Kernel_arc_2* >(this), cv2, ce
@@ -1044,8 +1041,7 @@ public:
CGAL::Comparison_result compare_y_at_x(const Point_2& p) const {
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_y_at_x_2,
compare_y_at_x_2,
compare_y_at_x_2_object);
compare_y_at_x_2);
CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this));
return compare_y_at_x_2(p, *dynamic_cast< const Kernel_arc_2* >(this));
}
@@ -1071,8 +1067,7 @@ public:
const Point_2 &p) const {
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_y_at_x_left_2,
compare_y_at_x_left_2,
compare_y_at_x_left_2_object);
compare_y_at_x_left_2);
CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this));
return compare_y_at_x_left_2(
*dynamic_cast< const Kernel_arc_2* >(this), cv2, p
@@ -1099,8 +1094,7 @@ public:
const Point_2 &p) const {
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_y_at_x_right_2,
compare_y_at_x_right_2,
compare_y_at_x_right_2_object);
compare_y_at_x_right_2);
CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this));
return compare_y_at_x_right_2(
*dynamic_cast< const Kernel_arc_2* >(this), cv2, p
@@ -1200,8 +1194,7 @@ public:
bool is_equal(const Kernel_arc_2& cv2) const {
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Equal_2,
equal_2,
equal_2_object);
equal_2);
CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this));
return equal_2(*dynamic_cast< const Kernel_arc_2* >(this), cv2);
@@ -1217,8 +1210,7 @@ public:
bool do_overlap(const Kernel_arc_2& cv2) const {
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Do_overlap_2,
do_overlap_2,
do_overlap_2_object);
do_overlap_2);
CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this));
return do_overlap_2(*dynamic_cast< const Kernel_arc_2* >(this), cv2);
}
@@ -1299,8 +1291,7 @@ public:
OutputIterator oi) const {
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Intersect_2,
intersect_2,
intersect_2_object);
intersect_2);
CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this));
return intersect_2(
@@ -1403,7 +1394,8 @@ public:
// do we need this method separetely ??
Kernel_arc_2 trim(const Point_2& p, const Point_2& q) const {
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Trim_2, trim_2, trim_2_object);
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Trim_2, trim_2);
CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this));
return trim_2(*dynamic_cast< const Kernel_arc_2* >(this), p, q);
}
@@ -1420,8 +1412,7 @@ public:
void split(const Point_2& p, Kernel_arc_2& s1, Kernel_arc_2& s2) const {
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Split_2,
split_2,
split_2_object);
split_2);
CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this));
split_2(*dynamic_cast< const Kernel_arc_2* >(this), p, s1, s2);
}
@@ -1436,8 +1427,7 @@ public:
bool are_mergeable(const Kernel_arc_2& cv2) const {
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Are_mergeable_2,
are_mergeable_2,
are_mergeable_2_object);
are_mergeable_2);
CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this));
return are_mergeable_2(
*dynamic_cast< const Kernel_arc_2* >(this), cv2
@@ -1455,7 +1445,7 @@ public:
*/
Kernel_arc_2 merge(const Kernel_arc_2& cv2) const {
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Merge_2, merge_2, merge_2_object);
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Merge_2, merge_2);
Kernel_arc_2 tmp;
CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this));
merge_2(*dynamic_cast< const Kernel_arc_2* >(this), cv2, tmp);
@@ -1463,9 +1453,6 @@ public:
}
//!@}
#undef CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC
//!\name Simplification
//!@{
@@ -1566,41 +1553,31 @@ protected:
if (p.location() == CGAL::ARR_INTERIOR &&
q.location() == CGAL::ARR_INTERIOR) {
Kernel_arc_2 new_arc= this->_replace_endpoints(
p, q,
(this->is_vertical() ? -1 : this->arcno(p.x())),
(this->is_vertical() ? -1 : this->arcno(q.x()))
).first;
return new_arc;
} else {
return _replace_endpoints(p, q,
(is_vertical() ? -1 : arcno(p.x())),
(is_vertical() ? -1 : arcno(q.x()))).first;
}
if (p.location() != CGAL::ARR_INTERIOR &&
q.location() != CGAL::ARR_INTERIOR) {
return *this;
}
if (p.location() != CGAL::ARR_INTERIOR &&
q.location() == CGAL::ARR_INTERIOR) {
if (p.location() != CGAL::ARR_INTERIOR &&
q.location() != CGAL::ARR_INTERIOR)
return static_cast<const Kernel_arc_2&>(*this);
Kernel_arc_2 left_arc, right_arc;
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Split_2, split_2);
if (p.location() != CGAL::ARR_INTERIOR &&
q.location() == CGAL::ARR_INTERIOR) {
Kernel_arc_2 left_arc, right_arc;
// TODO really use instance?
Curved_kernel_via_analysis_2::instance().
split_2_object()(*this,q,left_arc,right_arc);
return left_arc;
}
if (p.location() == CGAL::ARR_INTERIOR &&
q.location() != CGAL::ARR_INTERIOR) {
Kernel_arc_2 left_arc, right_arc;
// TODO really use instance?
Curved_kernel_via_analysis_2::instance().
split_2_object()(*this,p,left_arc,right_arc);
return right_arc;
}
split_2(static_cast<const Kernel_arc_2&>(*this), q, left_arc,
right_arc);
return left_arc;
}
CGAL_error_msg("Never reached");
return *this;
// if (p.location() == CGAL::ARR_INTERIOR &&
// q.location() != CGAL::ARR_INTERIOR)
split_2(static_cast<const Kernel_arc_2&>(*this), p, left_arc,
right_arc);
return right_arc;
}
public:
@@ -1619,7 +1596,9 @@ public:
bool trim_by_arc(const Kernel_arc_2& cv2, Kernel_arc_2& trimmed1,
Kernel_arc_2& trimmed2) const {
const Kernel_arc_2& cv1 = *this;
CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this));
const Kernel_arc_2& cv1 = static_cast< const Kernel_arc_2& >(*this);
Point_2 common_left, common_right;
@@ -1629,14 +1608,13 @@ public:
return false;
}
typename Curve_kernel_2::Compare_x_2 compare_x;
typename Curved_kernel_via_analysis_2_Functors
::Construct_point_on_arc_2<Curved_kernel_via_analysis_2>
construct_point_on_arc =
Curved_kernel_via_analysis_2::instance().
construct_point_on_arc_2_object();
typename Curve_kernel_2::Compare_x_2 compare_x(
Curved_kernel_via_analysis_2::instance().
kernel().compare_x_2_object());
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Construct_point_on_arc_2,
construct_point_on_arc_2);
Point_2 left1, left2;
if (common_left.location() != CGAL::ARR_LEFT_BOUNDARY) {
@@ -1646,7 +1624,7 @@ public:
common_left.x()) == CGAL::EQUAL) ) {
left1 = cv1._minpoint();
} else {
left1 = construct_point_on_arc(common_left.x(),
left1 = construct_point_on_arc_2(common_left.x(),
cv1.curve(),
cv1.arcno(),
cv1);
@@ -1657,7 +1635,7 @@ public:
common_left.x()) == CGAL::EQUAL) ) {
left2 = cv2._minpoint();
} else {
left2 = construct_point_on_arc(common_left.x(),
left2 = construct_point_on_arc_2(common_left.x(),
cv2.curve(),
cv2.arcno(),
cv2);
@@ -1678,7 +1656,7 @@ public:
common_right.x()) == CGAL::EQUAL) ) {
right1 = cv1._maxpoint();
} else {
right1 = construct_point_on_arc(common_right.x(),
right1 = construct_point_on_arc_2(common_right.x(),
cv1.curve(),
cv1.arcno(),
cv1);
@@ -1689,7 +1667,7 @@ public:
common_right.x()) == CGAL::EQUAL) ) {
right2 = cv2._maxpoint();
} else {
right2 = construct_point_on_arc(common_right.x(),
right2 = construct_point_on_arc_2(common_right.x(),
cv2.curve(),
cv2.arcno(),
cv2);
@@ -1704,7 +1682,7 @@ public:
trimmed2 = cv2._trim(left2, right2);
return joint;
}
}
//!@}
@@ -2756,6 +2734,8 @@ protected:
construct_point_on_arc =
Curved_kernel_via_analysis_2::instance().
construct_point_on_arc_2_object();
Point_2 xy = construct_point_on_arc(
x, nonvert.curve(), nonvert.arcno(x), nonvert
);
@@ -2861,6 +2841,7 @@ protected:
return oi;
}
#undef CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC
//!@}
public:
@@ -2910,8 +2891,11 @@ public:
#define CGAL_BEFRIEND_CKvA_2_FUNCTOR(Z) \
friend class Curved_kernel_via_analysis_2::Z; \
friend class Curved_kernel_via_analysis_2_Functors:: \
Z< Curved_kernel_via_analysis_2 >; \
Z<Curved_kernel_via_analysis_2>;
//Curved_kernel_via_analysis_2_functors<
// Curved_kernel_via_analysis_2> >;
CGAL_BEFRIEND_CKvA_2_FUNCTOR(Construct_arc_2);
CGAL_BEFRIEND_CKvA_2_FUNCTOR(Is_vertical_2);
CGAL_BEFRIEND_CKvA_2_FUNCTOR(Is_bounded_2);
@@ -35,18 +35,14 @@ namespace CGALi {
* for each \c Status_line_1 object stores the precomputed mapping
* from interval arcnos (on left and right sides) to event arcnos
*/
template <class CurvedKernelViaAnalysis_2>
template <class CurveKernel_2>
struct Curve_interval_arcno_cache {
//!\name Public types
//!@{
//! this instance's first template parameter
typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
//! type of curve kernel
typedef typename Curved_kernel_via_analysis_2::Curve_kernel_2
Curve_kernel_2;
typedef CurveKernel_2 Curve_kernel_2;
//! type of curve analysis
typedef typename Curve_kernel_2::Curve_analysis_2 Curve_analysis_2;
@@ -83,13 +79,9 @@ struct Curve_interval_arcno_cache {
/*!\brief
* Standard constructor
*
* \param kernel The kernel that is used internally
*/
Curve_interval_arcno_cache(Curved_kernel_via_analysis_2 *kernel) :
_m_curved_kernel_2(kernel), _m_last_curve_id(-1) {
CGAL_assertion(kernel != NULL);
Curve_interval_arcno_cache() :
_m_last_curve_id(-1) {
}
//!@}
@@ -207,9 +199,6 @@ private:
//!\name Private members
//!@{
//! pointer to \c Curved_kernel_via_analysis_2
Curved_kernel_via_analysis_2 *_m_curved_kernel_2;
//! a pair of vectors (right and left side of event-line respectively)
typedef std::pair<std::vector<Arcno_desc>, std::vector<Arcno_desc> >
Arcno_vector_pair;
@@ -27,7 +27,7 @@ CGAL_BEGIN_NAMESPACE
namespace CGALi {
#ifndef CERR
//#define CKvA_DEBUG_PRINT_CERR
#define CKvA_DEBUG_PRINT_CERR
#ifdef CKvA_DEBUG_PRINT_CERR
#define CERR(x) std::cerr << x
#else
@@ -53,10 +53,7 @@ public:
//! this instance's template parameter
typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
//! the curve type
typedef typename Curved_kernel_via_analysis_2::Curve_2 Curve_2;
//! the point type
//! the point type
typedef typename Curved_kernel_via_analysis_2::Point_2 Point_2;
//! the arc type
@@ -115,17 +112,12 @@ protected:
//!@}
};
#define CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES \
typedef typename Base::Curve_2 Curve_2; \
typedef typename Base::Point_2 Point_2; \
typedef typename Base::Arc_2 Arc_2; \
typedef typename Base::Curve_analysis_2 Curve_analysis_2; \
typedef typename Base::X_coordinate_1 X_coordinate_1; \
// end define
/*!\brief
* Functor to construct a point on a curve
*/
@@ -157,7 +149,7 @@ public:
}
/*!\brief
* Constructs a interior point
* Constructs an interior point
*
* \param x x-coordinate
* \param c The supporting curve
@@ -212,18 +204,18 @@ public:
* \param arc Can be used to query meta data
* \return The constructed point
*/
Point_2 operator()(
const X_coordinate_1& x,
const Curve_analysis_2& c, int arcno,
const Arc_2& arc) {
CGAL_assertion(c.id() == arc.curve().id());
CGAL_assertion(arcno == arc.arcno(x));
Point_2 operator()(const X_coordinate_1& x,
const Curve_analysis_2& c, int arcno, const Arc_2& arc) {
typename Curved_kernel_via_analysis_2::Construct_point_2
construct_point = Curved_kernel_via_analysis_2::instance().
construct_point_2_object();
Point_2 pt = construct_point(x, c, arcno);
CGAL::set_pretty_mode(std::cerr);
CERR("point: " << CGAL::to_double(x) << ", " << arcno << ", " <<
c.id() <<
"\narc = " << arc << "\n");
CGAL_assertion(c.id() == arc.curve().id());
//CGAL_assertion(arcno == arc.arcno(x));
Point_2 pt = Base::_ckva()->construct_point_2_object()(x, c, arcno);
// here we can modify the point, if we want to
return pt;
@@ -575,7 +567,6 @@ public:
}
};
// Functor computing parameter space in y for arc
template < class CurvedKernelViaAnalysis_2 >
class Parameter_space_in_y_2 : public
Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > {
@@ -726,7 +717,7 @@ public:
/*!\brief
* Functor that compares x-coordinates of two interior points
*/
template <class CurvedKernelViaAnalysis_2>
template < class CurvedKernelViaAnalysis_2 >
class Compare_x_2 : public
Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > {
@@ -832,7 +823,7 @@ public:
/*!\brief
* Functor that compares x-coordinates near the top or bottom boundary
*/
template <class CurvedKernelViaAnalysis_2>
template < class CurvedKernelViaAnalysis_2 >
class Compare_x_near_boundary_2 : public
Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > {
@@ -1150,25 +1141,24 @@ public:
cv.is_in_x_range(p.x(), &eq_min, &eq_max);
CGAL_assertion(in_x_range);
typename Base::Curve_kernel_2::Compare_xy_2 cmp_xy(
Base::_ckva()->kernel().compare_xy_2_object());
if (cv.is_vertical()) {
if (cv.is_finite(CGAL::ARR_MIN_END)) {
// for vertical arcs we can ask for .xy() member
if (Curved_kernel_via_analysis_2::instance().kernel().
compare_xy_2_object()(
p.xy(), cv._minpoint().xy(), true
) == CGAL::SMALLER) {
if (cmp_xy(p.xy(), cv._minpoint().xy(), true) ==
CGAL::SMALLER) {
CERR("cmp result: " << CGAL::SMALLER << "\n");
return CGAL::SMALLER;
}
}
if (cv.is_finite(CGAL::ARR_MAX_END)) {
if (Curved_kernel_via_analysis_2::instance().kernel().
compare_xy_2_object()(
p.xy(), cv._maxpoint().xy(), true
) == CGAL::LARGER) {
if (cmp_xy(p.xy(), cv._maxpoint().xy(), true) ==
CGAL::LARGER) {
CERR("cmp result: " << CGAL::LARGER << "\n");
return CGAL::LARGER;
}
@@ -1178,25 +1168,17 @@ public:
}
CGAL::Comparison_result res;
if (eq_min) {
res = Curved_kernel_via_analysis_2::instance().kernel().
compare_xy_2_object()(
p.xy(), cv._minpoint().xy(), true
);
res = cmp_xy(p.xy(), cv._minpoint().xy(), true);
} else if (eq_max) {
res = Curved_kernel_via_analysis_2::instance().kernel().
compare_xy_2_object()(
p.xy(), cv._maxpoint().xy(), true
);
res = cmp_xy(p.xy(), cv._maxpoint().xy(), true);
} else {
Point_2 point_on_s
= Curved_kernel_via_analysis_2::instance().
construct_point_on_arc_2_object()
( p.x(),
cv.curve(),
cv.arcno(),
cv );
res = Curved_kernel_via_analysis_2::instance().kernel().
compare_xy_2_object()(p.xy(), point_on_s.xy(), true);
Point_2 point_on_s =
Base::_ckva()->construct_point_on_arc_2_object()
(p.x(), cv.curve(), cv.arcno(), cv );
res = cmp_xy(p.xy(), point_on_s.xy(), true);
}
CERR("cmp result: " << res << "\n");
return res;
@@ -1803,10 +1785,7 @@ public:
CGAL_precondition(p.location() == CGAL::ARR_INTERIOR);
CGAL_precondition(q.location() == CGAL::ARR_INTERIOR);
CGAL_precondition(
!Curved_kernel_via_analysis_2::instance().
equal_2_object()(p, q)
);
CGAL_precondition(!Base::_ckva()->equal_2_object()(p, q));
CGAL_precondition(cv.compare_y_at_x(p) == CGAL::EQUAL);
CGAL_precondition(cv.compare_y_at_x(q) == CGAL::EQUAL);
@@ -1957,13 +1936,12 @@ public:
CGAL_precondition(cv1.is_interior(common.location()));
// check that there are no other non-vertical branches coming
// through this point
typedef typename
Curved_kernel_via_analysis_2::Curve_kernel_2::Curve_analysis_2
Curve_analysis_2;
Curve_analysis_2 ca_2(cv1.curve());
typename Curve_analysis_2::Status_line_1 cv_line =
ca_2.status_line_for_x(common.x());
CGAL_assertion(cv_line.is_event()); // ??
// we are not allowed to use number_of_incident_branches()
// since the common point might be supported by different curve,
// and therefore its arcno might be not valid for *this arc
@@ -2130,7 +2108,7 @@ public:
/*!\brief
* Functor that decomposes curve into x-monotone arcs and isolated points
*/
template < class CurvedKernelViaAnalysis_2>
template < class CurvedKernelViaAnalysis_2 >
class Make_x_monotone_2 : public
Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > {
@@ -2189,10 +2167,11 @@ public:
* \return The past-the-end iterator
*/
template < class OutputIterator >
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const {
OutputIterator operator()(const Curve_analysis_2& cv, OutputIterator oi)
const {
CGAL::CGALi::Make_x_monotone_2< Curved_kernel_via_analysis_2 >
make_x_monotone(&Curved_kernel_via_analysis_2::instance());
make_x_monotone(Base::_ckva());
return make_x_monotone(cv, oi);
}
@@ -2218,7 +2197,7 @@ public:
oi = (*this)(curve, oi);
else if(CGAL::assign(nxarc, obj))
oi = std::transform(nxarc.begin(), nxarc.end(), oi,
std::ptr_fun(CGAL::make_object<Non_x_monotone_arc_2>));
std::ptr_fun(CGAL::make_object<Arc_2>));
else // allow the remaining objects to pass through
*oi++ = obj;
return oi;
@@ -2228,7 +2207,7 @@ public:
/*!\brief
* Functor that computes the x-extreme points of a curve
*/
template < class CurvedKernelViaAnalysis_2>
template < class CurvedKernelViaAnalysis_2 >
class X_extreme_points_2 : public
Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > {
@@ -2242,9 +2221,12 @@ public:
Base;
CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES;
typedef typename Curve_analysis_2::Xy_coordinate_2 Xy_coordinate_2;
//! the result type
typedef std::iterator< std::output_iterator_tag, Point_2 > result_type;
typedef std::iterator< std::output_iterator_tag, Xy_coordinate_2 >
result_type;
//! the arity of the functor
typedef Arity_tag<2> Arity;
@@ -2276,24 +2258,13 @@ public:
for( int j = 0; j < lifts; j++ ) {
std::pair<int,int> incident_arcs
= status_line.number_of_incident_branches(j);
if ( ( incident_arcs.first == 0 ) ||
(incident_arcs.second == 0) ) {
typename Point_2::Xy_coordinate_2 xy
= status_line.algebraic_real_2(j);
Point_2 p = Base::_ckva()->construct_point_2_object()
(xy.x(),xy.curve(),xy.arcno());
oi++ = p;
}
std::pair<int, int> arcs =
status_line.number_of_incident_branches(j);
if (arcs.first == 0 || arcs.second == 0)
*oi++ = status_line.algebraic_real_2(j);
}
}
return oi;
}
@@ -2302,7 +2273,7 @@ public:
/*!\brief
* Functor that computes the y-extreme points of a curve
*/
template < class CurvedKernelViaAnalysis_2>
template < class CurvedKernelViaAnalysis_2 >
class Y_extreme_points_2 : public
Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > {
@@ -2316,9 +2287,12 @@ public:
Base;
CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES;
typedef typename Curve_analysis_2::Xy_coordinate_2 Xy_coordinate_2;
//! the result type
typedef std::iterator< std::output_iterator_tag, Point_2 > result_type;
typedef std::iterator< std::output_iterator_tag, Xy_coordinate_2 >
result_type;
//! the arity of the functor
typedef Arity_tag<2> Arity;
@@ -2340,61 +2314,54 @@ public:
typedef typename Curve_analysis_2::Status_line_1 Status_line_1;
std::vector<Point_2> y_critical_points;
typename Base::Curve_kernel_2 curve_kernel = Base::_ckva()->kernel();
Curve_analysis_2 ca_yx
= curve_kernel.swap_x_and_y_2_object() (ca);
Base::_ckva()->x_extreme_points_2_object()
( ca_yx, std::back_inserter(y_critical_points) );
std::vector<Xy_coordinate_2> y_critical_points;
for( typename std::vector<Point_2>::iterator it
Base::_ckva()->x_extreme_points_2_object()(ca_yx,
std::back_inserter(y_critical_points));
for( typename std::vector<Xy_coordinate_2>::iterator it
= y_critical_points.begin();
it != y_critical_points.end();
it++ ) {
X_coordinate_1 curr_x
= curve_kernel.get_y_2_object() ( it->xy() );
X_coordinate_1 curr_x = curve_kernel.get_y_2_object()( *it );
Status_line_1 status_line = ca.status_line_at_exact_x(curr_x);
int lifts = status_line.number_of_events();
for( int i = 0; i < lifts; i++ ) {
typename Point_2::Xy_coordinate_2 lift_xy
= status_line.algebraic_real_2(i);
Xy_coordinate_2 lift_xy = status_line.algebraic_real_2(i);
bool y_coordinate_found;
while(true) {
if( curve_kernel.upper_boundary_y_2_object() (lift_xy) <
curve_kernel.lower_boundary_x_2_object() (it->xy()) ) {
curve_kernel.lower_boundary_x_2_object() (*it) ) {
y_coordinate_found = false;
break;
}
if( curve_kernel.upper_boundary_y_2_object() (lift_xy) >=
curve_kernel.upper_boundary_x_2_object() (it->xy()) ) {
curve_kernel.upper_boundary_x_2_object() (*it) ) {
y_coordinate_found = true;
break;
}
curve_kernel.refine_x_2_object() (it->xy());
curve_kernel.refine_x_2_object() (*it);
}
if(y_coordinate_found) {
int arcno = i;
*oi++ = Base::_ckva()->construct_point_2_object()
(curr_x, ca, arcno);
*oi++ = Xy_coordinate_2(curr_x, ca, i);
break;
}
}
}
return oi;
}
@@ -2406,9 +2373,9 @@ public:
} // namespace Curved_kernel_via_analysis_2_Functors
/*!\brief
* Collects main set of functors of a curved kernel
* Collects the main set of functors of a curved kernel
*/
template < class CurvedKernelViaAnalysis_2 >
template < class CurvedKernelViaAnalysis_2, class Dummy = void>
class Curved_kernel_via_analysis_2_functors {
public:
@@ -2418,16 +2385,15 @@ public:
//! this instance's first template parameter
typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
// declares curved kernel functors,
// for each functor defines a member function
// typedef Curved_kernel_via_analysis_2_functors<
// CurvedKernelViaAnalysis_2 > Functor_base;
// declares curved kernel functors, for each functor defines a member function
// returning an instance of this functor
#define CGAL_CKvA_2_functor_pred(Y, Z) \
/*!\brief functor */ \
typedef \
Curved_kernel_via_analysis_2_Functors::Y< Curved_kernel_via_analysis_2 > \
Y; \
/*!\brief returns instance of functor */ \
Curved_kernel_via_analysis_2_Functors::Y< Curved_kernel_via_analysis_2 \
> Y; \
Y Z() const { return Y(&Curved_kernel_via_analysis_2::instance()); }
#define CGAL_CKvA_2_functor_cons(Y, Z) CGAL_CKvA_2_functor_pred(Y, Z)
@@ -2467,6 +2433,15 @@ public:
CGAL_CKvA_2_functor_cons(Make_x_monotone_2, make_x_monotone_2_object);
CGAL_CKvA_2_functor_cons(X_extreme_points_2, x_extreme_points_2_object);
CGAL_CKvA_2_functor_cons(Y_extreme_points_2, y_extreme_points_2_object);
CGAL_CKvA_2_functor_cons(Construct_point_2,
construct_point_2_object);
CGAL_CKvA_2_functor_cons(Construct_point_on_arc_2,
construct_point_on_arc_2_object);
CGAL_CKvA_2_functor_cons(Construct_arc_2,
construct_arc_2_object);
#undef CGAL_CKvA_2_functor_pred
#undef CGAL_CKvA_2_functor_cons
@@ -450,9 +450,9 @@ public:
//!\name Predicates
//!@{
#define CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_POINT(X, Y, Z) \
#define CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_POINT(X, Y) \
typename Curved_kernel_via_analysis_2::X Y = \
Curved_kernel_via_analysis_2::instance().Z(); \
Curved_kernel_via_analysis_2::instance().Y##_object(); \
/*!\brief
* Compares x-coordinates of this point with \c q
@@ -468,9 +468,7 @@ public:
CGAL_precondition(this->ptr()->_m_xy);
CGAL_precondition(q.ptr()->_m_xy);
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_POINT(Compare_x_2,
compare_x_2,
compare_x_2_object);
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_POINT(Compare_x_2, compare_x_2);
CGAL_precondition(dynamic_cast< const Kernel_point_2* >(this));
return compare_x_2(*dynamic_cast< const Kernel_point_2* >(this), q);
}
@@ -492,9 +490,7 @@ public:
CGAL_precondition(this->ptr()->_m_xy);
CGAL_precondition(q.ptr()->_m_xy);
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_POINT(Compare_xy_2,
compare_xy_2,
compare_xy_2_object);
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_POINT(Compare_xy_2, compare_xy_2);
CGAL_precondition(dynamic_cast< const Kernel_point_2* >(this));
return compare_xy_2(
*dynamic_cast< const Kernel_point_2* >(this), q, equal_x
@@ -513,9 +509,7 @@ public:
) const {
CGAL_precondition(this->ptr()->_m_xy);
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_POINT(Is_on_2,
is_on_2,
is_on_2_object);
CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_POINT(Is_on_2, is_on_2);
CGAL_precondition(dynamic_cast< const Kernel_point_2* >(this));
return is_on_2(*dynamic_cast< const Kernel_point_2* >(this), curve);
}
@@ -673,9 +667,9 @@ public:
// befriending the functors
#define CGAL_BEFRIEND_CKvA_2_FUNCTOR(Z) \
friend class Curved_kernel_via_analysis_2::Z; \
friend class Curved_kernel_via_analysis_2::Z; \
friend class Curved_kernel_via_analysis_2_Functors:: \
Z< Curved_kernel_via_analysis_2 >; \
Z< Curved_kernel_via_analysis_2 >;
CGAL_BEFRIEND_CKvA_2_FUNCTOR(Construct_point_2);
CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_x_2);
@@ -28,25 +28,93 @@
#include <CGAL/Curved_kernel_via_analysis_2l/Surface_arc_2l.h>
#include <CGAL/Curved_kernel_via_analysis_2l/Curved_kernel_via_analysis_2l_functors.h>
CGAL_BEGIN_NAMESPACE
namespace CGALi {
template <class CKvA2l, class BaseCKvA>
struct CKvA2l_functor_base :
public BaseCKvA::template rebind< CKvA2l >::Functor_base {
typedef CKvA2l Self;
typedef typename BaseCKvA::template rebind< Self >::Functor_base
Functor_base;
//! type of Construct_point_2 functor
typedef
CGALi::Curved_kernel_via_analysis_2l_Functors::Construct_point_2l< Self >
Construct_point_2;
//! returns an instance of Construct_point_2 functor
Construct_point_2 construct_point_2_object() const {
return Construct_point_2(&Self::instance());
}
//! type of Construct_projected_point_2 functor
typedef typename BaseCKvA::Construct_point_2
Construct_projected_point_2;
//! returns an instance of Construct_projected_point_2 functor
Construct_projected_point_2 construct_projected_point_2_object() const {
return BaseCKvA::instance().construct_point_2_object();
}
//! type of Construct_arc_2 functor
typedef
CGALi::Curved_kernel_via_analysis_2l_Functors::Construct_arc_2l< Self >
Construct_arc_2;
//! returns an instance of Construct_arc_2 functor
Construct_arc_2 construct_arc_2_object() const {
return Construct_arc_2(&Self::instance());
}
//! type of Construct_projected_arc_2 functor
typedef typename BaseCKvA::Construct_arc_2
Construct_projected_arc_2;
//! returns an instance of Construct_projected_arc_2 functor
Construct_projected_arc_2 construct_projected_arc_2_object() const {
return BaseCKvA::instance().construct_arc_2_object();
}
// declares curved kernel functors,
// for each functor defines a member function
// returning an instance of this functor
#define CGAL_CKvA_2l_functor_pred(Y, Z) \
typedef CGALi::Curved_kernel_via_analysis_2l_Functors::Y< Self > Y; \
Y Z() const { return Y(&Self::instance()); }
#define CGAL_CKvA_2l_functor_cons(Y, Z) CGAL_CKvA_2l_functor_pred(Y, Z)
public:
CGAL_CKvA_2l_functor_pred(Compare_xyz_3, compare_xyz_3_object);
CGAL_CKvA_2l_functor_pred(Is_on_2, is_on_2_object);
CGAL_CKvA_2l_functor_pred(Is_on_3, is_on_3_object);
#undef CGAL_CKvA_2l_functor_pred
#undef CGAL_CKvA_2l_functor_cons
};
} // namespace CGALi
//! basic kernel to maintain points and arcs on a surface
template < class CurvedKernelViaAnalysis_2, class SurfacePair_3 >
template < class BaseCKvA_2, class SurfacePair_3 >
class Curved_kernel_via_analysis_2l :
public CurvedKernelViaAnalysis_2::
template rebind<
Curved_kernel_via_analysis_2l<
CurvedKernelViaAnalysis_2, SurfacePair_3
>
>::Other
public CGALi::Curved_kernel_via_analysis_2_base<
Curved_kernel_via_analysis_2l< BaseCKvA_2, SurfacePair_3 >,
BaseCKvA_2, typename BaseCKvA_2::Curve_kernel_2,
CGALi::CKvA2l_functor_base >
{
public:
//! \name public typedefs
//!@{
//! this instance's first template argument
typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
typedef BaseCKvA_2 Curved_kernel_via_analysis_2;
//! this instance's second template parameter
typedef SurfacePair_3 Surface_pair_3;
@@ -86,15 +154,13 @@ public:
//!@}
public:
//!\name base type
//!@{
protected:
//! the base type
typedef typename Curved_kernel_via_analysis_2::
template rebind< Self >::Other Base;
//!@}
//! base kernel type
typedef CGALi::Curved_kernel_via_analysis_2_base<
Self, Curved_kernel_via_analysis_2, Curve_kernel_2,
CGALi::CKvA2l_functor_base >
Base_kernel;
public:
//! \name Constructors
@@ -102,78 +168,15 @@ public:
//! default constructor
Curved_kernel_via_analysis_2l() :
Base() {
Base_kernel() {
}
//! construct using specific \c Curve_kernel_2 instance (for controlling)
Curved_kernel_via_analysis_2l(const Curve_kernel_2& kernel) :
Base(kernel) {
Base_kernel(kernel) {
}
//!@}
//!\name embedded constructions and predicates
//!@{
//! type of Construct_point_2 functor
typedef
CGALi::Curved_kernel_via_analysis_2l_Functors::Construct_point_2l< Self >
Construct_point_2;
//! returns an instance of Construct_point_2 functor
Construct_point_2 construct_point_2_object() const {
return Construct_point_2(&Self::instance());
}
//! type of Construct_projected_point_2 functor
typedef typename Curved_kernel_via_analysis_2::Construct_point_2
Construct_projected_point_2;
//! returns an instance of Construct_projected_point_2 functor
Construct_projected_point_2 construct_projected_point_2_object() const {
return
Curved_kernel_via_analysis_2(this->kernel()).
construct_point_2_object();
}
//! type of Construct_arc_2 functor
typedef
CGALi::Curved_kernel_via_analysis_2l_Functors::Construct_arc_2l< Self >
Construct_arc_2;
//! returns an instance of Construct_arc_2 functor
Construct_arc_2 construct_arc_2_object() const {
return Construct_arc_2(&Self::instance());
}
//! type of Construct_projected_arc_2 functor
typedef typename Curved_kernel_via_analysis_2::Construct_arc_2
Construct_projected_arc_2;
//! returns an instance of Construct_projected_arc_2 functor
Construct_projected_arc_2 construct_projected_arc_2_object() const {
return
Curved_kernel_via_analysis_2(this->kernel()).
construct_arc_2_object();
}
// declares curved kernel functors,
// for each functor defines a member function
// returning an instance of this functor
#define CGAL_CKvA_2l_functor_pred(Y, Z) \
typedef CGALi::Curved_kernel_via_analysis_2l_Functors::Y< Self > Y; \
Y Z() const { return Y(&Self::instance()); }
#define CGAL_CKvA_2l_functor_cons(Y, Z) CGAL_CKvA_2l_functor_pred(Y, Z)
public:
CGAL_CKvA_2l_functor_pred(Compare_xyz_3, compare_xyz_3_object);
CGAL_CKvA_2l_functor_pred(Is_on_2, is_on_2_object);
CGAL_CKvA_2l_functor_pred(Is_on_3, is_on_3_object);
#undef CGAL_CKvA_2l_functor_pred
#undef CGAL_CKvA_2l_functor_cons
//!@}
}; // class Curved_kernel_via_analysis_2l
@@ -41,7 +41,7 @@ namespace CGALi {
namespace Curved_kernel_via_analysis_2l_Functors {
#define CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES \
typedef typename Base::Curve_2 Curve_2; \
typedef typename Base::Curve_analysis_2 Curve_analysis_2; \
typedef typename Base::Point_2 Point_2; \
typedef typename Base::Arc_2 Arc_2; \
typedef typename Base::X_coordinate_1 X_coordinate_1; \
@@ -577,7 +577,7 @@ public:
* \param c The curve
* \return (true) if the \c p lies on \c c
*/
result_type operator()(const Point_2& p, const Curve_2& c) const {
result_type operator()(const Point_2& p, const Curve_analysis_2& c) const {
CERR("\nqkvais_on_2: p: " << p << "\n curve: " << c << "\n");
// FUTURE TODO implement Is_on_2 with Curve_2 == Surface_3 (eriC)
@@ -32,10 +32,8 @@
CGAL_BEGIN_NAMESPACE
#ifndef CKvA_CERR
#ifndef CKvA_DEBUG_PRINT_CERR
#define CKvA_DEBUG_PRINT_CERR 0
#endif
#if CKvA_DEBUG_PRINT_CERR
//#define FCKvA_DEBUG_PRINT_CERR
#ifdef FCKvA_DEBUG_PRINT_CERR
#define CKvA_CERR(x) std::cout << x
#else
#define CKvA_CERR(x) static_cast<void>(0)
@@ -52,9 +50,9 @@ namespace Filtered_curved_kernel_via_analysis_2_Functors {
typedef typename Curved_kernel_via_analysis_2::Arc_2 Arc_2; \
template < class CurvedKernelViaAnalysis_2 >
template < class CurvedKernelViaAnalysis_2, class FunctorBase >
class Compare_xy_2 :
public CurvedKernelViaAnalysis_2::Base::Compare_xy_2 {
public FunctorBase::Compare_xy_2 {
public:
//! this instance template parameter
@@ -73,7 +71,7 @@ public:
#endif
//! the base type
typedef typename Curved_kernel_via_analysis_2::Base::Compare_xy_2 Base;
typedef typename FunctorBase::Compare_xy_2 Base;
//! the result type
typedef CGAL::Comparison_result result_type;
@@ -98,20 +96,14 @@ public:
CKvA_CERR("\nfilteredcompare_xy_; p1: " << p1 << "; p2: " <<
p2 << "\n");
Base base_compare_xy(this->_ckva());
result_type res = base_compare_xy(p1, p2, equal_x);
CKvA_CERR("result: " << res << "\n");
return res;
return Base::operator()(p1, p2, equal_x);
}
};
template < class CurvedKernelViaAnalysis_2 >
template < class CurvedKernelViaAnalysis_2, class FunctorBase >
class Compare_y_near_boundary_2 :
public CurvedKernelViaAnalysis_2::Base::Compare_y_near_boundary_2 {
public FunctorBase::Compare_y_near_boundary_2 {
public:
//! this instance template parameter
@@ -131,7 +123,7 @@ public:
#endif
//! the bae type
typedef typename CurvedKernelViaAnalysis_2::Base::Compare_y_near_boundary_2
typedef typename FunctorBase::Compare_y_near_boundary_2
Base;
//! the result type
@@ -161,7 +153,7 @@ public:
CGAL_assertion_code (
CGAL::Arr_parameter_space loc1 = cv1.location(ce);
)
CGAL_precondition(cv1.is_on_left_right(loc1) &&
CGAL_precondition(Arc_2::is_on_left_right(loc1) &&
loc1 == cv2.location(ce));
// comparing ids is the same as calling is_identical() ??
if (cv1.id() == cv2.id()) {
@@ -209,7 +201,7 @@ public:
CGAL_assertion_code(bool check = )
CGAL::assign(asym_info2, obj2);
CGAL_assertion(check);
filter_res = this->_ckva()->kernel().compare_x_2_object()(
filter_res = Base::_ckva()->kernel().compare_x_2_object()(
asym_info1, asym_info2
);
}
@@ -228,18 +220,13 @@ public:
return filter_res;
}
Base base_compare_y_near_boundary(this->_ckva());
result_type res = base_compare_y_near_boundary(cv1, cv2, ce);
CKvA_CERR("result: " << res << "\n");
return res;
return Base::operator()(cv1, cv2, ce);
}
};
template < class CurvedKernelViaAnalysis_2 >
template < class CurvedKernelViaAnalysis_2, class FunctorBase >
class Compare_y_at_x_2 :
public CurvedKernelViaAnalysis_2::Base::Compare_y_at_x_2 {
public FunctorBase::Compare_y_at_x_2 {
public:
//! this instance template parameter
@@ -259,7 +246,7 @@ public:
#endif
//! the bae type
typedef typename CurvedKernelViaAnalysis_2::Base::Compare_y_at_x_2 Base;
typedef typename FunctorBase::Compare_y_at_x_2 Base;
//! the result type
typedef CGAL::Comparison_result result_type;
@@ -281,21 +268,13 @@ public:
*/
result_type operator()(const Point_2& p, const Arc_2& cv) const {
CKvA_CERR("\nfilteredcompare_y_at_x; p: " << p
<< ";\n cv:" << cv << "\n");
Base base_compare_y_at_x(this->_ckva());
result_type res = base_compare_y_at_x(p, cv);
CKvA_CERR("result: " << res << "\n");
return res;
return Base::operator()(p, cv);
}
};
template < class CurvedKernelViaAnalysis_2 >
template < class CurvedKernelViaAnalysis_2, class FunctorBase >
class Compare_y_at_x_left_2 :
public CurvedKernelViaAnalysis_2::Base::Compare_y_at_x_left_2 {
public FunctorBase::Compare_y_at_x_left_2 {
public:
//! this instance template parameter
@@ -315,8 +294,7 @@ public:
#endif
//! the bae type
typedef typename
CurvedKernelViaAnalysis_2::Base::Compare_y_at_x_left_2 Base;
typedef typename FunctorBase::Compare_y_at_x_left_2 Base;
//! the result type
typedef CGAL::Comparison_result result_type;
@@ -343,22 +321,13 @@ public:
result_type operator() (const Arc_2& cv1, const Arc_2& cv2,
const Point_2& p) const {
CKvA_CERR("\ncompare_y_at_x_left(cv2); cv1: " << cv1 << "; cv2: " <<
cv2 << "; p: " << p << "\n");
Base base_compare_y_at_x_left(this->_ckva());
result_type res = base_compare_y_at_x_left(cv1, cv2, p);
CKvA_CERR("result: " << res << "\n");
return res;
return Base::operator()(cv1, cv2, p);
}
};
template < class CurvedKernelViaAnalysis_2 >
template < class CurvedKernelViaAnalysis_2, class FunctorBase >
class Compare_y_at_x_right_2 :
public CurvedKernelViaAnalysis_2::Base::Compare_y_at_x_right_2 {
public FunctorBase::Compare_y_at_x_right_2 {
public:
//! this instance template parameter
@@ -378,8 +347,7 @@ public:
#endif
//! the bae type
typedef typename
CurvedKernelViaAnalysis_2::Base::Compare_y_at_x_right_2 Base;
typedef typename FunctorBase::Compare_y_at_x_right_2 Base;
//! the result type
typedef CGAL::Comparison_result result_type;
@@ -409,25 +377,25 @@ public:
CKvA_CERR("\ncompare_y_at_x_right(cv2); cv1: " << cv1 << "; cv2: " <<
cv2 << "; p: " << p << "\n");
Base base_compare_y_at_x_right(this->_ckva());
result_type res = base_compare_y_at_x_right(cv1, cv2, p);
CKvA_CERR("result: " << res << "\n");
return res;
return Base::operator()(cv1, cv2, p);
}
};
//!\brief Tests two objects, whether two arcs can have an intersection
template < class CurvedKernelViaAnalysis_2 >
class May_have_intersection_2 {
template < class CurvedKernelViaAnalysis_2, class FunctorBase >
class May_have_intersection_2 :
public Curved_kernel_via_analysis_2_Functors::
Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > {
public:
//! this instance template parameter
typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
CGAL_FILTERED_CKvA_2_GRAB_BASE_FUNCTOR_TYPES;
typedef Curved_kernel_via_analysis_2_Functors::
Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 >
Base;
#if DOXYGEN_RUNNING
//! type of curve
typedef typename Curved_kernel_via_analysis_2::Curve_2 Curve_2;
@@ -470,16 +438,14 @@ public:
//! standard constructor
May_have_intersection_2(Curved_kernel_via_analysis_2 *kernel) :
_m_curved_kernel(kernel) {
CGAL_assertion(kernel != NULL);
Base(kernel) {
}
/*!\brief
* Checks whether \c cv1 and \c cv2 can have an intersection. If
* not it certainly returns false, if possible, it return true.
*/
template < class Arc_2_ >
bool operator()(const Arc_2_& cv1, const Arc_2_& cv2) const {
bool operator()(const Arc_2& cv1, const Arc_2& cv2) const {
Arc_2 trimmed_cv1, trimmed_cv2;
@@ -599,8 +565,8 @@ public:
*/
template < class OutputIterator >
OutputIterator construct_covering_approximation(
const Arc_2& arc, OutputIterator oi
) const {
const Arc_2& arc, OutputIterator oi) const {
CKvA_CERR("\nconstruct_covering_approximation; arc: " << arc
<< ";\n cv:" << arc << "\n");
@@ -641,46 +607,36 @@ public:
update_y(y_min,y_max,y_interval_for_arc_end(arc,CGAL::ARR_MAX_END));
typename Curved_kernel_via_analysis_2::Construct_point_on_arc_2
construct_pt_on_arc(Base::_ckva()->
construct_point_on_arc_2_object());
if(!arc.is_vertical()) {
std::vector<Xy_coordinate_2> pts;
#ifdef USE_X_CRITICAL_POINTS
#warning Uses X_critical points!
std::vector<Xy_coordinate_2> x_critical_points;
typename Curve_kernel_2::X_critical_points_2()
(arc.curve(), std::back_inserter(x_critical_points));
int n = static_cast<int>(x_critical_points.size());
for( int i = 0; i < n; i++ ) {
Xy_coordinate_2& curr_xy = x_critical_points[i];
Point_2 curr_point
= typename Curved_kernel_via_analysis_2
::Construct_point_2(_m_curved_kernel)
(curr_xy.x(),curr_xy.curve(), curr_xy.arcno());
(arc.curve(), std::back_inserter(pts));
#else
std::vector<Point_2> y_extreme_points;
_m_curved_kernel->y_extreme_points_2_object()
(arc.curve(), std::back_inserter(y_extreme_points));
int n = static_cast<int>(y_extreme_points.size());
for( int i = 0; i < n; i++ ) {
Point_2& curr_point = y_extreme_points[i];
Base::_ckva()->y_extreme_points_2_object()(arc.curve(),
std::back_inserter(pts));
#endif
if( typename Curved_kernel_via_analysis_2
::Is_on_2(_m_curved_kernel) (curr_point, arc) ) {
int n = static_cast<int>(pts.size());
for( int i = 0; i < n; i++ ) {
const Xy_coordinate_2& curr_xy = pts[i];
CERR("construct point on arc call: " <<
curr_xy << "; arc = " << arc << "\n\n");
Point_2 curr_point = construct_pt_on_arc
(curr_xy.x(), curr_xy.curve(), curr_xy.arcno(), arc);
CERR("is_on_2 call: " <<
curr_point << "; arc = " << arc << "\n\n");
if(Base::_ckva()->is_on_2_object()(curr_point, arc)) {
CGAL::Bbox_2 point_bbox
= curr_point.xy().approximation_box_2(threshold());
std::pair<double,double> y_iv
@@ -689,7 +645,6 @@ public:
}
}
}
CGAL::Bbox_2 bbox(x_min, y_min, x_max, y_max);
@@ -700,16 +655,13 @@ public:
return oi;
}
private:
//! pointer to \c Curved_kernel_via_analysis_2 ?
Curved_kernel_via_analysis_2 *_m_curved_kernel;
};
//! checks wether and how two arcs are intersection - with first filtering
template < class CurvedKernelViaAnalysis_2 >
template < class CurvedKernelViaAnalysis_2, class FunctorBase >
class Intersect_2 :
public CurvedKernelViaAnalysis_2::Base::Intersect_2 {
public FunctorBase::Intersect_2 {
public:
//! this instance template parameter
@@ -729,7 +681,7 @@ public:
#endif
//! the bae type
typedef typename CurvedKernelViaAnalysis_2::Base::Intersect_2 Base;
typedef typename FunctorBase::Intersect_2 Base;
//! standard constructor
Intersect_2(Curved_kernel_via_analysis_2 *kernel) :
@@ -754,39 +706,29 @@ public:
CKvA_CERR("\nfiltered_intersect; cv1: " << cv1
<< ";\n cv2:" << cv2 << "");
if (!this->_ckva()->may_have_intersection_2_object()(cv1, cv2)) {
if (!Base::_ckva()->may_have_intersection_2_object()(cv1, cv2)) {
// return no one
CKvA_CERR("\nfilter: sucessfull\n");
CGAL_assertion_code(
{
std::list< CGAL::Object > tmp;
Base base_intersection(this->_ckva());
base_intersection(cv1, cv2, std::back_inserter(tmp));
std::vector<CGAL::Object> tmp;
Base::operator()(cv1, cv2, std::back_inserter(tmp));
CGAL_assertion(tmp.empty());
});
return oi;
}
// else
CKvA_CERR("\nfilter: failed\n");
// and call usual intersection
std::list< CGAL::Object > tmp;
Base base_intersection(this->_ckva());
base_intersection(cv1, cv2, std::back_inserter(tmp));
for (std::list< CGAL::Object >::const_iterator it = tmp.begin();
it != tmp.end(); it++) {
*oi++ = *it;
}
return oi;
return Base::operator()(cv1, cv2, oi);
}
};
template < class CurvedKernelViaAnalysis_2 >
template < class CurvedKernelViaAnalysis_2, class FunctorBase >
class Is_on_2 :
public CurvedKernelViaAnalysis_2::Base::Is_on_2 {
public FunctorBase::Is_on_2 {
public:
//! this instance template parameter
@@ -806,7 +748,7 @@ public:
#endif
//! the bae type
typedef typename CurvedKernelViaAnalysis_2::Base::Is_on_2 Base;
typedef typename FunctorBase::Is_on_2 Base;
//! the result type
typedef bool result_type;
@@ -825,25 +767,14 @@ public:
*/
result_type operator()(const Point_2& p, const Curve_2& c) const {
//CKvA_CERR("\nfiltered_is_on; p: " << p << ";\n c:" << c << "");
Base base_is_on(this->_ckva());
result_type res = base_is_on(p, c);
CKvA_CERR("result: " << res << "\n");
return res;
CKvA_CERR("\nfiltered_is_on; p: " << p << ";\n c:" << c << "");
return Base::operator()(p, c);
}
result_type operator()(const Point_2& p, const Arc_2& c) const {
result_type operator()(const Point_2& p, const Arc_2& arc) const {
Base base_is_on(this->_ckva());
result_type res = base_is_on(p, c);
CKvA_CERR("result: " << res << "\n");
return res;
return Base::operator()(p, arc);
}
};
@@ -851,117 +782,23 @@ public:
} // namespace Filtered_curved_kernel_via_analysis_2_Functors
} // namespace CGALi
/*!\brief
* Filtered curved kernel, i.e., intersection predicate is filted by first
* computing a covering approximation. Only if these overlap for two arcs
* the exact intersection predicate is called.
*/
template < class CurvedKernelViaAnalysis_2 >
class Filtered_curved_kernel_via_analysis_2 :
public CurvedKernelViaAnalysis_2::
template rebind<
Filtered_curved_kernel_via_analysis_2< CurvedKernelViaAnalysis_2 >
>::Other
{
public:
//! \name public typedefs
//!@{
template <class FCKvA, class BaseCKvA>
struct Filtered_functor_base :
public BaseCKvA::template rebind< FCKvA >::Functor_base {
//! this instance's first template argument
typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
//! myself
typedef
Filtered_curved_kernel_via_analysis_2< Curved_kernel_via_analysis_2 > Self;
typedef FCKvA Self;
//! type of curve kernel
typedef typename
Curved_kernel_via_analysis_2::Curve_kernel_2 Curve_kernel_2;
typedef BaseCKvA Base_ckva;
//! type of curve analysis
typedef typename Curve_kernel_2::Curve_analysis_2 Curve_analysis_2;
public:
//!\name embedded types for \c Arrangement_2 package
//!@{
typedef typename BaseCKvA::template rebind< Self >::Functor_base
Functor_base;
//! type of curve_2
typedef Curve_analysis_2 Curve_2;
//! type of a point on generic curve
typedef CGALi::Point_2< Self > Point_2;
//! type of an arc on generic curve
typedef CGALi::Arc_2< Self > Arc_2;
//! type of weakly x-monotone arc for \c ArrangementTraits_2
typedef Arc_2 X_monotone_curve_2;
//!@}
public:
//!\name base type
//!@{
//! the base type
typedef typename Curved_kernel_via_analysis_2::
template rebind< Self >::Other Base;
//!@}
public:
//! \name Constructors
//!@{
//! default constructor
Filtered_curved_kernel_via_analysis_2() :
Base() {
}
//! construct using specific \c Curve_kernel_2 instance (for controlling)
Filtered_curved_kernel_via_analysis_2(const Curve_kernel_2& kernel) :
Base(kernel) {
}
//!@}
//!\name Additional functors
//!@{
// declares curved kernel functors, for each functor defines a member function
// returning an instance of this functor
#define CGAL_CKvA_2_functor_pred(Y, Z) \
typedef CGALi::Curved_kernel_via_analysis_2_Functors::Y<Self> Y; \
Y Z() const { return Y(&Self::instance()); }
#define CGAL_CKvA_2_functor_cons(Y, Z) CGAL_CKvA_2_functor_pred(Y, Z)
public:
CGAL_CKvA_2_functor_cons(Construct_point_2,
construct_point_2_object);
CGAL_CKvA_2_functor_cons(Construct_point_on_arc_2,
construct_point_on_arc_2_object);
CGAL_CKvA_2_functor_cons(Construct_arc_2,
construct_arc_2_object);
CGAL_CKvA_2_functor_cons(X_extreme_points_2,
x_extreme_points_2_object);
CGAL_CKvA_2_functor_cons(Y_extreme_points_2,
y_extreme_points_2_object);
#undef CGAL_CKvA_2_functor_pred
#undef CGAL_CKvA_2_functor_cons
// declares curved kernel functors, for each functor defines a member function
// returning an instance of this functor
#define CGAL_FILTERED_CKvA_2_functor_pred(Y, Z) \
typedef CGALi::Filtered_curved_kernel_via_analysis_2_Functors::Y<Self> Y; \
typedef CGALi::Filtered_curved_kernel_via_analysis_2_Functors:: \
Y< Self, Functor_base > Y; \
Y Z() const { return Y(&Self::instance()); }
#define CGAL_FILTERED_CKvA_2_functor_cons(Y, Z) \
@@ -990,10 +827,83 @@ public:
#undef CGAL_FILTERED_CKvA_2_functor_pred
#undef CGAL_FILTERED_CKvA_2_functor_cons
//!@}
};
} // namespace CGALi
/*!\brief
* Filtered curved kernel, i.e., intersection predicate is filted by first
* computing a covering approximation. Only if these overlap for two arcs
* the exact intersection predicate is called.
*/
template < class BaseCKvA_2 >
class Filtered_curved_kernel_via_analysis_2 :
public CGALi::Curved_kernel_via_analysis_2_base<
Filtered_curved_kernel_via_analysis_2< BaseCKvA_2 >,
BaseCKvA_2, typename BaseCKvA_2::Curve_kernel_2,
CGALi::Filtered_functor_base >
{
public:
//! \name public typedefs
//!@{
//! this instance's first template argument
typedef BaseCKvA_2 Curved_kernel_via_analysis_2;
}; // class Curved_kernel_via_analysis_2
//! myself
typedef Filtered_curved_kernel_via_analysis_2<
Curved_kernel_via_analysis_2 > Self;
//! type of curve kernel
typedef typename
Curved_kernel_via_analysis_2::Curve_kernel_2 Curve_kernel_2;
//! type of curve analysis
typedef typename Curve_kernel_2::Curve_analysis_2 Curve_analysis_2;
public:
//!\name embedded types for \c Arrangement_2 package
//!@{
//! type of curve_2
typedef Curve_analysis_2 Curve_2;
//! type of a point on generic curve
typedef CGALi::Point_2< Self > Point_2;
//! type of an arc on generic curve
typedef CGALi::Arc_2< Self > Arc_2;
//! type of weakly x-monotone arc for \c ArrangementTraits_2
typedef Arc_2 X_monotone_curve_2;
//!@}
protected:
//! base kernel type
typedef CGALi::Curved_kernel_via_analysis_2_base<
Self, Curved_kernel_via_analysis_2, Curve_kernel_2,
CGALi::Filtered_functor_base > Base_kernel;
public:
//! \name Constructors
//!@{
//! default constructor
Filtered_curved_kernel_via_analysis_2() :
Base_kernel() {
}
//! construct using specific \c Curve_kernel_2 instance (for controlling)
Filtered_curved_kernel_via_analysis_2(const Curve_kernel_2& kernel) :
Base_kernel(kernel) {
}
//!@}
}; // class Filtered_curved_kernel_via_analysis_2
CGAL_END_NAMESPACE
#endif // CGAL_CURVED_KERNEL_VIA_ANALYSIS_2_H
#endif // CGAL_FILTERED_CURVED_KERNEL_VIA_ANALYSIS_2_H
@@ -555,14 +555,16 @@ public:
template < class CurvedKernelViaAnalysis_2l >
class Compare_xy_2 :
public CurvedKernelViaAnalysis_2l::Base::Compare_xy_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Compare_xy_2 {
public:
//! this instance' first template parameter
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
//! the base type
typedef typename Curved_kernel_via_analysis_2l::Base::Compare_xy_2 Base;
typedef typename CurvedKernelViaAnalysis_2l::
Functor_base::Compare_xy_2 Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -609,14 +611,16 @@ public:
template < class CurvedKernelViaAnalysis_2l >
class Compare_x_near_boundary_2 :
public CurvedKernelViaAnalysis_2l::Base::Compare_x_near_boundary_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Compare_x_near_boundary_2 {
public:
//! this instance' first template parameter
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
//! the base type
typedef typename
Curved_kernel_via_analysis_2l::Base::Compare_x_near_boundary_2
CurvedKernelViaAnalysis_2l::
Functor_base::Compare_x_near_boundary_2
Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -725,14 +729,16 @@ public:
template < class CurvedKernelViaAnalysis_2l >
class Compare_y_near_boundary_2 :
public CurvedKernelViaAnalysis_2l::Base::Compare_y_near_boundary_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Compare_y_near_boundary_2 {
public:
//! this instance' first template parameter
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
//! the base type
typedef typename
Curved_kernel_via_analysis_2l::Base::Compare_y_near_boundary_2
CurvedKernelViaAnalysis_2l::
Functor_base::Compare_y_near_boundary_2
Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -778,9 +784,9 @@ public:
int sheet2 = cv2.sheet();
Base base_compare_y_near_boundary(this->_ckva());
typename Curved_kernel_via_analysis_2l::Base::Compare_y_at_x_right_2
typename Curved_kernel_via_analysis_2l::Functor_base::Compare_y_at_x_right_2
base_compare_y_at_x_right(this->_ckva());
typename Curved_kernel_via_analysis_2l::Base::Compare_y_at_x_left_2
typename Curved_kernel_via_analysis_2l::Functor_base::Compare_y_at_x_left_2
base_compare_y_at_x_left(this->_ckva());
if (sheet1 != sheet2) {
@@ -817,7 +823,8 @@ public:
template < class CurvedKernelViaAnalysis_2l >
class Compare_y_at_x_2 :
public CurvedKernelViaAnalysis_2l::Base::Compare_y_at_x_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Compare_y_at_x_2 {
public:
//! this instance' first template parameter
@@ -825,7 +832,8 @@ public:
//! the base type
typedef typename
Curved_kernel_via_analysis_2l::Base::Compare_y_at_x_2 Base;
CurvedKernelViaAnalysis_2l::
Functor_base::Compare_y_at_x_2 Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -882,14 +890,16 @@ public:
template < class CurvedKernelViaAnalysis_2l >
class Compare_y_at_x_left_2 :
public CurvedKernelViaAnalysis_2l::Base::Compare_y_at_x_left_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Compare_y_at_x_left_2 {
public:
//! this instance' first template parameter
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
//! the base type
typedef typename Curved_kernel_via_analysis_2l::Base::Compare_y_at_x_left_2
typedef typename CurvedKernelViaAnalysis_2l::
Functor_base::Compare_y_at_x_left_2
Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -962,7 +972,8 @@ public:
template < class CurvedKernelViaAnalysis_2l >
class Compare_y_at_x_right_2 :
public CurvedKernelViaAnalysis_2l::Base::Compare_y_at_x_right_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Compare_y_at_x_right_2 {
public:
//! this instance' first template parameter
@@ -970,7 +981,8 @@ public:
//! the base type
typedef typename
Curved_kernel_via_analysis_2l::Base::Compare_y_at_x_right_2
CurvedKernelViaAnalysis_2l::
Functor_base::Compare_y_at_x_right_2
Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -1042,7 +1054,8 @@ public:
//!\brief returns Parameter_space_in_y_2
template < class CurvedKernelViaAnalysis_2l >
class Parameter_space_in_y_2 :
public CurvedKernelViaAnalysis_2l::Base::Parameter_space_in_y_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Parameter_space_in_y_2 {
public:
//! this instance' first template parameter
@@ -1050,7 +1063,8 @@ public:
//! the base type
typedef typename
Curved_kernel_via_analysis_2l::Base::Parameter_space_in_y_2 Base;
CurvedKernelViaAnalysis_2l::
Functor_base::Parameter_space_in_y_2 Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -1097,7 +1111,8 @@ public:
//!\brief Constructs min vertex of arc
template < class CurvedKernelViaAnalysis_2l >
class Construct_min_vertex_2 :
public CurvedKernelViaAnalysis_2l::Base::Construct_min_vertex_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Construct_min_vertex_2 {
public:
//! this instance' first template parameter
@@ -1105,7 +1120,8 @@ public:
//! the base type
typedef typename
Curved_kernel_via_analysis_2l::Base::Construct_min_vertex_2 Base;
CurvedKernelViaAnalysis_2l::
Functor_base::Construct_min_vertex_2 Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -1143,7 +1159,8 @@ public:
//!\brief Constructs max vertex of arc
template < class CurvedKernelViaAnalysis_2l >
class Construct_max_vertex_2 :
public CurvedKernelViaAnalysis_2l::Base::Construct_max_vertex_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Construct_max_vertex_2 {
public:
//! this instance' first template parameter
@@ -1151,7 +1168,8 @@ public:
//! the base type
typedef typename
Curved_kernel_via_analysis_2l::Base::Construct_max_vertex_2 Base;
CurvedKernelViaAnalysis_2l::
Functor_base::Construct_max_vertex_2 Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -1189,14 +1207,16 @@ public:
template < class CurvedKernelViaAnalysis_2l >
class Do_overlap_2 :
public CurvedKernelViaAnalysis_2l::Base::Do_overlap_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Do_overlap_2 {
public:
//! this instance' first template parameter
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
//! the base type
typedef typename Curved_kernel_via_analysis_2l::Base::Do_overlap_2 Base;
typedef typename CurvedKernelViaAnalysis_2l::
Functor_base::Do_overlap_2 Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -1239,14 +1259,16 @@ public:
//!\brief Tests two objects, whether they are equal
template < class CurvedKernelViaAnalysis_2l >
class Equal_2 :
public CurvedKernelViaAnalysis_2l::Base::Equal_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Equal_2 {
public:
//! this instance' first template parameter
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
//! the base type
typedef typename Curved_kernel_via_analysis_2l::Base::Equal_2 Base;
typedef typename CurvedKernelViaAnalysis_2l::
Functor_base::Equal_2 Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -1308,14 +1330,15 @@ public:
//! checks wether and how two arcs are intersection - with first filtering
template < class CurvedKernelViaAnalysis_2l >
class Intersect_2 :
public CurvedKernelViaAnalysis_2l::Base::Intersect_2 {
public CurvedKernelViaAnalysis_2l::Functor_base::Intersect_2 {
public:
//! this instance' first template parameter
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
//! the base type
typedef typename Curved_kernel_via_analysis_2l::Base::Intersect_2 Base;
typedef typename CurvedKernelViaAnalysis_2l::
Functor_base::Intersect_2 Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -1488,14 +1511,16 @@ public:
template < class CurvedKernelViaAnalysis_2l >
class Trim_2 :
public CurvedKernelViaAnalysis_2l::Base::Trim_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Trim_2 {
public:
//! this instance' first template parameter
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
//! the base type
typedef typename Curved_kernel_via_analysis_2l::Base::Trim_2 Base;
typedef typename CurvedKernelViaAnalysis_2l::
Functor_base::Trim_2 Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -1543,14 +1568,16 @@ public:
template < class CurvedKernelViaAnalysis_2l >
class Split_2 :
public CurvedKernelViaAnalysis_2l::Base::Split_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Split_2 {
public:
//! this instance' first template parameter
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
//! the base type
typedef typename Curved_kernel_via_analysis_2l::Base::Split_2 Base;
typedef typename CurvedKernelViaAnalysis_2l::
Functor_base::Split_2 Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -1615,14 +1642,16 @@ public:
template < class CurvedKernelViaAnalysis_2l >
class Are_mergeable_2 :
public CurvedKernelViaAnalysis_2l::Base::Are_mergeable_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Are_mergeable_2 {
public:
//! this instance' first template parameter
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
//! the base type
typedef typename Curved_kernel_via_analysis_2l::Base::Are_mergeable_2
typedef typename CurvedKernelViaAnalysis_2l::
Functor_base::Are_mergeable_2
Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -1661,11 +1690,9 @@ public:
res = false;
}
if (res) {
Base base_are_mergeable(this->_ckva());
res = base_are_mergeable(cv1, cv2);
}
if (res)
res = Base::operator()(cv1, cv2);
CERR("result: " << res << "\n");
return res;
}
@@ -1674,14 +1701,16 @@ public:
template < class CurvedKernelViaAnalysis_2l >
class Merge_2 :
public CurvedKernelViaAnalysis_2l::Base::Merge_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Merge_2 {
public:
//! this instance' first template parameter
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
//! the base type
typedef typename Curved_kernel_via_analysis_2l::Base::Merge_2 Base;
typedef typename CurvedKernelViaAnalysis_2l::
Functor_base::Merge_2 Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
@@ -1742,23 +1771,24 @@ public:
template < class CurvedKernelViaAnalysis_2l >
class Make_x_monotone_2 :
public CurvedKernelViaAnalysis_2l::Base::Make_x_monotone_2 {
public CurvedKernelViaAnalysis_2l::
Functor_base::Make_x_monotone_2 {
public:
//! this instance' first template parameter
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
//! the base type
typedef typename Curved_kernel_via_analysis_2l::Base::Make_x_monotone_2
typedef typename CurvedKernelViaAnalysis_2l::
Functor_base::Make_x_monotone_2
Base;
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
typedef typename
Curved_kernel_via_analysis_2l::Curved_kernel_via_analysis_2
Curved_kernel_via_analysis_2;
typedef typename
Curved_kernel_via_analysis_2l::Curved_kernel_via_analysis_2
Curved_kernel_via_analysis_2;
typedef QdX::Quadric_3_z_at_xy_isolator_traits<
Curved_kernel_via_analysis_2, Curve_2 // Remark: Curve_2 == Surface_3
> Z_at_xy_traits;
@@ -1840,114 +1870,16 @@ public:
} // Quadrical_kernel_via_analysis_2_functors
} // namespace CGALi
//! basic kernel to maintain points and arcs on a quadric
template < class CurvedKernelViaAnalysis_2, class SurfacePair_3 >
class Quadrical_kernel_via_analysis_2 :
public CurvedKernelViaAnalysis_2::
template rebind<
Quadrical_kernel_via_analysis_2<
CurvedKernelViaAnalysis_2, SurfacePair_3
>
>::Other
{
public:
//! \name public typedefs
//!@{
//! this instance's first template argument
typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
//! this instance's second template parameter
typedef SurfacePair_3 Surface_pair_3;
//! myself
typedef Quadrical_kernel_via_analysis_2<
Curved_kernel_via_analysis_2, Surface_pair_3
>
Self;
template <class QKvA, class BaseCKvA>
struct Quadrical_functor_base :
public BaseCKvA::template rebind< QKvA >::Functor_base {
//! type of curve kernel
typedef typename
Curved_kernel_via_analysis_2::Curve_kernel_2 Curve_kernel_2;
typedef QKvA Self;
//! type of curve analysis
typedef typename Curve_kernel_2::Curve_analysis_2 Curve_analysis_2;
typedef typename BaseCKvA::template rebind< Self >::Functor_base
Functor_base;
//!@}
//!\name embedded types for \c Arrangement_2 package
//!@{
//! type of surface
typedef typename Surface_pair_3::Surface_3 Surface_3;
//! type of curve_2
typedef Surface_3 Curve_2;
//! type of a point on generic curve
typedef CGALi::Quadric_point_2< Self, Surface_pair_3 > Point_2;
//! type of an arc on generic curve
typedef CGALi::Quadric_arc_2< Self, Surface_pair_3 > Arc_2;
//! type of weakly x-monotone arc for \c ArrangementTraits_2
typedef Arc_2 X_monotone_curve_2;
//! tag specifies which boundary functors are implemented
typedef CGAL::Arr_all_boundary_tag Boundary_category;
//!@}
public:
//!\name base type
//!@{
//! the base type
typedef typename Curved_kernel_via_analysis_2::
template rebind< Self >::Other Base;
//!@}
public:
//! \name Constructors
//!@{
//! default constructor
Quadrical_kernel_via_analysis_2() :
Base() {
}
//! standard constructor
Quadrical_kernel_via_analysis_2(const Surface_3& reference) :
Base(),
_m_reference(reference) {
}
//! construct using specific \c Curve_kernel_2 instance (for controlling)
Quadrical_kernel_via_analysis_2(const Curve_kernel_2& kernel,
const Surface_3& reference) :
Base(kernel),
_m_reference(reference) {
}
//!@}
//!\name Access members
//!@{
//! returns the reference surface
inline
const Surface_3& reference() {
return _m_reference;
}
//!@}
public:
//!\name embedded constructions and predicates
//!@{
//! type of Construct_point_2 functor
typedef
CGALi::Curved_kernel_via_analysis_2l_Functors::Construct_point_2l<Self>
@@ -1958,15 +1890,12 @@ public:
}
//! type of Construct_projected_point_2 functor
typedef
typename Curved_kernel_via_analysis_2::Construct_point_2
Construct_projected_point_2;
typedef typename BaseCKvA::Construct_point_2 Construct_projected_point_2;
//! returns an instance of Construct_projected_point_2 functor
Construct_projected_point_2 construct_projected_point_2_object() const {
return
Curved_kernel_via_analysis_2(this->kernel()).
construct_point_2_object();
return BaseCKvA::instance().construct_point_2_object();
}
//! type of Construct_arc_2 functor
@@ -1979,14 +1908,12 @@ public:
}
//! type of Construct_projected_arc_2 functor
typedef
typename Curved_kernel_via_analysis_2::Construct_arc_2
Construct_projected_arc_2;
typedef typename BaseCKvA::Construct_arc_2 Construct_projected_arc_2;
//! returns an instance of Construct_projected_arc_2 functor
Construct_projected_arc_2 construct_projected_arc_2_object() const {
return
Curved_kernel_via_analysis_2(this->kernel()).
construct_arc_2_object();
//!@todo: alternative: BaseCKvA(Self::instance().kernel()).instance(). ?
return BaseCKvA::instance().construct_arc_2_object();
}
// declares curved kernel functors, for each functor defines a member function
@@ -2062,6 +1989,108 @@ public:
#undef CGAL_QKvA_2_functor_pred
#undef CGAL_QKvA_2_functor_cons
};
} // namespace CGALi
//! basic kernel to maintain points and arcs on a quadric
template < class BaseCKvA_2, class SurfacePair_3 >
class Quadrical_kernel_via_analysis_2 :
public CGALi::Curved_kernel_via_analysis_2_base<
Quadrical_kernel_via_analysis_2< BaseCKvA_2, SurfacePair_3 >,
BaseCKvA_2, typename BaseCKvA_2::Curve_kernel_2,
CGALi::Quadrical_functor_base >
{
public:
//! \name public typedefs
//!@{
//! this instance's first template argument
typedef BaseCKvA_2 Curved_kernel_via_analysis_2;
//! this instance's second template parameter
typedef SurfacePair_3 Surface_pair_3;
//! myself
typedef Quadrical_kernel_via_analysis_2<
Curved_kernel_via_analysis_2, Surface_pair_3
>
Self;
//! type of curve kernel
typedef typename Curved_kernel_via_analysis_2::Curve_kernel_2
Curve_kernel_2;
//! type of curve analysis
typedef typename Curve_kernel_2::Curve_analysis_2 Curve_analysis_2;
//!@}
//!\name embedded types for \c Arrangement_2 package
//!@{
//! type of surface
typedef typename Surface_pair_3::Surface_3 Surface_3;
//! type of curve_2
typedef Surface_3 Curve_2;
//! type of a point on generic curve
typedef CGALi::Quadric_point_2< Self, Surface_pair_3 > Point_2;
//! type of an arc on generic curve
typedef CGALi::Quadric_arc_2< Self, Surface_pair_3 > Arc_2;
//! type of weakly x-monotone arc for \c ArrangementTraits_2
typedef Arc_2 X_monotone_curve_2;
//! tag specifies which boundary functors are implemented
typedef CGAL::Arr_all_boundary_tag Boundary_category;
//!@}
protected:
//! base kernel type
typedef CGALi::Curved_kernel_via_analysis_2_base<
Self, Curved_kernel_via_analysis_2, Curve_kernel_2,
CGALi::Quadrical_functor_base >
Base_kernel;
public:
//! \name Constructors
//!@{
//! default constructor
Quadrical_kernel_via_analysis_2() :
Base_kernel() {
}
//! standard constructor
Quadrical_kernel_via_analysis_2(const Surface_3& reference) :
Base_kernel(),
_m_reference(reference) {
}
//! construct using specific \c Curve_kernel_2 instance (for controlling)
Quadrical_kernel_via_analysis_2(const Curve_kernel_2& kernel,
const Surface_3& reference) :
Base_kernel(kernel),
_m_reference(reference) {
}
//!@}
//!\name Access members
//!@{
//! returns the reference surface
inline
const Surface_3& reference() {
return _m_reference;
}
//!@}
protected:
//!\name Data members