50 #ifndef CGAL_SEGMENT_2_H
51 #define CGAL_SEGMENT_2_H
53 #ifndef CGAL_REP_CLASS_DEFINED
54 #error no representation class defined
55 #endif // CGAL_REP_CLASS_DEFINED
57 #ifdef CGAL_HOMOGENEOUS_H
58 #ifndef CGAL_SEGMENTH2_H
59 #include <CGAL/SegmentH2.h>
60 #endif // CGAL_SEGMENTH2_H
61 #endif // CGAL_HOMOGENEOUS_H
63 #ifdef CGAL_CARTESIAN_H
64 #ifndef CGAL_SEGMENTC2_H
65 #include <CGAL/Cartesian/Segment_2.h>
66 #endif // CGAL_SEGMENTC2_H
67 #endif // CGAL_CARTESIAN_H
69 #ifdef CGAL_SIMPLE_CARTESIAN_H
71 #endif // CGAL_SIMPLE_CARTESIAN_H
76 #endif // CGAL_LINE_2_H
81 class Segment_2 :
public R_::Segment_2_base
85 typedef typename R::RT
RT;
86 typedef typename R::FT
FT;
100 Segment_2(
const CGAL::Point_2<R> &sp,
const CGAL::Point_2<R> &ep)
112 {
return RSegment_2::is_horizontal(); }
115 {
return RSegment_2::is_vertical(); }
117 bool has_on(
const CGAL::Point_2<R> &p)
const
118 {
return RSegment_2::has_on(p); }
121 {
return RSegment_2::collinear_has_on(p); }
128 {
return !(*
this ==
s); }
131 {
return RSegment_2::start(); }
133 CGAL::Point_2<R>
end()
const
134 {
return RSegment_2::end(); }
137 {
return RSegment_2::source(); }
140 {
return RSegment_2::target(); }
142 CGAL::Point_2<R>
min()
const
145 CGAL::Point_2<R>
max()
const
149 {
return RSegment_2::vertex(i); }
152 {
return RSegment_2::vertex(i); }
158 {
return RSegment_2::squared_length(); }
161 {
return RSegment_2::direction(); }
169 CGAL::Segment_2<R>
transform(
const CGAL::Aff_transformation_2<R> &t)
const
170 {
return RSegment_2::transform(t); }
174 {
return RSegment_2::supporting_line(); }
177 {
return RSegment_2::is_degenerate(); }
184 #ifndef NO_OSTREAM_INSERT_SEGMENT_2
187 operator<<(std::ostream &os, const Segment_2<R> &
s)
189 typedef typename R::Segment_2_base RSegment_2;
190 return os << (
const RSegment_2&)
s;
192 #endif // NO_OSTREAM_INSERT_SEGMENT_2
194 #ifndef NO_ISTREAM_EXTRACT_SEGMENT_2
199 typedef typename R::Segment_2_base RSegment_2;
200 return is >> (RSegment_2&)s;
202 #endif // NO_ISTREAM_EXTRACT_SEGMENT_2
207 #endif // CGAL_SEGMENT_2_H
FT squared_length() const
CGAL::Direction_2< R > direction() const
CGAL_END_NAMESPACE CGAL_BEGIN_NAMESPACE bool operator==(const Origin &o, const Point_2< R > &p)
bool collinear_has_on(const CGAL::Point_2< R > &p) const
CGAL::Point_2< R > operator[](int i) const
CGAL::Line_2< R > supporting_line() const
CGAL::Point_2< R > max() const
CGAL::Segment_2< R > opposite() const
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
CGAL::Point_2< R > min() const
CGAL::Point_2< R > target() const
CGAL::Point_2< R > vertex(int i) const
Segment_2(const CGAL::Segment_2< R > &s)
R::Segment_2_base RSegment_2
Segment_2(const CGAL::Point_2< R > &sp, const CGAL::Point_2< R > &ep)
CGAL::Point_2< R > source() const
bool operator==(const CGAL::Segment_2< R > &s) const
CGAL::Point_2< R > point(int i) const
bool is_horizontal() const
CGAL::Segment_2< R > transform(const CGAL::Aff_transformation_2< R > &t) const
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
CGAL::Point_2< R > end() const
bool has_on(const CGAL::Point_2< R > &p) const
Segment_2(const RSegment_2 &s)
#define CGAL_BEGIN_NAMESPACE
#define CGAL_END_NAMESPACE
CGAL::Point_2< R > start() const
bool operator!=(const CGAL::Segment_2< R > &s) const
bool is_degenerate() const