1 #ifndef _RHEO_CGAL_KERNEL_H
2 #define _RHEO_CGAL_KERNEL_H
7 #include <CGAL/Cartesian.h>
8 #include "rheolef/point.h"
10 namespace rheolef {
namespace custom_cgal {
16 typedef typename R_::FT
FT;
72 CGAL::Bbox_2
bbox()
const;
93 typename R::Less_xy_2 less_xy;
94 return less_xy(source(),target()) ? source() : target();
101 typename R::Less_xy_2 less_xy;
102 return less_xy(source(),target()) ? target() : source();
109 return (i%2 == 0) ? source() : target();
116 return (i%2 == 0) ? source() : target();
130 typename R::Compute_squared_distance_2 squared_distance;
131 return squared_distance(source(), target());
138 typename R::Construct_vector_2 construct_vector;
139 return Direction_2( construct_vector( source(), target()));
146 typename R::Construct_vector_2 construct_vector;
147 return construct_vector( source(), target());
154 typename R::Construct_line_2 construct_line;
156 return construct_line(*
this);
170 return source().bbox() + target().bbox();
177 return R().equal_y_2_object()(source(), target());
184 return R().equal_y_2_object()(source(), target());
191 return R().equal_x_2_object()(source(), target());
199 return R().collinear_are_ordered_along_line_2_object()(source(), p, target());
207 return R().collinear_has_on_2_object()(*
this, p);
211 operator<<(std::ostream &os, const MySegmentC2<R> &s)
213 switch(os.iword(CGAL::IO::mode)) {
214 case CGAL::IO::ASCII :
215 return os << s.source() <<
' ' << s.target();
216 case CGAL::IO::BINARY :
217 return os << s.source() << s.target();
219 return os <<
"MySegmentC2(" << s.source() <<
", " << s.target() <<
")";
226 typename R::Point_2 p, q;
234 template <
class ConstructBbox_2>
237 using ConstructBbox_2::operator();
239 return CGAL::Bbox_2(p.
x(), p.
y(), p.
x(), p.
y());
247 const T* pyptr = &p.
y();
252 template <
typename K,
typename OldK>
255 typedef typename K::RT
RT;
258 typedef typename Point_2::Rep
Rep;
268 {
return Rep(x, y); }
272 operator() (CGAL::Return_base_tag,
const RT& x,
const RT& y,
const RT& w)
const
273 {
return Rep(x, y); }
289 typename OldK::Construct_point_2 base_operator;
297 typename OldK::Construct_point_2 base_operator;
298 return base_operator(l, i);
311 template <
typename NewKernel,
typename BaseKernel>
315 typedef typename BaseKernel::FT
FT;
333 template <
typename Kernel2>
338 template <
typename FT_>
340 :
public CGAL::Type_equality_wrapper<
341 my_cartesian2d_base<kernel_2d<FT_>, CGAL::Cartesian<FT_> >,
344 template <
typename NewKernel,
typename BaseKernel>
348 typedef typename BaseKernel::FT
FT;
359 typedef const FT* Cartesian_const_iterator_2;
362 Construct_point_2 construct_point_2_object()
const {
return Construct_point_2(); }
363 Construct_bbox_2 construct_bbox_2_object()
const {
return Construct_bbox_2(); }
364 Construct_cartesian_const_iterator_2 construct_cartesian_const_iterator_2_object()
const
365 {
return Construct_cartesian_const_iterator_2(); }
368 template <
typename Kernel2>
373 template <
typename FT_>
375 :
public CGAL::Type_equality_wrapper<
376 my_cartesian3d_base<kernel_3d<FT_>, CGAL::Cartesian<FT_> >,
381 #endif // _RHEO_CGAL_KERNEL_H