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