mirror of https://github.com/CGAL/cgal
functors are using base now
This commit is contained in:
parent
7094250dd1
commit
f0c8ff80e1
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <CGAL/basic.h>
|
||||
|
||||
// TODO derive from base class (eriC)
|
||||
#include <CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -31,66 +31,90 @@ namespace CGALi {
|
|||
|
||||
namespace Curved_kernel_via_analysis_2l_Functors {
|
||||
|
||||
template <class CurvedKernel_2>
|
||||
class Construct_point_2l {
|
||||
typedef typename CurvedKernel_2::Point_2 Point_2;
|
||||
typedef typename CurvedKernel_2::Arc_2 Arc_2;
|
||||
|
||||
#define CGAL_CKvA_2l_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::X_coordinate_1 X_coordinate_1; \
|
||||
|
||||
|
||||
template < class CurvedKernelViaAnalysis_2l >
|
||||
class Construct_point_2l : public Curved_kernel_via_analysis_2_Functors::
|
||||
Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2l > {
|
||||
|
||||
public:
|
||||
typedef Point_2 result_type;
|
||||
//! this instance' first template parameter
|
||||
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
|
||||
|
||||
//! the base type
|
||||
typedef
|
||||
Curved_kernel_via_analysis_2_Functors::
|
||||
Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2l >
|
||||
Base;
|
||||
|
||||
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
|
||||
|
||||
//! type of projected point
|
||||
typedef typename Point_2::Projected_point_2 Projected_point_2;
|
||||
|
||||
//! type of surface
|
||||
typedef typename Point_2::Surface_3 Surface_3;
|
||||
|
||||
//! the result type
|
||||
typedef Point_2 result_type;
|
||||
|
||||
//! standard constructor
|
||||
Construct_point_2l(CurvedKernel_2 *kernel) :
|
||||
_m_curved_kernel(kernel) {
|
||||
CGAL_assertion(kernel != NULL);
|
||||
Construct_point_2l(Curved_kernel_via_analysis_2l *kernel) :
|
||||
Base(kernel) {
|
||||
}
|
||||
|
||||
Point_2 operator()(const Projected_point_2& xy,
|
||||
const Surface_3& surface,
|
||||
int sheet) const {
|
||||
CGAL_precondition(sheet >= 0);
|
||||
Point_2 pt(_m_curved_kernel, xy, surface, sheet);
|
||||
Point_2 pt(this->_ckva(), xy, surface, sheet);
|
||||
return pt;
|
||||
}
|
||||
|
||||
private:
|
||||
//! pointer to \c CurvedKernel_2 ?
|
||||
CurvedKernel_2 *_m_curved_kernel;
|
||||
};
|
||||
|
||||
|
||||
//!\brief Functor to construct point on an arc
|
||||
//! \c x on curve \c c with arc number \c arcno
|
||||
//!
|
||||
//! implies no boundary conditions in x/y
|
||||
template <class CurvedKernel_2>
|
||||
class Construct_point_on_arc_2 {
|
||||
typedef typename CurvedKernel_2::Point_2 Point_2;
|
||||
typedef typename CurvedKernel_2::Arc_2 Arc_2;
|
||||
|
||||
template < class CurvedKernelViaAnalysis_2l >
|
||||
class Construct_point_on_arc_2 : public Curved_kernel_via_analysis_2_Functors::
|
||||
Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2l > {
|
||||
|
||||
public:
|
||||
//! this instance' first template parameter
|
||||
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
|
||||
|
||||
//! the base type
|
||||
typedef
|
||||
Curved_kernel_via_analysis_2_Functors::
|
||||
Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2l >
|
||||
Base;
|
||||
|
||||
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
|
||||
|
||||
//! the result type
|
||||
typedef Point_2 result_type;
|
||||
|
||||
//! standard constructor
|
||||
Construct_point_on_arc_2(CurvedKernel_2 *kernel) :
|
||||
_m_curved_kernel(kernel) {
|
||||
CGAL_assertion(kernel != NULL);
|
||||
Construct_point_on_arc_2(Curved_kernel_via_analysis_2l *kernel) :
|
||||
Base(kernel) {
|
||||
}
|
||||
|
||||
//! constructs points at x
|
||||
template < class NewArc_2 >
|
||||
Point_2 operator()(
|
||||
const typename Point_2::X_coordinate_1& x,
|
||||
const typename Point_2::Curve_2& c, int arcno,
|
||||
const NewArc_2& arc) {
|
||||
const Arc_2& arc) {
|
||||
CGAL_assertion(c.id() == arc.curve().id());
|
||||
CGAL_assertion(arcno == arc.arcno(x));
|
||||
typename CurvedKernel_2::Construct_projected_point_2
|
||||
typename Curved_kernel_via_analysis_2l::Construct_projected_point_2
|
||||
construct_projected_point =
|
||||
_m_curved_kernel->construct_projected_point_2_object();
|
||||
this->_ckva()->construct_projected_point_2_object();
|
||||
typename Point_2::Projected_point_2 p_pt =
|
||||
construct_projected_point(x, c, arcno);
|
||||
int sheet = arc.sheet();
|
||||
|
|
@ -107,36 +131,52 @@ public:
|
|||
sheet = arc.sheet(CGAL::ARR_MAX_END);
|
||||
}
|
||||
}
|
||||
typename CurvedKernel_2::Construct_point_2 construct_point_2 =
|
||||
_m_curved_kernel->construct_point_2_object();
|
||||
typename Curved_kernel_via_analysis_2l::Construct_point_2
|
||||
construct_point_2 = this->_ckva()->construct_point_2_object();
|
||||
|
||||
Point_2 pt = construct_point_2(p_pt, arc.surface(), sheet);
|
||||
return pt;
|
||||
}
|
||||
|
||||
private:
|
||||
//! pointer to \c CurvedKernel_2 ?
|
||||
CurvedKernel_2 *_m_curved_kernel;
|
||||
};
|
||||
|
||||
|
||||
template < class CurvedKernelViaAnalysis_2l >
|
||||
class Construct_arc_2l : public Curved_kernel_via_analysis_2_Functors::
|
||||
Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2l > {
|
||||
|
||||
template <class CurvedKernel_2>
|
||||
class Construct_arc_2l {
|
||||
typedef typename CurvedKernel_2::Point_2 Surface_point_2l;
|
||||
typedef typename CurvedKernel_2::Arc_2 Surface_arc_2l;
|
||||
|
||||
public:
|
||||
typedef Surface_point_2l result_type;
|
||||
//! this instance' first template parameter
|
||||
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
|
||||
|
||||
//! the base type
|
||||
typedef
|
||||
Curved_kernel_via_analysis_2_Functors::
|
||||
Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2l >
|
||||
Base;
|
||||
|
||||
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
|
||||
|
||||
//! type of point on surface
|
||||
typedef typename Curved_kernel_via_analysis_2l::Point_2 Surface_point_2l;
|
||||
|
||||
//! type of arc on surface
|
||||
typedef typename Curved_kernel_via_analysis_2l::Arc_2 Surface_arc_2l;
|
||||
|
||||
//! type of projected point
|
||||
typedef typename Surface_point_2l::Projected_point_2 Projected_point_2;
|
||||
|
||||
//! type of projceteda rc
|
||||
typedef typename Surface_arc_2l::Projected_arc_2 Projected_arc_2;
|
||||
|
||||
//! type of surface
|
||||
typedef typename Surface_point_2l::Surface_3 Surface_3;
|
||||
|
||||
//! the result type
|
||||
typedef Point_2 result_type;
|
||||
|
||||
//! standard constructor
|
||||
Construct_arc_2l(CurvedKernel_2 *kernel) :
|
||||
_m_curved_kernel(kernel) {
|
||||
CGAL_assertion(kernel != NULL);
|
||||
Construct_arc_2l(Curved_kernel_via_analysis_2l *kernel) :
|
||||
Base(kernel) {
|
||||
}
|
||||
|
||||
//!\name Constructing non-vertical arcs
|
||||
|
|
@ -156,7 +196,7 @@ public:
|
|||
const Surface_point_2l& q,
|
||||
const Surface_3& surface,
|
||||
int sheet, int sheet_p, int sheet_q) {
|
||||
Surface_arc_2l surface_arc(_m_curved_kernel, arc, p, q, surface,
|
||||
Surface_arc_2l surface_arc(this->_ckva(), arc, p, q, surface,
|
||||
sheet, sheet_p, sheet_q);
|
||||
return surface_arc;
|
||||
}
|
||||
|
|
@ -173,7 +213,7 @@ public:
|
|||
const Surface_point_2l& p,
|
||||
const Surface_3& surface,
|
||||
int sheet, int sheet_p) {
|
||||
Surface_arc_2l surface_arc(_m_curved_kernel,
|
||||
Surface_arc_2l surface_arc(this->_ckva(),
|
||||
arc, p, surface, sheet, sheet_p);
|
||||
return surface_arc;
|
||||
}
|
||||
|
|
@ -190,7 +230,7 @@ public:
|
|||
Surface_arc_2l operator()(const Projected_arc_2& arc,
|
||||
const Surface_3& surface,
|
||||
int sheet) {
|
||||
Surface_arc_2l surface_arc(_m_curved_kernel, arc, surface, sheet);
|
||||
Surface_arc_2l surface_arc(this->_ckva(), arc, surface, sheet);
|
||||
return surface_arc;
|
||||
}
|
||||
|
||||
|
|
@ -203,7 +243,7 @@ public:
|
|||
Surface_arc_2l operator()(const Surface_point_2l& p,
|
||||
const Surface_point_2l& q,
|
||||
const Surface_3& surface) {
|
||||
Surface_arc_2l surface_arc(_m_curved_kernel, p, q, surface);
|
||||
Surface_arc_2l surface_arc(this->_ckva(), p, q, surface);
|
||||
return surface_arc;
|
||||
}
|
||||
|
||||
|
|
@ -211,41 +251,43 @@ public:
|
|||
Surface_arc_2l operator()(const Surface_point_2l p,
|
||||
CGAL::Arr_curve_end inf_end,
|
||||
const Surface_3& surface) {
|
||||
Surface_arc_2l surface_arc(_m_curved_kernel, p, inf_end, surface);
|
||||
Surface_arc_2l surface_arc(this->_ckva(), p, inf_end, surface);
|
||||
return surface_arc;
|
||||
}
|
||||
|
||||
//! represents a vertical branch
|
||||
Surface_arc_2l operator()(const Projected_point_2& p,
|
||||
const Surface_3& surface) {
|
||||
Surface_arc_2l surface_arc(_m_curved_kernel, p, surface);
|
||||
Surface_arc_2l surface_arc(this->_ckva(), p, surface);
|
||||
return surface_arc;
|
||||
}
|
||||
|
||||
private:
|
||||
//! pointer to \c CurvedKernel_2 ?
|
||||
CurvedKernel_2 *_m_curved_kernel;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//!\brief Tests whether a point lies on a supporting curve
|
||||
template < class CurvedKernel_2 >
|
||||
class Is_on_2
|
||||
{
|
||||
typedef typename CurvedKernel_2::Point_2 Point_2;
|
||||
typedef typename CurvedKernel_2::Curve_2 Curve_2;
|
||||
typedef typename CurvedKernel_2::Arc_2 Arc_2;
|
||||
|
||||
template < class CurvedKernelViaAnalysis_2l >
|
||||
class Is_on_2: public Curved_kernel_via_analysis_2_Functors::
|
||||
Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2l > {
|
||||
|
||||
public:
|
||||
//! this instance' first template parameter
|
||||
typedef CurvedKernelViaAnalysis_2l Curved_kernel_via_analysis_2l;
|
||||
|
||||
//! the base type
|
||||
typedef
|
||||
Curved_kernel_via_analysis_2_Functors::
|
||||
Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2l >
|
||||
Base;
|
||||
|
||||
CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES;
|
||||
|
||||
//! the result type
|
||||
typedef bool result_type;
|
||||
typedef Arity_tag<2> Arity;
|
||||
|
||||
//! standard constructor
|
||||
Is_on_2(CurvedKernel_2 *kernel) :
|
||||
_m_curved_kernel(kernel) {
|
||||
CGAL_assertion(kernel != NULL);
|
||||
Is_on_2(Curved_kernel_via_analysis_2l *kernel) :
|
||||
Base(kernel) {
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -260,12 +302,9 @@ public:
|
|||
CGAL_error_msg("Is_on_2 not implemented for Surfaces");
|
||||
return res;
|
||||
}
|
||||
|
||||
private:
|
||||
//! pointer to \c CurvedKernel_2 ?
|
||||
CurvedKernel_2 *_m_curved_kernel;
|
||||
};
|
||||
|
||||
#undef CGAL_CKvA_2l_GRAB_BASE_FUNCTOR_TYPES
|
||||
|
||||
} // Curved_kernel_via_analysis_2l_Functors
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue