mirror of https://github.com/CGAL/cgal
implemented "reverse" rebind
This commit is contained in:
parent
1723ee2063
commit
20879cadef
|
|
@ -254,6 +254,33 @@ public:
|
|||
return arc._maxpoint();
|
||||
}
|
||||
|
||||
// TODO move to SfA_2l
|
||||
/*!\brief
|
||||
* reverse rebind, i.e., extracts original arc type from a
|
||||
* rebound instance
|
||||
*/
|
||||
Self operator()(const Rebound_arc_2& arc) {
|
||||
Rep rep;
|
||||
|
||||
rep._m_min = typename New_point_2::Rebind()(arc._minpoint());
|
||||
rep._m_max = typename New_point_2::Rebind()(arc._maxpoint());
|
||||
|
||||
rep._m_support = arc.ptr()->_m_support;
|
||||
|
||||
rep._m_arcno = arc.ptr()->_m_arcno;
|
||||
rep._m_arcno_min = arc.ptr()->_m_arcno_min;
|
||||
rep._m_arcno_max = arc.ptr()->_m_arcno_max;
|
||||
|
||||
rep._m_is_vertical = arc.ptr()->_m_is_vertical;
|
||||
|
||||
rep._m_interval_id = arc.ptr()->_m_interval_id;
|
||||
|
||||
rep._m_boundary_in_interval =
|
||||
arc.ptr()->_m_boundary_in_interval;
|
||||
|
||||
return Self(rep);
|
||||
}
|
||||
|
||||
protected:
|
||||
//! collect common assignments
|
||||
void copy_members(const Self& arc, New_rep& newrep) {
|
||||
|
|
|
|||
|
|
@ -199,6 +199,25 @@ public:
|
|||
newrep._m_location = pt.ptr()->_m_location;
|
||||
return Rebound_point_2(newrep);
|
||||
}
|
||||
|
||||
// TODO move to SfP_2l
|
||||
/*!\brief
|
||||
* reverse rebind, i.e., extracts original point type from a
|
||||
* rebound instance
|
||||
*/
|
||||
Self operator()(const Rebound_point_2& pt) {
|
||||
Rep rep;
|
||||
rep._m_xy = pt.ptr()->_m_xy;
|
||||
rep._m_x = pt.ptr()->_m_x;
|
||||
rep._m_curve = pt.ptr()->_m_curve;
|
||||
rep._m_arcno = pt.ptr()->_m_arcno;
|
||||
if (pt.is_finite()) {
|
||||
rep._m_location = CGAL::ARR_INTERIOR;
|
||||
} else {
|
||||
rep._m_location = pt.ptr()->_m_location;
|
||||
}
|
||||
return Self(rep);
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -762,7 +762,13 @@ public:
|
|||
*/
|
||||
Projected_arc_2 projected_arc() const {
|
||||
CGAL_precondition(!this->is_z_vertical());
|
||||
CGAL_precondition(this->ptr()->_m_projected_arc);
|
||||
if (!this->ptr()->_m_projected_arc) {
|
||||
CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this));
|
||||
this->ptr()->_m_projected_arc =
|
||||
typename Kernel_arc_2::Rebind()(
|
||||
*dynamic_cast< const Kernel_arc_2* >(this)
|
||||
);
|
||||
}
|
||||
return *(this->ptr()->_m_projected_arc);
|
||||
}
|
||||
|
||||
|
|
@ -886,6 +892,8 @@ protected:
|
|||
replaced.first.ptr()->_m_sheet_max = sheet2;
|
||||
}
|
||||
|
||||
replaced.first.ptr()->_m_projected_arc = boost::none;
|
||||
|
||||
return replaced;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ public:
|
|||
Curve_analysis_2;
|
||||
|
||||
//! type of kernel point
|
||||
typedef typename Curved_kernel_via_analysis_2l::Point_2 Kernel_point;
|
||||
typedef typename Curved_kernel_via_analysis_2l::Point_2 Kernel_point_2;
|
||||
|
||||
//! type of Approximation
|
||||
typedef typename Rep::Approximation_3 Approximation_3;
|
||||
|
|
@ -191,7 +191,7 @@ public:
|
|||
const Surface_3& surface,
|
||||
int sheet) :
|
||||
Base(Rebind()(pt)) {
|
||||
|
||||
|
||||
this->copy_on_write();
|
||||
|
||||
this->ptr()->_m_projected_point = pt;
|
||||
|
|
@ -271,8 +271,14 @@ public:
|
|||
* returns projected point
|
||||
*/
|
||||
inline
|
||||
const Projected_point_2& projected_point() const {
|
||||
CGAL_precondition(this->ptr()->_m_projected_point);
|
||||
Projected_point_2 projected_point() const {
|
||||
if (!this->ptr()->_m_projected_point) {
|
||||
CGAL_precondition(dynamic_cast< const Kernel_point_2* >(this));
|
||||
this->ptr()->_m_projected_point =
|
||||
typename Kernel_point_2::Rebind()(
|
||||
*dynamic_cast< const Kernel_point_2* >(this)
|
||||
);
|
||||
}
|
||||
return *this->ptr()->_m_projected_point;
|
||||
}
|
||||
|
||||
|
|
@ -321,17 +327,17 @@ public:
|
|||
//!
|
||||
//!\pre compared points have finite x/y-coordinates
|
||||
inline
|
||||
CGAL::Comparison_result compare_xyz(const Kernel_point& q,
|
||||
bool equal_xy = false) const {
|
||||
CGAL::Comparison_result compare_xyz(const Kernel_point_2& q,
|
||||
bool equal_xy = false) const {
|
||||
CGAL_precondition(this->is_finite());
|
||||
CGAL_precondition(q.is_finite());
|
||||
|
||||
CGAL_CKvA_2l_GRAB_CK_FUNCTOR_FOR_POINT(Compare_xyz_3,
|
||||
compare_xyz_3,
|
||||
compare_xyz_3_object);
|
||||
CGAL_precondition(dynamic_cast< const Kernel_point* >(this));
|
||||
CGAL_precondition(dynamic_cast< const Kernel_point_2* >(this));
|
||||
return compare_xyz_3(
|
||||
*dynamic_cast< const Kernel_point* >(this), q, equal_xy
|
||||
*dynamic_cast< const Kernel_point_2* >(this), q, equal_xy
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue