1 #ifndef _RHEO_CGAL_KERNEL_H
2 #define _RHEO_CGAL_KERNEL_H
38 #ifndef CGAL_HAS_NO_THREADS
39 #define CGAL_HAS_NO_THREADS
42 #pragma GCC diagnostic push
43 #pragma GCC diagnostic ignored "-Weffc++"
44 #pragma GCC diagnostic ignored "-Wignored-attributes"
45 #include <CGAL/Cartesian.h>
46 #pragma GCC diagnostic pop
48 #include "rheolef/point.h"
50 namespace rheolef {
namespace custom_cgal {
59 typedef typename R_::FT FT;
60 typedef typename R_::Point_2 Point_2;
61 typedef typename R_::Vector_2 Vector_2;
62 typedef typename R_::Direction_2 Direction_2;
63 typedef typename R_::Line_2 Line_2;
64 typedef typename R_::Segment_2 Segment_2;
65 typedef typename R_::Aff_transformation_2 Aff_transformation_2;
78 bool has_on(
const Point_2 &
p)
const;
93 const Point_2 &
start()
const;
94 const Point_2 &
end()
const;
96 const Point_2 &
min ()
const;
97 const Point_2 &
max ()
const;
98 const Point_2 &
vertex(
int i)
const;
99 const Point_2 &
point(
int i)
const;
109 Segment_2
transform(
const Aff_transformation_2 &t)
const
111 return Segment_2(t.transform(
source()), t.transform(
target()));
115 CGAL::Bbox_2
bbox()
const;
122 return source() == s.
source() && target() == s.
target();
129 return !(*
this == s);
133 const typename MySegmentC2<R>::Point_2 &
136 typename R::Less_xy_2 less_xy;
137 return less_xy(source(),target()) ? source() : target();
141 const typename MySegmentC2<R>::Point_2 &
144 typename R::Less_xy_2 less_xy;
145 return less_xy(source(),target()) ? target() : source();
149 const typename MySegmentC2<R>::Point_2 &
152 return (i%2 == 0) ? source() : target();
156 const typename MySegmentC2<R>::Point_2 &
159 return (i%2 == 0) ? source() : target();
163 const typename MySegmentC2<R>::Point_2 &
170 typename MySegmentC2<R>::FT
173 typename R::Compute_squared_distance_2 squared_distance;
174 return squared_distance(source(), target());
178 typename MySegmentC2<R>::Direction_2
181 typename R::Construct_vector_2 construct_vector;
182 return Direction_2( construct_vector( source(), target()));
186 typename MySegmentC2<R>::Vector_2
189 typename R::Construct_vector_2 construct_vector;
190 return construct_vector( source(), target());
194 typename MySegmentC2<R>::Line_2
197 typename R::Construct_line_2 construct_line;
199 return construct_line(*
this);
203 typename MySegmentC2<R>::Segment_2
213 return source().bbox() + target().bbox();
220 return R().equal_y_2_object()(source(), target());
227 return R().equal_y_2_object()(source(), target());
234 return R().equal_x_2_object()(source(), target());
240 has_on(
const typename MySegmentC2<R>::Point_2 &
p)
const
242 return R().collinear_are_ordered_along_line_2_object()(source(),
p, target());
250 return R().collinear_has_on_2_object()(*
this,
p);
256 #if CGAL_VERSION_NR >= 1041101000
257 switch(CGAL::get_mode(os)) {
258 #elif CGAL_VERSION_NR >= 1040801000
259 switch(os.iword(CGAL::IO::get_static_mode())) {
261 switch(os.iword(CGAL::IO::mode)) {
263 case CGAL::IO::ASCII :
265 case CGAL::IO::BINARY :
268 return os <<
"MySegmentC2(" << s.
source() <<
", " << s.
target() <<
")";
275 typename R::Point_2
p, q;
286 template <
class ConstructBbox_2>
289 using ConstructBbox_2::operator();
291 return CGAL::Bbox_2(
p.x(),
p.y(),
p.x(),
p.y());
302 const T* pyptr = &
p.y();
310 template <
typename K,
typename OldK>
313 typedef typename K::RT RT;
314 typedef typename K::Point_2 Point_2;
315 typedef typename K::Line_2 Line_2;
316 typedef typename Point_2::Rep Rep;
328 operator() (CGAL::Return_base_tag,
const RT& x,
const RT& y)
const
329 {
return Rep(x, y); }
333 operator() (CGAL::Return_base_tag,
const RT& x,
const RT& y,
const RT& w)
const
334 {
return Rep(x, y); }
356 typename OldK::Construct_point_2 base_operator;
357 Point_2
p = base_operator(l);
364 typename OldK::Construct_point_2 base_operator;
365 return base_operator(l, i);
382 template <
typename NewKernel,
typename BaseKernel>
386 typedef typename BaseKernel::FT
FT;
404 template <
typename Kernel2>
409 template <
typename FT_>
411 :
public CGAL::Type_equality_wrapper<
412 my_cartesian2d_base<kernel_2d<FT_>, CGAL::Cartesian<FT_> >,
415 template <
typename NewKernel,
typename BaseKernel>
419 typedef typename BaseKernel::FT
FT;
430 typedef const FT* Cartesian_const_iterator_2;
433 Construct_point_2 construct_point_2_object()
const {
return Construct_point_2(); }
434 Construct_bbox_2 construct_bbox_2_object()
const {
return Construct_bbox_2(); }
435 Construct_cartesian_const_iterator_2 construct_cartesian_const_iterator_2_object()
const
436 {
return Construct_cartesian_const_iterator_2(); }
439 template <
typename Kernel2>
444 template <
typename FT_>
446 :
public CGAL::Type_equality_wrapper<
447 my_cartesian3d_base<kernel_3d<FT_>, CGAL::Cartesian<FT_> >,
452 #endif // _RHEO_CGAL_KERNEL_H