Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Vector_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 : Vector_2.fw
37 // file : include/CGAL/Vector_2.h
38 // package : _2 (3.6)
39 // revision : 3.6
40 // revision_date : 30 Jul 2000
41 // author(s) : Andreas Fabri
42 // Stefan Schirra
43 //
44 // coordinator : MPI, Saarbruecken (<Stefan.Schirra>)
45 // email : contact@cgal.org
46 // www : http://www.cgal.org
47 //
48 // ======================================================================
49 
50 
51 #ifndef CGAL_VECTOR_2_H
52 #define CGAL_VECTOR_2_H
53 
54 #ifndef CGAL_REP_CLASS_DEFINED
55 #error no representation class defined
56 #endif // CGAL_REP_CLASS_DEFINED
57 
58 #ifndef CGAL_POINT_2_H
59 #include <CGAL/Point_2.h>
60 #endif // CGAL_POINT_2_H
61 
62 
63 #ifndef CGAL_DIRECTION_2_H
64 #include <CGAL/Direction_2.h>
65 #endif // CGAL_DIRECTION_2_H
66 
67 
68 
69 #ifdef VECTOR_WRAPPER
70 #ifndef VECTOR_2_RFT_WRAPPER_H
71 #include <CGAL/Vector_2_rft_wrapper.h>
72 #endif // VECTOR_2_RFT_WRAPPER_H
73 #endif // VECTOR_WRAPPER
74 
76 
77 template <class T> class Quotient;
78 template <class R_>
79 class Vector_2 : public R_::Vector_2_base
80 {
81 public:
82  typedef R_ R;
83  typedef typename R::RT RT;
84  typedef typename R::FT FT;
85  typedef typename R::Vector_2_base RVector_2;
86 
87 friend CGAL_FRIEND_INLINE
88  CGAL::Vector_2<R>
90  (const CGAL::Point_2<R> &p);
91 
92  Vector_2() {}
93 
94  Vector_2(const CGAL::Vector_2<R> &v) : RVector_2((const RVector_2&)v) {}
95 
96  Vector_2(const RVector_2& v) : RVector_2(v) {}
97 
98  Vector_2(const Null_vector &v) : RVector_2(v) {}
99 
100  Vector_2(const RT &x, const RT &y) : RVector_2(x,y) {}
101 
102  Vector_2(const RT &x, const RT &y, const RT &w) : RVector_2(x,y,w) {}
103 
104 
105  bool
106  operator==(const CGAL::Vector_2<R> &v) const
107  { return RVector_2::operator==(v); }
108 
109  bool
110  operator!=(const CGAL::Vector_2<R> &v) const
111  { return !(*this == v); }
112 
113  bool
114  operator==(const Null_vector &v) const
115  { return RVector_2::operator==(v); }
116 
117  bool
118  operator!=(const Null_vector &v) const
119  { return !(*this == v); }
120 
121  RT
122  hx() const
123  { return RVector_2::hx(); }
124 
125  RT
126  hy() const
127  { return RVector_2::hy(); }
128 
129  RT
130  hw() const
131  { return RVector_2::hw(); }
132 
133  FT x() const
134  { return RVector_2::x(); }
135 
136  FT y() const
137  { return RVector_2::y(); }
138 
139  RT homogeneous(int i) const
140  { return RVector_2::homogeneous(i); }
141 
142  FT
143  cartesian(int i) const
144  { return RVector_2::cartesian(i); }
145 
146  FT
147  operator[](int i) const
148  { return cartesian(i); }
149 
150  int
151  dimension() const
152  { return 2; }
153 
154  CGAL::Vector_2<R>
155  operator+(const CGAL::Vector_2<R> &w) const
156  { return (const RVector_2&)(*this) + (const RVector_2&)(w); }
157 
158  CGAL::Vector_2<R>
159  operator-(const CGAL::Vector_2<R> &w) const
160  { return (const RVector_2&)(*this) - (const RVector_2&)(w); }
161 
162  CGAL::Vector_2<R>
163  operator-() const
164  { return RVector_2::operator-(); }
165 
166  FT
167  operator*(const CGAL::Vector_2<R> &w) const
168  { return (const RVector_2&)(*this) * (const RVector_2&)(w); }
169 
170 #ifndef VECTOR_WRAPPER
171  CGAL::Vector_2<R>
172  operator*(const RT &c) const
173  { return c * (const RVector_2&)(*this); }
174 
175  CGAL::Vector_2<R>
176  operator*(const Quotient<RT> &q) const
177  { return (q.numerator() * (const RVector_2&)(*this)) / q.denominator(); }
178 
179  CGAL::Vector_2<R>
180  operator/(const Quotient<RT> &q) const
181  { return (q.denominator() * (const RVector_2&)(*this)) / q.numerator(); }
182 #endif // VECTOR_WRAPPER
183 
184  CGAL::Vector_2<R>
185  operator/(const RT &c) const
186  { return (const RVector_2&)(*this) / c; }
187 
188  CGAL::Direction_2<R>
189  direction() const
190  { return RVector_2::direction(); }
191 
192  CGAL::Vector_2<R>
193  perpendicular(const Orientation &o) const
194  { return RVector_2::perpendicular(o); }
195 
196  CGAL::Vector_2<R>
197  transform(const CGAL::Aff_transformation_2<R> &t) const
198  { return RVector_2::transform(t); }
199 
200 private:
201  Vector_2(const CGAL::Point_2<R> &p) : RVector_2(p) {}
202 
203  Vector_2(const CGAL::Direction_2<R> &d) : RVector_2(d) {}
204 };
205 
206 template < class R >
209 { return No_number_tag(); }
210 #ifndef NO_OSTREAM_INSERT_VECTOR_2
211 template < class R >
212 std::ostream &
213 operator<<(std::ostream &os, const Vector_2<R> &v)
214 {
215  typedef typename R::Vector_2_base RVector_2;
216  return os << (const RVector_2&)v;
217 }
218 #endif // NO_OSTREAM_INSERT_VECTOR_2
219 
220 #ifndef NO_ISTREAM_EXTRACT_VECTOR_2
221 template < class R >
222 std::istream &
223 operator>>(std::istream &is, Vector_2<R> &p)
224 {
225  typedef typename R::Vector_2_base RVector_2;
226  return is >> (RVector_2&)p;
227 }
228 #endif // NO_ISTREAM_EXTRACT_VECTOR_2
229 
231 
232 
233 #endif // CGAL_VECTOR_2_H
CGAL::Vector_2< R > operator*(const RT &c) const
Definition: Vector_2.h:172
R_ R
Definition: Vector_2.h:82
CGAL_END_NAMESPACE CGAL_BEGIN_NAMESPACE bool operator==(const Origin &o, const Point_2< R > &p)
Definition: Point_2.h:239
CGAL_BEGIN_NAMESPACE Vector_2< R > point_to_vector_conversion(const Point_2< R > &p)
CGAL::Vector_2< R > operator/(const Quotient< RT > &q) const
Definition: Vector_2.h:180
bool operator!=(const Null_vector &v) const
Definition: Vector_2.h:118
bool operator==(const Null_vector &v) const
Definition: Vector_2.h:114
const NT & d
void int int REAL REAL * y
Definition: read.cpp:74
R::RT RT
Definition: Vector_2.h:83
Vector_2(const RT &x, const RT &y)
Definition: Vector_2.h:100
CGAL::Vector_2< R > operator*(const Quotient< RT > &q) const
Definition: Vector_2.h:176
CGAL::Vector_2< R > operator/(const RT &c) const
Definition: Vector_2.h:185
CGAL::Vector_2< R > operator+(const CGAL::Vector_2< R > &w) const
Definition: Vector_2.h:155
CGAL::Vector_2< R > operator-() const
Definition: Vector_2.h:163
FT x() const
Definition: Vector_2.h:133
Type x() const
Definition: mapbasic.h:208
bool operator==(const CGAL::Vector_2< R > &v) const
Definition: Vector_2.h:106
friend CGAL_FRIEND_INLINE CGAL::Vector_2< R > CGAL_SCOPE point_to_vector_conversion CGAL_NULL_TMPL_ARGS(const CGAL::Point_2< R > &p)
FT y() const
Definition: Vector_2.h:136
Type y() const
Definition: mapbasic.h:209
#define CGAL_SCOPE
Definition: config.h:70
Vector_2(const CGAL::Vector_2< R > &v)
Definition: Vector_2.h:94
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
Sign
Definition: enum.h:57
R::Vector_2_base RVector_2
Definition: Vector_2.h:85
R::FT FT
Definition: Vector_2.h:84
RT hy() const
Definition: Vector_2.h:126
Vector_2()
Definition: Vector_2.h:92
FT operator*(const CGAL::Vector_2< R > &w) const
Definition: Vector_2.h:167
RT homogeneous(int i) const
Definition: Vector_2.h:139
blockLoc i
Definition: read.cpp:79
FT operator[](int i) const
Definition: Vector_2.h:147
Vector_2(const RT &x, const RT &y, const RT &w)
Definition: Vector_2.h:102
void int int REAL * x
Definition: read.cpp:74
CGAL::Vector_2< R > operator-(const CGAL::Vector_2< R > &w) const
Definition: Vector_2.h:159
CGAL::Direction_2< R > direction() const
Definition: Vector_2.h:189
CGAL::Vector_2< R > perpendicular(const Orientation &o) const
Definition: Vector_2.h:193
int dimension() const
Definition: Vector_2.h:151
RT hx() const
Definition: Vector_2.h:122
CGAL::Vector_2< R > transform(const CGAL::Aff_transformation_2< R > &t) const
Definition: Vector_2.h:197
bool operator!=(const CGAL::Vector_2< R > &v) const
Definition: Vector_2.h:110
Vector_2(const RVector_2 &v)
Definition: Vector_2.h:96
NT q
Vector_2(const CGAL::Direction_2< R > &d)
Definition: Vector_2.h:203
RT hw() const
Definition: Vector_2.h:130
#define CGAL_BEGIN_NAMESPACE
Definition: kdtree_d.h:86
std::istream & operator>>(std::istream &is, CGAL::Aff_transformation_2< R > &t)
Number_tag number_type_tag(double)
Definition: double.h:83
FT cartesian(int i) const
Definition: Vector_2.h:143
#define CGAL_END_NAMESPACE
Definition: kdtree_d.h:87
Point_2< R > operator-(const Origin &o, const Vector_2< R > &v)
#define CGAL_FRIEND_INLINE
Definition: kernel_basic.h:61
Vector_2(const CGAL::Point_2< R > &p)
Definition: Vector_2.h:201
Vector_2(const Null_vector &v)
Definition: Vector_2.h:98