Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Vector_3.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_3.fw
37 // file : include/CGAL/Vector_3.h
38 // package : _3 (3.7)
39 // revision : 3.7
40 // revision_date : 16 Aug 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_3_H
52 #define CGAL_VECTOR_3_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_3_H
59 #include <CGAL/Point_3.h>
60 #endif // CGAL_POINT_3_H
61 
62 
63 #ifndef CGAL_DIRECTION_3_H
64 #include <CGAL/Direction_3.h>
65 #endif // CGAL_DIRECTION_3_H
66 
67 #ifdef VECTOR_WRAPPER
68 #ifndef VECTOR_3_RFT_WRAPPER_H
69 #include <CGAL/Vector_3_rft_wrapper.h>
70 #endif // VECTOR_3_RFT_WRAPPER_H
71 #endif // VECTOR_WRAPPER
72 
74 
75 template <class T> class Quotient;
76 template <class R_>
77 class Vector_3 : public R_::Vector_3_base
78 {
79 public:
80  typedef R_ R;
81  typedef typename R::RT RT;
82  typedef typename R::FT FT;
83  typedef typename R::Vector_3_base RVector_3;
84 
85 friend CGAL_FRIEND_INLINE
86  CGAL::Vector_3<R>
88  (const CGAL::Point_3<R>& p);
89 /*
90 friend CGAL::Vector_3<R>
91  CGAL::Direction_3<R>::vector() const;
92 */
93 
95  {}
96  Vector_3(const CGAL::Vector_3<R>& v)
97  : RVector_3( (const RVector_3& )v )
98  {}
100  {}
102  {}
103  Vector_3(const RT& x, const RT& y, const RT& z)
104  : RVector_3(x, y, z)
105  {}
106  Vector_3(const RT& x, const RT& y, const RT& z, const RT& w)
107  : RVector_3(x, y, z, w)
108  {}
109 
110  bool operator==(const CGAL::Vector_3<R>& v) const
111  { return RVector_3::operator==(v); }
112  bool operator!=(const CGAL::Vector_3<R>& v) const
113  { return !(*this == v); }
114  bool operator==(const Null_vector& v) const
115  { return RVector_3::operator==(v); }
116  bool operator!=(const Null_vector& v) const
117  { return !(*this == v); }
118  RT hx() const
119  { return RVector_3::hx(); }
120  RT hy() const
121  { return RVector_3::hy(); }
122  RT hz() const
123  { return RVector_3::hz(); }
124  RT hw() const
125  { return RVector_3::hw(); }
126  FT x() const
127  { return RVector_3::x(); }
128  FT y() const
129  { return RVector_3::y(); }
130  FT z() const
131  { return RVector_3::z(); }
132  RT homogeneous(int i) const
133  { return RVector_3::homogeneous(i); }
134  FT cartesian(int i) const
135  { return RVector_3::cartesian(i); }
136  FT operator[](int i) const
137  { return cartesian(i); }
138  int dimension() const
139  { return 3; }
140  CGAL::Vector_3<R> operator+(const CGAL::Vector_3<R>& w) const
141  { return (const RVector_3& )(*this) + (const RVector_3& )(w); }
142  CGAL::Vector_3<R> operator-(const CGAL::Vector_3<R>& w) const
143  { return (const RVector_3& )(*this) - (const RVector_3& )(w); }
144  CGAL::Vector_3<R> operator-() const
145  { return RVector_3::operator-(); }
146  FT operator*(const CGAL::Vector_3<R>& w) const
147  { return (const RVector_3& )(*this) * (const RVector_3& )(w); }
148 
149 #ifndef VECTOR_WRAPPER
150  CGAL::Vector_3<R> operator*(const RT& c) const
151  { return c * (const RVector_3& )(*this) ; }
152  CGAL::Vector_3<R> operator*(const Quotient<RT>& q) const
153  {
154  return (q.numerator() * (const RVector_3& )(*this)) /
155  q.denominator();
156  }
157  CGAL::Vector_3<R> operator/(const Quotient<RT>& q) const
158  {
159  return (q.denominator() * (const RVector_3& )(*this)) /
160  q.numerator();
161  }
162 #endif // VECTOR_WRAPPER
163 
164  CGAL::Vector_3<R> operator/(const RT& c) const
165  { return (const RVector_3& )(*this) / c; }
166  CGAL::Direction_3<R> direction() const
167  { return RVector_3::direction(); }
168  CGAL::Vector_3<R> transform(const CGAL::Aff_transformation_3<R>& t) const
169  { return RVector_3::transform(t); }
170 
171 private:
172  Vector_3(const CGAL::Point_3<R>& p) : RVector_3(p)
173  {}
174  Vector_3(const CGAL::Direction_3<R>& d) : RVector_3(d)
175  {}
176 };
177 
178 template < class R >
180 {
181  return No_number_tag();
182 }
183 
184 #ifndef NO_OSTREAM_INSERT_VECTOR_3
185 template < class R >
186 std::ostream&
187 operator<<(std::ostream& os, const Vector_3<R>& v)
188 {
189  typedef typename R::Vector_3_base RVector_3;
190  return os << (const RVector_3& )v;
191 }
192 #endif // NO_OSTREAM_INSERT_VECTOR_3
193 
194 #ifndef NO_ISTREAM_EXTRACT_VECTOR_3
195 template < class R >
196 std::istream&
197 operator>>(std::istream& is, Vector_3<R>& p)
198 {
199  typedef typename R::Vector_3_base RVector_3;
200  return is >> (RVector_3& )p;
201 }
202 #endif // NO_ISTREAM_EXTRACT_VECTOR_3
203 
204 
205 template<class R>
206 inline
209 {
210  typedef typename R::Vector_3_base RVector_3;
211  return cross_product((const RVector_3& )v,(const RVector_3& )w);
212 }
213 
215 
216 
217 #endif // CGAL_VECTOR_3_H
CGAL::Vector_3< R > operator*(const RT &c) const
Definition: Vector_3.h:150
Vector_3(const RT &x, const RT &y, const RT &z, const RT &w)
Definition: Vector_3.h:106
RT hw() const
Definition: Vector_3.h:124
bool operator==(const Null_vector &v) const
Definition: Vector_3.h:114
CGAL_END_NAMESPACE CGAL_BEGIN_NAMESPACE bool operator==(const Origin &o, const Point_2< R > &p)
Definition: Point_2.h:239
Vector_3(const RVector_3 &v)
Definition: Vector_3.h:99
R::FT FT
Definition: Vector_3.h:82
FT y() const
Definition: Vector_3.h:128
CGAL_BEGIN_NAMESPACE Vector_2< R > point_to_vector_conversion(const Point_2< R > &p)
R::Vector_3_base RVector_3
Definition: Vector_3.h:83
const NT & d
void int int REAL REAL * y
Definition: read.cpp:74
RT homogeneous(int i) const
Definition: Vector_3.h:132
Vector_3(const CGAL::Direction_3< R > &d)
Definition: Vector_3.h:174
friend CGAL_FRIEND_INLINE CGAL::Vector_3< R > point_to_vector_conversion CGAL_NULL_TMPL_ARGS(const CGAL::Point_3< R > &p)
Type z() const
Definition: mapbasic.h:65
bool operator==(const CGAL::Vector_3< R > &v) const
Definition: Vector_3.h:110
FT operator*(const CGAL::Vector_3< R > &w) const
Definition: Vector_3.h:146
Type y() const
Definition: mapbasic.h:64
Vector_3(const RT &x, const RT &y, const RT &z)
Definition: Vector_3.h:103
*********************************************************************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
R::RT RT
Definition: Vector_3.h:81
CGAL::Vector_3< R > transform(const CGAL::Aff_transformation_3< R > &t) const
Definition: Vector_3.h:168
bool operator!=(const CGAL::Vector_3< R > &v) const
Definition: Vector_3.h:112
FT z() const
Definition: Vector_3.h:130
CGAL::Vector_3< R > operator-() const
Definition: Vector_3.h:144
void int int int REAL REAL REAL * z
Definition: write.cpp:76
FT operator[](int i) const
Definition: Vector_3.h:136
VectorS3< FT > cross_product(const VectorS3< FT > &v, const VectorS3< FT > &w)
Vector_3(const Null_vector &v)
Definition: Vector_3.h:101
CGAL::Direction_3< R > direction() const
Definition: Vector_3.h:166
CGAL::Vector_3< R > operator/(const Quotient< RT > &q) const
Definition: Vector_3.h:157
FT x() const
Definition: Vector_3.h:126
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
Type x() const
Definition: mapbasic.h:63
int dimension() const
Definition: Vector_3.h:138
RT hy() const
Definition: Vector_3.h:120
FT cartesian(int i) const
Definition: Vector_3.h:134
RT hz() const
Definition: Vector_3.h:122
Vector_3(const CGAL::Point_3< R > &p)
Definition: Vector_3.h:172
CGAL::Vector_3< R > operator/(const RT &c) const
Definition: Vector_3.h:164
Vector_3(const CGAL::Vector_3< R > &v)
Definition: Vector_3.h:96
NT q
Vector_3()
Definition: Vector_3.h:94
#define CGAL_BEGIN_NAMESPACE
Definition: kdtree_d.h:86
Some basic geometric data types.
Definition: mapbasic.h:54
std::istream & operator>>(std::istream &is, CGAL::Aff_transformation_2< R > &t)
bool operator!=(const Null_vector &v) const
Definition: Vector_3.h:116
CGAL::Vector_3< R > operator*(const Quotient< RT > &q) const
Definition: Vector_3.h:152
CGAL::Vector_3< R > operator-(const CGAL::Vector_3< R > &w) const
Definition: Vector_3.h:142
R_ R
Definition: Vector_3.h:80
Number_tag number_type_tag(double)
Definition: double.h:83
#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
RT hx() const
Definition: Vector_3.h:118
CGAL::Vector_3< R > operator+(const CGAL::Vector_3< R > &w) const
Definition: Vector_3.h:140