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"
50namespace 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;
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);
133const typename MySegmentC2<R>::Point_2 &
136 typename R::Less_xy_2 less_xy;
137 return less_xy(source(),target()) ? source() : target();
141const typename MySegmentC2<R>::Point_2 &
144 typename R::Less_xy_2 less_xy;
145 return less_xy(source(),target()) ? target() : source();
149const typename MySegmentC2<R>::Point_2 &
152 return (i%2 == 0) ? source() : target();
156const typename MySegmentC2<R>::Point_2 &
159 return (i%2 == 0) ? source() : target();
163const typename MySegmentC2<R>::Point_2 &
170typename MySegmentC2<R>::FT
173 typename R::Compute_squared_distance_2 squared_distance;
174 return squared_distance(source(), target());
178typename MySegmentC2<R>::Direction_2
181 typename R::Construct_vector_2 construct_vector;
182 return Direction_2( construct_vector( source(), target()));
186typename MySegmentC2<R>::Vector_2
189 typename R::Construct_vector_2 construct_vector;
190 return construct_vector( source(), target());
194typename MySegmentC2<R>::Line_2
197 typename R::Construct_line_2 construct_line;
199 return construct_line(*
this);
203typename 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());
240has_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;
286template <
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();
310template <
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);
382template <
typename NewKernel,
typename BaseKernel>
386 typedef typename BaseKernel::FT
FT;
404 template <
typename Kernel2>
409template <
typename FT_>
411 :
public CGAL::Type_equality_wrapper<
412 my_cartesian2d_base<kernel_2d<FT_>, CGAL::Cartesian<FT_> >,
415template <
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>
444template <
typename FT_>
446 :
public CGAL::Type_equality_wrapper<
447 my_cartesian3d_base<kernel_3d<FT_>, CGAL::Cartesian<FT_> >,
see the point page for the full documentation
CGAL::Bbox_2 operator()(const point_basic< Float > &p) const
const T * operator()(const point_basic< T > &p)
Point_2 operator()(const CGAL::Origin &o) const
const Point_2 & operator()(const Point_2 &p) const
Point_2 operator()(const Line_2 &l, int i) const
Point_2 operator()(const RT &x, const RT &y) const
Point_2 operator()(const Line_2 &l) const
Rep operator()(CGAL::Return_base_tag, CGAL::Origin o) const
Line_2 supporting_line() const
bool is_horizontal() const
bool has_on(const Point_2 &p) const
Segment_2 transform(const Aff_transformation_2 &t) const
const Point_2 & end() const
bool operator!=(const MySegmentC2 &s) const
Vector_2 to_vector() const
MySegmentC2(const Point_2 &sp, const Point_2 &tp)
const Point_2 & max() const
const Point_2 & start() const
bool is_degenerate() const
bool collinear_has_on(const Point_2 &p) const
const Point_2 & source() const
const Point_2 & target() const
CGAL::Bbox_2 bbox() const
const Point_2 & min() const
const Point_2 & point(int i) const
Segment_2 opposite() const
Direction_2 direction() const
const Point_2 & operator[](int i) const
bool operator==(const MySegmentC2 &s) const
const Point_2 & vertex(int i) const
FT squared_length() const
MyConstruct_bbox_2< typename OldKernel::Construct_bbox_2 > Construct_bbox_2
MySegmentC2< Kernel > Segment_2
MyConstruct_point_2< Kernel, OldKernel > Construct_point_2
Construct_bbox_2 construct_bbox_2_object() const
const FT * Cartesian_const_iterator_2
Construct_cartesian_const_iterator_2 construct_cartesian_const_iterator_2_object() const
MyConstruct_coord_iterator< FT > Construct_cartesian_const_iterator_2
Construct_point_2 construct_point_2_object() const
point_basic< FT > Point_2
point_basic< FT > Point_3
const point vertex[n_vertex]
std::istream & operator>>(std::istream &is, MySegmentC2< R > &s)
std::ostream & operator<<(std::ostream &os, const MySegmentC2< R > &s)
This file is part of Rheolef.
my_cartesian2d_base< Kernel2, BaseKernel > Type
my_cartesian3d_base< Kernel2, BaseKernel > Type