HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Vec2.h
Go to the documentation of this file.
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3 
4 #ifndef OPENVDB_MATH_VEC2_HAS_BEEN_INCLUDED
5 #define OPENVDB_MATH_VEC2_HAS_BEEN_INCLUDED
6 
7 #include <openvdb/Exceptions.h>
8 #include "Math.h"
9 #include "Tuple.h"
10 #include <algorithm>
11 #include <cmath>
12 #include <type_traits>
13 
14 
15 namespace openvdb {
17 namespace OPENVDB_VERSION_NAME {
18 namespace math {
19 
20 template<typename T> class Mat2;
21 
22 template<typename T>
23 class Vec2: public Tuple<2, T>
24 {
25 public:
26  using value_type = T;
27  using ValueType = T;
28 
29  /// Trivial constructor, the vector is NOT initialized
30  Vec2() {}
31 
32  /// @brief Construct a vector all of whose components have the given value.
33  explicit Vec2(T val) { this->mm[0] = this->mm[1] = val; }
34 
35  /// Constructor with two arguments, e.g. Vec2f v(1,2,3);
36  Vec2(T x, T y)
37  {
38  this->mm[0] = x;
39  this->mm[1] = y;
40  }
41 
42  /// Constructor with array argument, e.g. float a[2]; Vec2f v(a);
43  template <typename Source>
44  Vec2(Source *a)
45  {
46  this->mm[0] = static_cast<T>(a[0]);
47  this->mm[1] = static_cast<T>(a[1]);
48  } // trivial
49 
50  /// Conversion constructor
51  template<typename Source>
52  explicit Vec2(const Tuple<2, Source> &t)
53  {
54  this->mm[0] = static_cast<T>(t[0]);
55  this->mm[1] = static_cast<T>(t[1]);
56  }
57 
58  /// @brief Construct a vector all of whose components have the given value,
59  /// which may be of an arithmetic type different from this vector's value type.
60  /// @details Type conversion warnings are suppressed.
61  template<typename Other>
62  explicit Vec2(Other val,
63  typename std::enable_if<std::is_arithmetic<Other>::value, Conversion>::type = Conversion{})
64  {
65  this->mm[0] = this->mm[1] = static_cast<T>(val);
66  }
67 
68  /// Reference to the component, e.g. v.x() = 4.5f;
69  T& x() {return this->mm[0];}
70  T& y() {return this->mm[1];}
71 
72  /// Get the component, e.g. float f = v.y();
73  T x() const {return this->mm[0];}
74  T y() const {return this->mm[1];}
75 
76  /// Alternative indexed reference to the elements
77  T& operator()(int i) {return this->mm[i];}
78 
79  /// Alternative indexed constant reference to the elements,
80  T operator()(int i) const {return this->mm[i];}
81 
82  T* asPointer() {return this->mm;}
83  const T* asPointer() const {return this->mm;}
84 
85  /// "this" vector gets initialized to [x, y, z],
86  /// calling v.init(); has same effect as calling v = Vec2::zero();
87  const Vec2<T>& init(T x=0, T y=0)
88  {
89  this->mm[0] = x; this->mm[1] = y;
90  return *this;
91  }
92 
93  /// Set "this" vector to zero
94  const Vec2<T>& setZero()
95  {
96  this->mm[0] = 0; this->mm[1] = 0;
97  return *this;
98  }
99 
100  /// Assignment operator
101  template<typename Source>
103  {
104  // note: don't static_cast because that suppresses warnings
105  this->mm[0] = v[0];
106  this->mm[1] = v[1];
107 
108  return *this;
109  }
110 
111  /// Equality operator, does exact floating point comparisons
112  bool operator==(const Vec2<T> &v) const
113  {
114  return (isExactlyEqual(this->mm[0], v.mm[0]) && isExactlyEqual(this->mm[1], v.mm[1]));
115  }
116 
117  /// Inequality operator, does exact floating point comparisons
118  bool operator!=(const Vec2<T> &v) const { return !(*this==v); }
119 
120  /// Test if "this" vector is equivalent to vector v with tolerance of eps
121  bool eq(const Vec2<T> &v, T eps = static_cast<T>(1.0e-7)) const
122  {
123  return isApproxEqual(this->mm[0], v.mm[0], eps) &&
124  isApproxEqual(this->mm[1], v.mm[1], eps);
125  } // trivial
126 
127  /// Negation operator, for e.g. v1 = -v2;
128  Vec2<T> operator-() const {return Vec2<T>(-this->mm[0], -this->mm[1]);}
129 
130  /// this = v1 + v2
131  /// "this", v1 and v2 need not be distinct objects, e.g. v.add(v1,v);
132  template <typename T0, typename T1>
133  const Vec2<T>& add(const Vec2<T0> &v1, const Vec2<T1> &v2)
134  {
135  this->mm[0] = v1[0] + v2[0];
136  this->mm[1] = v1[1] + v2[1];
137 
138  return *this;
139  }
140 
141  /// this = v1 - v2
142  /// "this", v1 and v2 need not be distinct objects, e.g. v.sub(v1,v);
143  template <typename T0, typename T1>
144  const Vec2<T>& sub(const Vec2<T0> &v1, const Vec2<T1> &v2)
145  {
146  this->mm[0] = v1[0] - v2[0];
147  this->mm[1] = v1[1] - v2[1];
148 
149  return *this;
150  }
151 
152  /// this = scalar*v, v need not be a distinct object from "this",
153  /// e.g. v.scale(1.5,v1);
154  template <typename T0, typename T1>
155  const Vec2<T>& scale(T0 scalar, const Vec2<T1> &v)
156  {
157  this->mm[0] = scalar * v[0];
158  this->mm[1] = scalar * v[1];
159 
160  return *this;
161  }
162 
163  template <typename T0, typename T1>
164  const Vec2<T> &div(T0 scalar, const Vec2<T1> &v)
165  {
166  this->mm[0] = v[0] / scalar;
167  this->mm[1] = v[1] / scalar;
168 
169  return *this;
170  }
171 
172  /// Dot product
173  T dot(const Vec2<T> &v) const { return this->mm[0]*v[0] + this->mm[1]*v[1]; } // trivial
174 
175  /// Length of the vector
176  T length() const
177  {
178  return static_cast<T>(sqrt(double(this->mm[0]*this->mm[0] + this->mm[1]*this->mm[1])));
179  }
180 
181  /// Squared length of the vector, much faster than length() as it
182  /// does not involve square root
183  T lengthSqr() const { return (this->mm[0]*this->mm[0] + this->mm[1]*this->mm[1]); }
184 
185  /// Return a reference to itsef after the exponent has been
186  /// applied to all the vector components.
187  inline const Vec2<T>& exp()
188  {
189  this->mm[0] = std::exp(this->mm[0]);
190  this->mm[1] = std::exp(this->mm[1]);
191  return *this;
192  }
193 
194  /// Return a reference to itself after log has been
195  /// applied to all the vector components.
196  inline const Vec2<T>& log()
197  {
198  this->mm[0] = std::log(this->mm[0]);
199  this->mm[1] = std::log(this->mm[1]);
200  return *this;
201  }
202 
203  /// Return the sum of all the vector components.
204  inline T sum() const
205  {
206  return this->mm[0] + this->mm[1];
207  }
208 
209  /// Return the product of all the vector components.
210  inline T product() const
211  {
212  return this->mm[0] * this->mm[1];
213  }
214 
215  /// this = normalized this
216  bool normalize(T eps = static_cast<T>(1.0e-8))
217  {
218  T d = length();
219  if (isApproxEqual(d, T(0), eps)) {
220  return false;
221  }
222  *this *= (T(1) / d);
223  return true;
224  }
225 
226  /// return normalized this, throws if null vector
227  Vec2<T> unit(T eps=0) const
228  {
229  T d;
230  return unit(eps, d);
231  }
232 
233  /// return normalized this and length, throws if null vector
234  Vec2<T> unit(T eps, T& len) const
235  {
236  len = length();
237  if (isApproxEqual(len, T(0), eps)) {
238  OPENVDB_THROW(ArithmeticError, "Normalizing null 2-vector");
239  }
240  return *this / len;
241  }
242 
243  /// return normalized this, or (1, 0) if this is null vector
245  {
246  T l2 = lengthSqr();
247  return l2 ? *this/static_cast<T>(sqrt(l2)) : Vec2<T>(1,0);
248  }
249 
250  /// Multiply each element of this vector by @a scalar.
251  template <typename S>
252  const Vec2<T> &operator*=(S scalar)
253  {
254  this->mm[0] *= scalar;
255  this->mm[1] *= scalar;
256  return *this;
257  }
258 
259  /// Multiply each element of this vector by the corresponding element of the given vector.
260  template <typename S>
261  const Vec2<T> &operator*=(const Vec2<S> &v1)
262  {
263  this->mm[0] *= v1[0];
264  this->mm[1] *= v1[1];
265  return *this;
266  }
267 
268  /// Divide each element of this vector by @a scalar.
269  template <typename S>
270  const Vec2<T> &operator/=(S scalar)
271  {
272  this->mm[0] /= scalar;
273  this->mm[1] /= scalar;
274  return *this;
275  }
276 
277  /// Divide each element of this vector by the corresponding element of the given vector.
278  template <typename S>
279  const Vec2<T> &operator/=(const Vec2<S> &v1)
280  {
281  this->mm[0] /= v1[0];
282  this->mm[1] /= v1[1];
283  return *this;
284  }
285 
286  /// Add @a scalar to each element of this vector.
287  template <typename S>
288  const Vec2<T> &operator+=(S scalar)
289  {
290  this->mm[0] += scalar;
291  this->mm[1] += scalar;
292  return *this;
293  }
294 
295  /// Add each element of the given vector to the corresponding element of this vector.
296  template <typename S>
297  const Vec2<T> &operator+=(const Vec2<S> &v1)
298  {
299  this->mm[0] += v1[0];
300  this->mm[1] += v1[1];
301  return *this;
302  }
303 
304  /// Subtract @a scalar from each element of this vector.
305  template <typename S>
306  const Vec2<T> &operator-=(S scalar)
307  {
308  this->mm[0] -= scalar;
309  this->mm[1] -= scalar;
310  return *this;
311  }
312 
313  /// Subtract each element of the given vector from the corresponding element of this vector.
314  template <typename S>
315  const Vec2<T> &operator-=(const Vec2<S> &v1)
316  {
317  this->mm[0] -= v1[0];
318  this->mm[1] -= v1[1];
319  return *this;
320  }
321 
322  // Number of cols, rows, elements
323  static unsigned numRows() { return 1; }
324  static unsigned numColumns() { return 2; }
325  static unsigned numElements() { return 2; }
326 
327  /// Returns the scalar component of v in the direction of onto, onto need
328  /// not be unit. e.g float c = Vec2f::component(v1,v2);
329  T component(const Vec2<T> &onto, T eps = static_cast<T>(1.0e-8)) const
330  {
331  T l = onto.length();
332  if (isApproxEqual(l, T(0), eps)) return 0;
333 
334  return dot(onto)*(T(1)/l);
335  }
336 
337  /// Return the projection of v onto the vector, onto need not be unit
338  /// e.g. Vec2f v = Vec2f::projection(v,n);
339  Vec2<T> projection(const Vec2<T> &onto, T eps = static_cast<T>(1.0e-8)) const
340  {
341  T l = onto.lengthSqr();
342  if (isApproxEqual(l, T(0), eps)) return Vec2::zero();
343 
344  return onto*(dot(onto)*(T(1)/l));
345  }
346 
347  /// Return an arbitrary unit vector perpendicular to v
348  /// Vector v must be a unit vector
349  /// e.g. v.normalize(); Vec2f n = Vec2f::getArbPerpendicular(v);
350  Vec2<T> getArbPerpendicular() const { return Vec2<T>(-this->mm[1], this->mm[0]); }
351 
352  /// Predefined constants, e.g. Vec2f v = Vec2f::xNegAxis();
353  static Vec2<T> zero() { return Vec2<T>(0, 0); }
354  static Vec2<T> ones() { return Vec2<T>(1, 1); }
355 };
356 
357 
358 /// Multiply each element of the given vector by @a scalar and return the result.
359 template <typename S, typename T>
361 {
362  return v * scalar;
363 }
364 
365 /// Multiply each element of the given vector by @a scalar and return the result.
366 template <typename S, typename T>
368 {
370  result *= scalar;
371  return result;
372 }
373 
374 /// Multiply corresponding elements of @a v0 and @a v1 and return the result.
375 template <typename T0, typename T1>
377 {
378  Vec2<typename promote<T0, T1>::type> result(v0[0] * v1[0], v0[1] * v1[1]);
379  return result;
380 }
381 
382 /// Divide @a scalar by each element of the given vector and return the result.
383 template <typename S, typename T>
385 {
386  return Vec2<typename promote<S, T>::type>(scalar/v[0], scalar/v[1]);
387 }
388 
389 /// Divide each element of the given vector by @a scalar and return the result.
390 template <typename S, typename T>
392 {
394  result /= scalar;
395  return result;
396 }
397 
398 /// Divide corresponding elements of @a v0 and @a v1 and return the result.
399 template <typename T0, typename T1>
401 {
402  Vec2<typename promote<T0, T1>::type> result(v0[0] / v1[0], v0[1] / v1[1]);
403  return result;
404 }
405 
406 /// Add corresponding elements of @a v0 and @a v1 and return the result.
407 template <typename T0, typename T1>
409 {
411  result += v1;
412  return result;
413 }
414 
415 /// Add @a scalar to each element of the given vector and return the result.
416 template <typename S, typename T>
418 {
420  result += scalar;
421  return result;
422 }
423 
424 /// Subtract corresponding elements of @a v0 and @a v1 and return the result.
425 template <typename T0, typename T1>
427 {
429  result -= v1;
430  return result;
431 }
432 
433 /// Subtract @a scalar from each element of the given vector and return the result.
434 template <typename S, typename T>
436 {
438  result -= scalar;
439  return result;
440 }
441 
442 /// Angle between two vectors, the result is between [0, pi],
443 /// e.g. float a = Vec2f::angle(v1,v2);
444 template <typename T>
445 inline T angle(const Vec2<T> &v1, const Vec2<T> &v2)
446 {
447  T c = v1.dot(v2);
448  return acos(c);
449 }
450 
451 template <typename T>
452 inline bool
453 isApproxEqual(const Vec2<T>& a, const Vec2<T>& b)
454 {
455  return a.eq(b);
456 }
457 template <typename T>
458 inline bool
459 isApproxEqual(const Vec2<T>& a, const Vec2<T>& b, const Vec2<T>& eps)
460 {
461  return isApproxEqual(a.x(), b.x(), eps.x()) &&
462  isApproxEqual(a.y(), b.y(), eps.y());
463 }
464 
465 template<typename T>
466 inline Vec2<T>
467 Abs(const Vec2<T>& v)
468 {
469  return Vec2<T>(Abs(v[0]), Abs(v[1]));
470 }
471 
472 /// Orthonormalize vectors v1 and v2 and store back the resulting basis
473 /// e.g. Vec2f::orthonormalize(v1,v2);
474 template <typename T>
476 {
477  // If the input vectors are v0, v1, and v2, then the Gram-Schmidt
478  // orthonormalization produces vectors u0, u1, and u2 as follows,
479  //
480  // u0 = v0/|v0|
481  // u1 = (v1-(u0*v1)u0)/|v1-(u0*v1)u0|
482  //
483  // where |A| indicates length of vector A and A*B indicates dot
484  // product of vectors A and B.
485 
486  // compute u0
487  v1.normalize();
488 
489  // compute u1
490  T d0 = v1.dot(v2);
491  v2 -= v1*d0;
492  v2.normalize();
493 }
494 
495 
496 /// \remark We are switching to a more explicit name because the semantics
497 /// are different from std::min/max. In that case, the function returns a
498 /// reference to one of the objects based on a comparator. Here, we must
499 /// fabricate a new object which might not match either of the inputs.
500 
501 /// Return component-wise minimum of the two vectors.
502 template <typename T>
503 inline Vec2<T> minComponent(const Vec2<T> &v1, const Vec2<T> &v2)
504 {
505  return Vec2<T>(
506  std::min(v1.x(), v2.x()),
507  std::min(v1.y(), v2.y()));
508 }
509 
510 /// Return component-wise maximum of the two vectors.
511 template <typename T>
512 inline Vec2<T> maxComponent(const Vec2<T> &v1, const Vec2<T> &v2)
513 {
514  return Vec2<T>(
515  std::max(v1.x(), v2.x()),
516  std::max(v1.y(), v2.y()));
517 }
518 
519 /// @brief Return a vector with the exponent applied to each of
520 /// the components of the input vector.
521 template <typename T>
522 inline Vec2<T> Exp(Vec2<T> v) { return v.exp(); }
523 
524 /// @brief Return a vector with log applied to each of
525 /// the components of the input vector.
526 template <typename T>
527 inline Vec2<T> Log(Vec2<T> v) { return v.log(); }
528 
533 
534 } // namespace math
535 } // namespace OPENVDB_VERSION_NAME
536 } // namespace openvdb
537 
538 #endif // OPENVDB_MATH_VEC2_HAS_BEEN_INCLUDED
Vec2< T > minComponent(const Vec2< T > &v1, const Vec2< T > &v2)
Return component-wise minimum of the two vectors.
Definition: Vec2.h:503
bool normalize(T eps=static_cast< T >(1.0e-8))
this = normalized this
Definition: Vec2.h:216
vint4 max(const vint4 &a, const vint4 &b)
Definition: simd.h:4703
const Vec2< T > & operator-=(const Vec2< S > &v1)
Subtract each element of the given vector from the corresponding element of this vector.
Definition: Vec2.h:315
const Vec2< T > & div(T0 scalar, const Vec2< T1 > &v)
Definition: Vec2.h:164
T & x()
Reference to the component, e.g. v.x() = 4.5f;.
Definition: Vec2.h:69
Vec2< T > projection(const Vec2< T > &onto, T eps=static_cast< T >(1.0e-8)) const
Definition: Vec2.h:339
T length() const
Length of the vector.
Definition: Vec2.h:176
T component(const Vec2< T > &onto, T eps=static_cast< T >(1.0e-8)) const
Definition: Vec2.h:329
bool isExactlyEqual(const T0 &a, const T1 &b)
Return true if a is exactly equal to b.
Definition: Math.h:408
GLuint const GLfloat * val
Definition: glew.h:2794
void orthonormalize(Vec2< T > &v1, Vec2< T > &v2)
Definition: Vec2.h:475
Vec2< T > operator-() const
Negation operator, for e.g. v1 = -v2;.
Definition: Vec2.h:128
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:9477
Vec3< typename promote< T, Coord::ValueType >::type > operator-(const Vec3< T > &v0, const Coord &v1)
Allow a Coord to be subtracted from a Vec3.
Definition: Coord.h:551
vfloat4 sqrt(const vfloat4 &a)
Definition: simd.h:7231
Mat3< typename promote< T0, T1 >::type > operator*(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Multiply m0 by m1 and return the resulting matrix.
Definition: Mat3.h:618
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:166
Vec2< T > Log(Vec2< T > v)
Return a vector with log applied to each of the components of the input vector.
Definition: Vec2.h:527
Dummy class for tag dispatch of conversion constructors.
Definition: Tuple.h:22
GLdouble l
Definition: glew.h:9122
const GLdouble * v
Definition: glew.h:1391
T operator()(int i) const
Alternative indexed constant reference to the elements,.
Definition: Vec2.h:80
Vec2()
Trivial constructor, the vector is NOT initialized.
Definition: Vec2.h:30
Vec2(Other val, typename std::enable_if< std::is_arithmetic< Other >::value, Conversion >::type=Conversion{})
Construct a vector all of whose components have the given value, which may be of an arithmetic type d...
Definition: Vec2.h:62
bool operator==(const Vec2< T > &v) const
Equality operator, does exact floating point comparisons.
Definition: Vec2.h:112
bool eq(const Vec2< T > &v, T eps=static_cast< T >(1.0e-7)) const
Test if "this" vector is equivalent to vector v with tolerance of eps.
Definition: Vec2.h:121
Vec2< typename promote< S, T >::type > operator/(S scalar, const Vec2< T > &v)
Divide scalar by each element of the given vector and return the result.
Definition: Vec2.h:384
Vec2< T > getArbPerpendicular() const
Definition: Vec2.h:350
const Vec2< T > & operator+=(const Vec2< S > &v1)
Add each element of the given vector to the corresponding element of this vector. ...
Definition: Vec2.h:297
GLfloat GLfloat GLfloat v2
Definition: glew.h:1856
Vec2(T val)
Construct a vector all of whose components have the given value.
Definition: Vec2.h:33
GLint GLint GLint GLint GLint x
Definition: glew.h:1252
Coord Abs(const Coord &xyz)
Definition: Coord.h:515
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1252
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
const GLfloat * c
Definition: glew.h:16296
T product() const
Return the product of all the vector components.
Definition: Vec2.h:210
T sum() const
Return the sum of all the vector components.
Definition: Vec2.h:204
T angle(const Vec2< T > &v1, const Vec2< T > &v2)
Definition: Vec2.h:445
const Vec2< T > & operator*=(S scalar)
Multiply each element of this vector by scalar.
Definition: Vec2.h:252
T exp(const T &v)
Definition: simd.h:7377
SYS_API double acos(double x)
Definition: SYS_FPUMath.h:83
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
const Vec2< T > & operator*=(const Vec2< S > &v1)
Multiply each element of this vector by the corresponding element of the given vector.
Definition: Vec2.h:261
bool isApproxEqual(const Type &a, const Type &b)
Return true if a is equal to b to within the default floating-point comparison tolerance.
Definition: Math.h:371
T dot(const Vec2< T > &v) const
Dot product.
Definition: Vec2.h:173
GLdouble GLdouble GLdouble b
Definition: glew.h:9122
const Vec2< T > & operator=(const Vec2< Source > &v)
Assignment operator.
Definition: Vec2.h:102
T & operator()(int i)
Alternative indexed reference to the elements.
Definition: Vec2.h:77
T log(const T &v)
Definition: simd.h:7432
Vec2< T > unit(T eps, T &len) const
return normalized this and length, throws if null vector
Definition: Vec2.h:234
const Vec2< T > & init(T x=0, T y=0)
Definition: Vec2.h:87
Vec2(T x, T y)
Constructor with two arguments, e.g. Vec2f v(1,2,3);.
Definition: Vec2.h:36
const Vec2< T > & operator/=(S scalar)
Divide each element of this vector by scalar.
Definition: Vec2.h:270
const Vec2< T > & operator+=(S scalar)
Add scalar to each element of this vector.
Definition: Vec2.h:288
bool operator!=(const Vec2< T > &v) const
Inequality operator, does exact floating point comparisons.
Definition: Vec2.h:118
static Vec2< T > zero()
Predefined constants, e.g. Vec2f v = Vec2f::xNegAxis();.
Definition: Vec2.h:353
Vec2(Source *a)
Constructor with array argument, e.g. float a[2]; Vec2f v(a);.
Definition: Vec2.h:44
Vec2< T > maxComponent(const Vec2< T > &v1, const Vec2< T > &v2)
Return component-wise maximum of the two vectors.
Definition: Vec2.h:512
GLfloat v0
Definition: glew.h:1848
const Vec2< T > & setZero()
Set "this" vector to zero.
Definition: Vec2.h:94
GLuint64EXT * result
Definition: glew.h:14007
Vec3< typename promote< T, typename Coord::ValueType >::type > operator+(const Vec3< T > &v0, const Coord &v1)
Allow a Coord to be added to or subtracted from a Vec3.
Definition: Coord.h:525
const Vec2< T > & operator-=(S scalar)
Subtract scalar from each element of this vector.
Definition: Vec2.h:306
const Vec2< T > & scale(T0 scalar, const Vec2< T1 > &v)
Definition: Vec2.h:155
Vec2< T > unit(T eps=0) const
return normalized this, throws if null vector
Definition: Vec2.h:227
vint4 min(const vint4 &a, const vint4 &b)
Definition: simd.h:4694
const Vec2< T > & operator/=(const Vec2< S > &v1)
Divide each element of this vector by the corresponding element of the given vector.
Definition: Vec2.h:279
Vec2< T > unitSafe() const
return normalized this, or (1, 0) if this is null vector
Definition: Vec2.h:244
Vec2(const Tuple< 2, Source > &t)
Conversion constructor.
Definition: Vec2.h:52
T x() const
Get the component, e.g. float f = v.y();.
Definition: Vec2.h:73
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:112
GLsizei const GLfloat * value
Definition: glew.h:1849
GLdouble GLdouble t
Definition: glew.h:1398
GLfloat GLfloat v1
Definition: glew.h:1852
const Vec2< T > & sub(const Vec2< T0 > &v1, const Vec2< T1 > &v2)
Definition: Vec2.h:144
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:82
Type Exp(const Type &x)
Return ex.
Definition: Math.h:677
const Vec2< T > & add(const Vec2< T0 > &v1, const Vec2< T1 > &v2)
Definition: Vec2.h:133
GLenum GLsizei len
Definition: glew.h:7752