Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Segment_2.h
Go to the documentation of this file.
1 // ======================================================================
2 //
3 // Copyright (c) 1999 The CGAL Consortium
4 
5 // This software and related documentation is part of the Computational
6 // Geometry Algorithms Library (CGAL).
7 // This software and documentation is provided "as-is" and without warranty
8 // of any kind. In no event shall the CGAL Consortium be liable for any
9 // damage of any kind.
10 //
11 // Every use of CGAL requires a license.
12 //
13 // Academic research and teaching license
14 // - For academic research and teaching purposes, permission to use and copy
15 // the software and its documentation is hereby granted free of charge,
16 // provided that it is not a component of a commercial product, and this
17 // notice appears in all copies of the software and related documentation.
18 //
19 // Commercial licenses
20 // - A commercial license is available through Algorithmic Solutions, who also
21 // markets LEDA (http://www.algorithmic-solutions.de).
22 // - Commercial users may apply for an evaluation license by writing to
23 // Algorithmic Solutions (contact@algorithmic-solutions.com).
24 //
25 // The CGAL Consortium consists of Utrecht University (The Netherlands),
26 // ETH Zurich (Switzerland), Free University of Berlin (Germany),
27 // INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
28 // (Germany), Max-Planck-Institute Saarbrucken (Germany), RISC Linz (Austria),
29 // and Tel-Aviv University (Israel).
30 //
31 // ----------------------------------------------------------------------
32 //
33 // release : CGAL-2.2
34 // release_date : 2000, September 30
35 //
36 // source : Segment_2.fw
37 // file : include/CGAL/Segment_2.h
38 // package : _2 (3.6)
39 // revision : 3.6
40 // revision_date : 30 Jul 2000
41 // author(s) : Andreas Fabri
42 //
43 // coordinator : MPI, Saarbruecken (<Stefan.Schirra>)
44 // email : contact@cgal.org
45 // www : http://www.cgal.org
46 //
47 // ======================================================================
48 
49 
50 #ifndef CGAL_SEGMENT_2_H
51 #define CGAL_SEGMENT_2_H
52 
53 #ifndef CGAL_REP_CLASS_DEFINED
54 #error no representation class defined
55 #endif // CGAL_REP_CLASS_DEFINED
56 
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
62 
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
68 
69 #ifdef CGAL_SIMPLE_CARTESIAN_H
71 #endif // CGAL_SIMPLE_CARTESIAN_H
72 
73 
74 #ifndef CGAL_LINE_2_H
75 #include <CGAL/Line_2.h>
76 #endif // CGAL_LINE_2_H
77 
79 
80 template <class R_>
81 class Segment_2 : public R_::Segment_2_base
82 {
83 public:
84  typedef R_ R;
85  typedef typename R::RT RT;
86  typedef typename R::FT FT;
87  typedef typename R::Segment_2_base RSegment_2;
88 
89  Segment_2() // doesn't the default constructor do the same ???
90  : RSegment_2() // does the handle stuff
91  {}
92 
94  {}
95 
96  Segment_2(const CGAL::Segment_2<R>& s)
97  : RSegment_2((RSegment_2&)s) // does the handle stuff
98  {}
99 
100  Segment_2(const CGAL::Point_2<R> &sp, const CGAL::Point_2<R> &ep)
101  : RSegment_2(sp,ep)
102  {}
103 
104 
105  // conversion from implementation class object to interface class object
107  : RSegment_2(s) // does the handle stuff
108  {}
109 
110 
111  bool is_horizontal() const
112  { return RSegment_2::is_horizontal(); }
113 
114  bool is_vertical() const
115  { return RSegment_2::is_vertical(); }
116 
117  bool has_on(const CGAL::Point_2<R> &p) const
118  { return RSegment_2::has_on(p); }
119 
120  bool collinear_has_on(const CGAL::Point_2<R> &p) const
121  { return RSegment_2::collinear_has_on(p); }
122 
123 
124  bool operator==(const CGAL::Segment_2<R> &s) const
125  { return RSegment_2::operator==(s); }
126 
127  bool operator!=(const CGAL::Segment_2<R> &s) const
128  { return !(*this == s); }
129 
130  CGAL::Point_2<R> start() const
131  { return RSegment_2::start(); }
132 
133  CGAL::Point_2<R> end() const
134  { return RSegment_2::end(); }
135 
136  CGAL::Point_2<R> source() const
137  { return RSegment_2::source(); }
138 
139  CGAL::Point_2<R> target() const
140  { return RSegment_2::target(); }
141 
142  CGAL::Point_2<R> min() const
143  { return RSegment_2::min(); }
144 
145  CGAL::Point_2<R> max() const
146  { return RSegment_2::max(); }
147 
148  CGAL::Point_2<R> vertex(int i) const
149  { return RSegment_2::vertex(i); }
150 
151  CGAL::Point_2<R> point(int i) const
152  { return RSegment_2::vertex(i); }
153 
154  CGAL::Point_2<R> operator[](int i) const
155  { return vertex(i); }
156 
158  { return RSegment_2::squared_length(); }
159 
160  CGAL::Direction_2<R> direction() const
161  { return RSegment_2::direction(); }
162 
163  CGAL::Segment_2<R> opposite() const
164  { return CGAL::Segment_2<R>(target(),source()); }
165 
166  // this makes use of the constructor of the interface class
167  // taking an object of the implemetation class as argument.
168 
169  CGAL::Segment_2<R> transform(const CGAL::Aff_transformation_2<R> &t) const
170  { return RSegment_2::transform(t); }
171 
172 
173  CGAL::Line_2<R> supporting_line() const
174  { return RSegment_2::supporting_line(); }
175 
176  bool is_degenerate() const
177  { return RSegment_2::is_degenerate(); }
178 
179  Bbox_2 bbox() const
180  { return source().bbox() + target().bbox(); }
181 
182 };
183 
184 #ifndef NO_OSTREAM_INSERT_SEGMENT_2
185 template < class R>
186 std::ostream &
187 operator<<(std::ostream &os, const Segment_2<R> &s)
188 {
189  typedef typename R::Segment_2_base RSegment_2;
190  return os << (const RSegment_2&)s;
191 }
192 #endif // NO_OSTREAM_INSERT_SEGMENT_2
193 
194 #ifndef NO_ISTREAM_EXTRACT_SEGMENT_2
195 template < class R>
196 std::istream &
197 operator>>(std::istream &is, Segment_2<R> &s)
198 {
199  typedef typename R::Segment_2_base RSegment_2;
200  return is >> (RSegment_2&)s;
201 }
202 #endif // NO_ISTREAM_EXTRACT_SEGMENT_2
203 
205 
206 
207 #endif // CGAL_SEGMENT_2_H
FT squared_length() const
Definition: Segment_2.h:157
CGAL::Direction_2< R > direction() const
Definition: Segment_2.h:160
CGAL_END_NAMESPACE CGAL_BEGIN_NAMESPACE bool operator==(const Origin &o, const Point_2< R > &p)
Definition: Point_2.h:239
bool collinear_has_on(const CGAL::Point_2< R > &p) const
Definition: Segment_2.h:120
CGAL::Point_2< R > operator[](int i) const
Definition: Segment_2.h:154
CGAL::Line_2< R > supporting_line() const
Definition: Segment_2.h:173
double s
Definition: blastest.C:80
CGAL::Point_2< R > max() const
Definition: Segment_2.h:145
CGAL::Segment_2< R > opposite() const
Definition: Segment_2.h:163
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
CGAL::Point_2< R > min() const
Definition: Segment_2.h:142
CGAL::Point_2< R > target() const
Definition: Segment_2.h:139
CGAL::Point_2< R > vertex(int i) const
Definition: Segment_2.h:148
bool is_vertical() const
Definition: Segment_2.h:114
Segment_2(const CGAL::Segment_2< R > &s)
Definition: Segment_2.h:96
blockLoc i
Definition: read.cpp:79
R::Segment_2_base RSegment_2
Definition: Segment_2.h:87
Segment_2(const CGAL::Point_2< R > &sp, const CGAL::Point_2< R > &ep)
Definition: Segment_2.h:100
CGAL::Point_2< R > source() const
Definition: Segment_2.h:136
Segment_2()
Definition: Segment_2.h:89
bool operator==(const CGAL::Segment_2< R > &s) const
Definition: Segment_2.h:124
CGAL::Point_2< R > point(int i) const
Definition: Segment_2.h:151
bool is_horizontal() const
Definition: Segment_2.h:111
R::FT FT
Definition: Segment_2.h:86
CGAL::Segment_2< R > transform(const CGAL::Aff_transformation_2< R > &t) const
Definition: Segment_2.h:169
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
CGAL::Point_2< R > end() const
Definition: Segment_2.h:133
bool has_on(const CGAL::Point_2< R > &p) const
Definition: Segment_2.h:117
R::RT RT
Definition: Segment_2.h:85
Segment_2(const RSegment_2 &s)
Definition: Segment_2.h:106
#define CGAL_BEGIN_NAMESPACE
Definition: kdtree_d.h:86
Bbox_2 bbox() const
Definition: Segment_2.h:179
std::istream & operator>>(std::istream &is, CGAL::Aff_transformation_2< R > &t)
#define CGAL_END_NAMESPACE
Definition: kdtree_d.h:87
CGAL::Point_2< R > start() const
Definition: Segment_2.h:130
bool operator!=(const CGAL::Segment_2< R > &s) const
Definition: Segment_2.h:127
~Segment_2()
Definition: Segment_2.h:93
bool is_degenerate() const
Definition: Segment_2.h:176