HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_Vector2.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_Vector2.h (C++)
7  *
8  *
9  * COMMENTS:
10  * This class handles fpreal vectors of dimension 2.
11  *
12  * WARNING:
13  * This class should NOT contain any virtual methods, nor should it
14  * define more member data. The size of UT_VectorF2 must always be
15  * 8 bytes (2 floats).
16  */
17 
18 #pragma once
19 
20 #ifndef __UT_Vector2_h__
21 #define __UT_Vector2_h__
22 
23 #include "UT_API.h"
24 #include "UT_Assert.h"
25 #include "UT_FixedVector.h"
26 #include "UT_VectorTypes.h"
27 #include <SYS/SYS_Math.h>
28 #include <SYS/SYS_Inline.h>
29 #include <iosfwd>
30 #include <limits>
31 
32 class UT_IStream;
33 class UT_JSONWriter;
34 class UT_JSONValue;
35 class UT_JSONParser;
36 
37 // Free floating functions:
38 
39 // Operators that involve a UT_Vector2 object:
40 template <typename T>
42 template <typename T>
44 template <typename T>
45 inline bool operator<(const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2);
46 template <typename T>
47 inline bool operator<=(const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2);
48 template <typename T>
49 inline bool operator>(const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2);
50 template <typename T>
51 inline bool operator>=(const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2);
52 template <typename T, typename S>
53 inline UT_Vector2T<T> operator+(const UT_Vector2T<T> &v, S scalar);
54 template <typename T, typename S>
55 inline UT_Vector2T<T> operator-(const UT_Vector2T<T> &v, S scalar);
56 template <typename T, typename S>
57 inline UT_Vector2T<T> operator*(const UT_Vector2T<T> &v, S scalar);
58 template <typename T, typename S>
59 inline UT_Vector2T<T> operator/(const UT_Vector2T<T> &v, S scalar);
60 template <typename T, typename S>
61 inline UT_Vector2T<T> operator+(S scalar, const UT_Vector2T<T> &v);
62 template <typename T, typename S>
63 inline UT_Vector2T<T> operator-(S scalar, const UT_Vector2T<T> &v);
64 template <typename T, typename S>
65 inline UT_Vector2T<T> operator*(S scalar, const UT_Vector2T<T> &v);
66 template <typename T, typename S>
67 inline UT_Vector2T<T> operator/(S scalar, const UT_Vector2T<T> &v);
68 template <typename T, typename S>
70  const UT_Matrix2T<S> &mat);
71 
72 /// The dot product
73 template <typename T>
74 inline T dot (const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2);
75 /// Cross product, which for 2d vectors results in a fpreal.
76 template <typename T>
77 inline T cross (const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2);
78 
79 /// Componentwise min and maximum
80 template <typename T>
81 inline UT_Vector2T<T> SYSmin (const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2);
82 template <typename T>
83 inline UT_Vector2T<T> SYSmax (const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2);
84 /// Componentwise linear interpolation
85 template <typename T,typename S>
86 inline UT_Vector2T<T> SYSlerp(const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2, S t);
87 template <typename T,typename S>
88 inline UT_Vector2T<T> SYSbilerp(const UT_Vector2T<T> &u0v0, const UT_Vector2T<T> &u1v0,
89  const UT_Vector2T<T> &u0v1, const UT_Vector2T<T> &u1v1,
90  S u, S v)
91 { return SYSlerp(SYSlerp(u0v0, u0v1, v), SYSlerp(u1v0, u1v1, v), u); }
92 
93 /// The orthogonal projection of a vector u onto a vector v
94 template <typename T>
95 inline UT_Vector2T<T> project (const UT_Vector2T<T> &u, const UT_Vector2T<T> &v);
96 
97 /// Multiplication of a row or column vector by a matrix (ie. right vs. left
98 /// multiplication respectively). The operator*() declared above is an alias
99 /// for rowVecMult().
100 // @{
101 //
102 // Notes on optimisation of matrix/vector multiplies:
103 // - multiply(dest, mat) functions have been deprecated in favour of
104 // rowVecMult/colVecMult routines, which produce temporaries. For these to
105 // offer comparable performance, the compiler has to optimize away the
106 // temporary, but most modern compilers can do this. Performance tests with
107 // gcc3.3 indicate that this is a realistic expectation for modern
108 // compilers.
109 // - since matrix/vector multiplies cannot be done without temporary data,
110 // the "primary" functions are the global matrix/vector
111 // rowVecMult/colVecMult routines, rather than the member functions.
112 
113 template <typename T, typename S>
115  const UT_Matrix2T<S> &m);
116 template <typename T, typename S>
117 inline UT_Vector2T<T> colVecMult(const UT_Matrix2T<S> &m,
118  const UT_Vector2T<T> &v);
119 // @}
120 
121 template <typename T>
122 inline T distance2d(const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2);
123 
124 /// Given a 2D position, input, and a 2D quad, (p0, p0+du, p0+du+dv+duv, p0+dv),
125 /// finds the 0, 1, or 2 locations in the parameter space of that quad that correspond
126 /// with the input position. Only parameter locations approximately between 0 and 1
127 /// are accepted. The return value is the number of accepted parameter locations.
128 template <typename T>
129 int UTinverseBilerp(const UT_Vector2T<T> &input,
130  const UT_Vector2T<T> &p0,
131  const UT_Vector2T<T> &du, const UT_Vector2T<T> &dv,
132  const UT_Vector2T<T> &duv,
133  UT_Vector2T<T> outputs[2]);
134 
135 /// 2D Vector class.
136 template <typename T>
137 class UT_API UT_Vector2T : public UT_FixedVector<T,2,true>
138 {
139 public:
141 
142  // These "using" statements are needed for operator= and operator*=
143  // so that the ones in UT_FixedVector aren't hidden by the additional
144  // ones here.
145  using Base::operator=;
146  using Base::operator*=;
147 
148  // These "using" statements are needed for GCC and Clang, because
149  // otherwise, they ignore all members of UT_FixedVector when
150  // checking validity of code in functions in this class.
151  using Base::vec;
152  using Base::data;
153  using Base::length2;
154  typedef T value_type;
155  static const int tuple_size = 2;
156 
157  /// Default constructor.
158  /// No data is initialized! Use it for extra speed.
159  SYS_FORCE_INLINE UT_Vector2T() = default;
160 
161  SYS_FORCE_INLINE UT_Vector2T(const UT_Vector2T<T> &that) = default;
162  SYS_FORCE_INLINE UT_Vector2T(UT_Vector2T<T> &&that) = default;
163 
165  {
166  vec[0] = v;
167  vec[1] = v;
168  }
169 
171  {
172  vec[0] = vx;
173  vec[1] = vy;
174  }
175  explicit SYS_FORCE_INLINE UT_Vector2T(const fpreal16 v[tuple_size])
176  : Base(v)
177  {}
178  explicit SYS_FORCE_INLINE UT_Vector2T(const fpreal32 v[tuple_size])
179  : Base(v)
180  {}
181  explicit SYS_FORCE_INLINE UT_Vector2T(const fpreal64 v[tuple_size])
182  : Base(v)
183  {}
184  explicit SYS_FORCE_INLINE UT_Vector2T(const int32 v[tuple_size])
185  : Base(v)
186  {}
187  explicit SYS_FORCE_INLINE UT_Vector2T(const int64 v[tuple_size])
188  : Base(v)
189  {}
190  explicit UT_Vector2T(const UT_Vector3T<T> &v);
191  explicit UT_Vector2T(const UT_Vector4T<T> &v);
192 
193  /// Our own type of any given value_type.
194  template <typename S>
196  : Base(v)
197  {}
198 
199  /// Arbitrary UT_FixedVector of the same size
200  template <typename S,bool S_INSTANTIATED>
202  : Base(v)
203  {}
204 
207 
208  template <typename S>
210  { vec[0] = v.x(); vec[1] = v.y(); return *this; }
211 
212  // TODO: remove these. They should require an explicit UT_Vector2()
213  // construction, since they're unsafe.
214 
215  /// Assignment operator that truncates a V3 to a V2.
217  /// Assignment operator that truncates a V4 to a V2.
219 
220  /// It's unclear why this is needed, given UT_FixedVector::operator-(),
221  /// but the compiler seems not to accept not having it.
223  {
224  return UT_Vector2T<T>(-vec[0], -vec[1]);
225  }
227  {
228  vec[0] *= v.vec[0];
229  vec[1] *= v.vec[1];
230  }
231 
232  /// Given an oriented line from e1 passing through e2, determine on which
233  /// side of the line the point p lies. Alternatively, determine in which
234  /// half plane, positive or negative, the point lies. If the segment
235  /// degenerates to a point, then the point is always on it.
236  // (Moret and Shapiro 1991)
237  T whichSide(const UT_Vector2T<T> &e1, const UT_Vector2T<T> &e2) const
238  {
239  return (vec[0] - e1.vec[0]) * (e2.vec[1] - e1.vec[1]) -
240  (vec[1] - e1.vec[1]) * (e2.vec[0] - e1.vec[0]);
241  }
242 
243  template <typename S>
245  { return operator=(*this * mat); }
246 
247  /// These allow you to find out what indices to use for different axes
248  // @{
249  int findMinAbsAxis() const
250  {
251  if (SYSabs(x()) < SYSabs(y()))
252  return 0;
253  else
254  return 1;
255  }
256  int findMaxAbsAxis() const
257  {
258  if (SYSabs(x()) >= SYSabs(y()))
259  return 0;
260  else
261  return 1;
262  }
263  // @}
264 
265  /// Calculates the orthogonal projection of a vector u on the *this vector
266  UT_Vector2T<T> project(const UT_Vector2T<T> &u) const;
267 
268 
269  /// Vector p (representing a point in 2-space) and vector v define
270  /// a line. This member returns the projection of "this" onto the
271  /// line (the point on the line that is closest to this point).
272  UT_Vector2T<T> projection(const UT_Vector2T<T> &p, const UT_Vector2T<T> &v) const;
273 
274  /// Compute (homogeneous) barycentric co-ordinates of this point
275  /// relative to the triangle defined by t0, t1 and t2. (The point is
276  /// projected into the triangle's plane.)
277  UT_Vector3T<T> getBary(const UT_Vector2T<T> &t0, const UT_Vector2T<T> &t1,
278  const UT_Vector2T<T> &t2, bool *degen = NULL) const;
279 
280 
281  /// Return the components of the vector. The () operator does NOT check
282  /// for the boundary condition.
283  // @{
284  T &x(void) { return vec[0]; }
285  T x(void) const { return vec[0]; }
286  T &y(void) { return vec[1]; }
287  T y(void) const { return vec[1]; }
288  T &operator()(unsigned i)
289  {
290  UT_ASSERT_P(i < tuple_size);
291  return vec[i];
292  }
293  T operator()(unsigned i) const
294  {
295  UT_ASSERT_P(i < tuple_size);
296  return vec[i];
297  }
298  // @}
299 
300  /// Compute a hash
301  unsigned hash() const { return SYSvector_hash(data(), tuple_size); }
302 
303  // TODO: eliminate these methods. They're redundant, given good inline
304  // constructors.
305  /// Set the values of the vector components
306  void assign(T xx = 0.0f, T yy = 0.0f)
307  {
308  vec[0] = xx; vec[1] = yy;
309  }
310  /// Set the values of the vector components
311  void assign(const T *v) {vec[0]=v[0]; vec[1]=v[1];}
312 
313  /// Express the point in homogeneous coordinates or vice-versa
314  // @{
315  void homogenize (void) { vec[0] *= vec[1]; }
316  void dehomogenize(void) { if (vec[1] != 0) vec[0] /= vec[1]; }
317  // @}
318 
319  /// Protected I/O methods
320  // @{
321  void save(std::ostream &os, int binary = 0) const;
322  bool load(UT_IStream &is);
323  // @}
324 
325  /// @{
326  /// Methods to serialize to a JSON stream. The vector is stored as an
327  /// array of 2 reals.
328  bool save(UT_JSONWriter &w) const;
329  bool save(UT_JSONValue &v) const;
330  bool load(UT_JSONParser &p);
331  /// @}
332 
333  /// Returns the vector size
334  static int entries() { return tuple_size; }
335 
336 private:
337  /// I/O friends
338  // @{
339  friend std::ostream &operator<<(std::ostream &os, const UT_Vector2T<T> &v)
340  {
341  v.save(os);
342  return os;
343  }
344  // @}
345 };
346 
347 #include "UT_Matrix2.h"
348 
349 // Free floating functions:
350 template <typename T>
352 {
353  return UT_Vector2T<T>(v1.x()+v2.x(), v1.y()+v2.y());
354 }
355 template <typename T>
357 {
358  return UT_Vector2T<T>(v1.x()-v2.x(), v1.y()-v2.y());
359 }
360 template <typename T>
362 {
363  return UT_Vector2T<T>(v1.x()*v2.x(), v1.y()*v2.y());
364 }
365 template <typename T>
367 {
368  return UT_Vector2T<T>(v1.x()/v2.x(), v1.y()/v2.y());
369 }
370 template <typename T>
371 inline bool operator<(const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2)
372 {
373  return ((v1.x() < v2.x()) || (v1.x() == v2.x() && v1.y() < v2.y()));
374 }
375 template <typename T>
376 inline bool operator<=(const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2)
377 {
378  return (v1 < v2) || (v1 == v2);
379 }
380 template <typename T>
381 inline bool operator>(const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2)
382 {
383  return v2 < v1;
384 }
385 template <typename T>
386 inline bool operator>=(const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2)
387 {
388  return v2 <= v1;
389 }
390 template <typename T, typename S>
391 inline UT_Vector2T<T> operator+(const UT_Vector2T<T> &v, S scalar)
392 {
393  return UT_Vector2T<T>(v.x()+scalar, v.y()+scalar);
394 }
395 template <typename T, typename S>
396 inline UT_Vector2T<T> operator+(S scalar, const UT_Vector2T<T> &v)
397 {
398  return UT_Vector2T<T>(v.x()+scalar, v.y()+scalar);
399 }
400 template <typename T, typename S>
401 inline UT_Vector2T<T> operator-(const UT_Vector2T<T> &v, S scalar)
402 {
403  return UT_Vector2T<T>(v.x()-scalar, v.y()-scalar);
404 }
405 template <typename T, typename S>
406 inline UT_Vector2T<T> operator-(S scalar, const UT_Vector2T<T> &v)
407 {
408  return UT_Vector2T<T>(scalar-v.x(), scalar-v.y());
409 }
410 template <typename T, typename S>
411 inline UT_Vector2T<T> operator*(const UT_Vector2T<T> &v, S scalar)
412 {
413  return UT_Vector2T<T>(v.x()*scalar, v.y()*scalar);
414 }
415 template <typename T, typename S>
416 inline UT_Vector2T<T> operator*(S scalar, const UT_Vector2T<T> &v)
417 {
418  return UT_Vector2T<T>(v.x()*scalar, v.y()*scalar);
419 }
420 template <typename T, typename S>
421 inline UT_Vector2T<T> operator/(const UT_Vector2T<T> &v, S scalar)
422 {
423  return UT_Vector2T<T>(v.x()/scalar, v.y()/scalar);
424 }
425 template <typename T, typename S>
426 inline UT_Vector2T<T> operator/(S scalar, const UT_Vector2T<T> &v)
427 {
428  return UT_Vector2T<T>(scalar/v.x(), scalar/v.y());
429 }
430 template <typename T>
431 inline T dot(const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2)
432 {
433  return v1.x()*v2.x() + v1.y()*v2.y();
434 }
435 template <typename T>
436 inline T cross(const UT_Vector2T<T> &v1, const UT_Vector2T<T> &v2)
437 {
438  return v1.x() * v2.y() - v1.y() * v2.x();
439 }
440 template <typename T>
441 inline
443 {
444  return UT_Vector2T<T>(
445  SYSmin(v1.x(), v2.x()),
446  SYSmin(v1.y(), v2.y())
447  );
448 }
449 
450 template <typename T>
451 inline
453 {
454  return UT_Vector2T<T>(
455  SYSmax(v1.x(), v2.x()),
456  SYSmax(v1.y(), v2.y())
457  );
458 }
459 
460 template <typename T,typename S>
461 inline
463 {
464  return UT_Vector2T<T>(
465  SYSlerp(v1.x(), v2.x(), t),
466  SYSlerp(v1.y(), v2.y(), t));
467 }
468 
469 template <typename T>
471 {
472  return dot(u, v) / v.length2() * v;
473 }
474 template <typename T, typename S>
476 {
477  return UT_Vector2T<T>(v.x()*m(0,0) + v.y()*m(1,0),
478  v.x()*m(0,1) + v.y()*m(1,1));
479 }
480 template <typename T, typename S>
482 {
483  return UT_Vector2T<T>(m(0,0)*v.x() + m(0,1)*v.y(),
484  m(1,0)*v.x() + m(1,1)*v.y());
485 }
486 template <typename T, typename S>
488 {
489  return rowVecMult(v, m);
490 }
491 template <typename T>
493 {
494  return (v1 - v2).length();
495 }
496 
497 template <typename T>
498 inline size_t hash_value(const UT_Vector2T<T> &val)
499 {
500  return val.hash();
501 }
502 
503 // Overload for custom formatting of UT_Vector2T<T> with UTformat.
504 template<typename T>
505 UT_API size_t format(char *buffer, size_t buffer_size, const UT_Vector2T<T> &v);
506 
507 
508 template<typename T>
510 {
512  typedef T DataType;
513  static const exint TupleSize = 2;
514  static const bool isVectorType = true;
515 };
516 
517 #endif
T x(void) const
Definition: UT_Vector2.h:285
SYS_FORCE_INLINE constexpr const T * data() const noexcept
Mat3< typename promote< S, T >::type > operator*(S scalar, const Mat3< T > &m)
Returns M, where for .
Definition: Mat3.h:615
SYS_FORCE_INLINE UT_Vector2T(const fpreal16 v[tuple_size])
Definition: UT_Vector2.h:175
class UT_API UT_Vector2T
SYS_FORCE_INLINE UT_Vector2T(T vx, T vy)
Definition: UT_Vector2.h:170
UT_FixedVector< T, 2 > FixedVectorType
Definition: UT_Vector2.h:511
T & operator()(unsigned i)
Definition: UT_Vector2.h:288
UT_Vector2T< T > rowVecMult(const UT_Vector2T< T > &v, const UT_Matrix2T< S > &m)
Definition: UT_Vector2.h:475
static int entries()
Returns the vector size.
Definition: UT_Vector2.h:334
int findMinAbsAxis() const
These allow you to find out what indices to use for different axes.
Definition: UT_Vector2.h:249
T whichSide(const UT_Vector2T< T > &e1, const UT_Vector2T< T > &e2) const
Definition: UT_Vector2.h:237
SYS_FORCE_INLINE ThisType & operator=(const ThisType &that)=default
const GLdouble * v
Definition: glcorearb.h:836
Mat3< typename promote< T0, T1 >::type > operator+(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Returns M, where for .
Definition: Mat3.h:631
UT_Vector2T< T > operator/(const UT_Vector2T< T > &v, S scalar)
Definition: UT_Vector2.h:421
const GLuint GLenum const void * binary
Definition: glcorearb.h:1923
T & x(void)
Definition: UT_Vector2.h:284
void assign(const T *v)
Set the values of the vector components.
Definition: UT_Vector2.h:311
#define SYSabs(a)
Definition: SYS_Math.h:1367
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:72
#define UT_API
Definition: UT_API.h:12
GLint y
Definition: glcorearb.h:102
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
static const exint TupleSize
GLfloat GLfloat GLfloat v2
Definition: glcorearb.h:817
3D Vector class.
4D Vector class.
Definition: UT_Vector4.h:152
2D Vector class.
Definition: UT_Vector2.h:137
GLuint buffer
Definition: glcorearb.h:659
png_uint_32 i
Definition: png.h:2877
T cross(const UT_Vector2T< T > &v1, const UT_Vector2T< T > &v2)
Cross product, which for 2d vectors results in a fpreal.
Definition: UT_Vector2.h:436
SYS_FORCE_INLINE UT_Vector2T(T v)
Definition: UT_Vector2.h:164
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:101
UT_Vector2T< T > & operator*=(const UT_Matrix2T< S > &mat)
Definition: UT_Vector2.h:244
long long int64
Definition: SYS_Types.h:106
SYS_FORCE_INLINE UT_Vector2T(const int32 v[tuple_size])
Definition: UT_Vector2.h:184
GLfloat f
Definition: glcorearb.h:1925
UT_Vector2T< T > SYSlerp(const UT_Vector2T< T > &v1, const UT_Vector2T< T > &v2, S t)
Componentwise linear interpolation.
Definition: UT_Vector2.h:462
int findMaxAbsAxis() const
These allow you to find out what indices to use for different axes.
Definition: UT_Vector2.h:256
Mat3< typename promote< T0, T1 >::type > operator-(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Returns M, where for .
Definition: Mat3.h:641
int64 exint
Definition: SYS_Types.h:115
int UTinverseBilerp(const UT_Vector2T< T > &input, const UT_Vector2T< T > &p0, const UT_Vector2T< T > &du, const UT_Vector2T< T > &dv, const UT_Vector2T< T > &duv, UT_Vector2T< T > outputs[2])
unsigned hash() const
Compute a hash.
Definition: UT_Vector2.h:301
double fpreal64
Definition: SYS_Types.h:191
UT_Vector2T< T > project(const UT_Vector2T< T > &u, const UT_Vector2T< T > &v)
The orthogonal projection of a vector u onto a vector v.
Definition: UT_Vector2.h:470
static const bool isVectorType
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
T dot(const UT_Vector2T< T > &v1, const UT_Vector2T< T > &v2)
The dot product.
Definition: UT_Vector2.h:431
bool operator>=(const UT_Vector2T< T > &v1, const UT_Vector2T< T > &v2)
Definition: UT_Vector2.h:386
GLboolean * data
Definition: glcorearb.h:130
int int32
Definition: SYS_Types.h:34
UT_Vector2T< T > SYSbilerp(const UT_Vector2T< T > &u0v0, const UT_Vector2T< T > &u1v0, const UT_Vector2T< T > &u0v1, const UT_Vector2T< T > &u1v1, S u, S v)
Definition: UT_Vector2.h:88
UT_API size_t format(char *buffer, size_t buffer_size, const UT_Vector2T< T > &v)
bool operator>(const UT_Vector2T< T > &v1, const UT_Vector2T< T > &v2)
Definition: UT_Vector2.h:381
SYS_FORCE_INLINE UT_Vector2T< T > operator-() const
Definition: UT_Vector2.h:222
void multiplyComponents(const UT_Vector2T< T > &v)
Definition: UT_Vector2.h:226
SYS_FORCE_INLINE UT_Vector2T(const fpreal32 v[tuple_size])
Definition: UT_Vector2.h:178
UT_Vector2T< T > SYSmax(const UT_Vector2T< T > &v1, const UT_Vector2T< T > &v2)
Definition: UT_Vector2.h:452
SYS_FORCE_INLINE UT_Vector2T(const int64 v[tuple_size])
Definition: UT_Vector2.h:187
size_t hash_value(const UT_Vector2T< T > &val)
Definition: UT_Vector2.h:498
void dehomogenize(void)
Express the point in homogeneous coordinates or vice-versa.
Definition: UT_Vector2.h:316
T operator()(unsigned i) const
Definition: UT_Vector2.h:293
void homogenize(void)
Express the point in homogeneous coordinates or vice-versa.
Definition: UT_Vector2.h:315
png_infop png_bytep png_size_t buffer_size
Definition: png.h:2124
GLint GLenum GLint x
Definition: glcorearb.h:408
GLfloat GLfloat v1
Definition: glcorearb.h:816
GLuint GLfloat * val
Definition: glcorearb.h:1607
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:75
T y(void) const
Definition: UT_Vector2.h:287
SYS_FORCE_INLINE UT_Vector2T< T > & operator=(const UT_Vector2T< S > &v)
Definition: UT_Vector2.h:209
T & y(void)
Definition: UT_Vector2.h:286
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
void assign(T xx=0.0f, T yy=0.0f)
Set the values of the vector components.
Definition: UT_Vector2.h:306
UT_Vector2T< T > SYSmin(const UT_Vector2T< T > &v1, const UT_Vector2T< T > &v2)
Componentwise min and maximum.
Definition: UT_Vector2.h:442
SYS_FORCE_INLINE UT_Vector2T(const UT_FixedVector< S, tuple_size, S_INSTANTIATED > &v)
Arbitrary UT_FixedVector of the same size.
Definition: UT_Vector2.h:201
SYS_FORCE_INLINE Storage::AtLeast32Bit length2() const noexcept
UT_Vector2T< T > colVecMult(const UT_Matrix2T< S > &m, const UT_Vector2T< T > &v)
Definition: UT_Vector2.h:481
SYS_FORCE_INLINE UT_Vector2T(const fpreal64 v[tuple_size])
Definition: UT_Vector2.h:181
float fpreal32
Definition: SYS_Types.h:190
SYS_FORCE_INLINE UT_Vector2T(const UT_Vector2T< S > &v)
Our own type of any given value_type.
Definition: UT_Vector2.h:195
T distance2d(const UT_Vector2T< T > &v1, const UT_Vector2T< T > &v2)
Definition: UT_Vector2.h:492
UT_FixedVector< T, 2, true > Base
Definition: UT_Vector2.h:140