HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Vector3.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: Utility Library (C++)
7  *
8  * COMMENTS:
9  * This class handles fpreal vectors of dimension 3.
10  *
11  * WARNING:
12  * This class should NOT contain any virtual methods, nor should it
13  * define more member data. The size of UT_Vector3 must always be
14  * 12 bytes (3 floats).
15  */
16 
17 #pragma once
18 
19 #ifndef __UT_Vector3_h__
20 #define __UT_Vector3_h__
21 
22 #include "UT_API.h"
23 #include "UT_Assert.h"
24 #include "UT_FixedVector.h"
25 #include "UT_VectorTypes.h"
26 #include "UT_Vector2.h"
27 #include <SYS/SYS_Deprecated.h>
28 #include <SYS/SYS_Inline.h>
29 #include <SYS/SYS_Math.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 // Right-multiply operators (M*v) have been removed. They had previously
41 // been defined to return v*M, which was too counterintuitive. Once HDK
42 // etc. users have a chance to update their code (post 7.0) we could
43 // reintroduce a right-multiply operator that does a colVecMult.
44 
45 template <typename T, typename S>
47 template <typename T, typename S>
49 template <typename T>
51 template <typename T>
53 template <typename T, typename S>
54 inline UT_Vector3T<T> operator+(const UT_Vector3T<T> &v, S scalar);
55 template <typename T, typename S>
56 inline UT_Vector3T<T> operator-(const UT_Vector3T<T> &v, S scalar);
57 template <typename T, typename S>
58 inline UT_Vector3T<T> operator*(const UT_Vector3T<T> &v, S scalar);
59 template <typename T, typename S>
60 inline UT_Vector3T<T> operator/(const UT_Vector3T<T> &v, S scalar);
61 template <typename T, typename S>
62 inline UT_Vector3T<T> operator+(S scalar, const UT_Vector3T<T> &v);
63 template <typename T, typename S>
64 inline UT_Vector3T<T> operator-(S scalar, const UT_Vector3T<T> &v);
65 template <typename T, typename S>
66 inline UT_Vector3T<T> operator*(S scalar, const UT_Vector3T<T> &v);
67 template <typename T, typename S>
68 inline UT_Vector3T<T> operator/(S scalar, const UT_Vector3T<T> &v);
69 
70 /// The dot and cross products between two vectors (see operator*() too)
71 // @{
72 template <typename T>
73 inline T dot(const UT_Vector3T<T> &v1, const UT_Vector3T<T> &v2);
74 template <typename T>
75 inline UT_Vector3T<T> cross(const UT_Vector3T<T> &v1, const UT_Vector3T<T> &v2);
76 // @}
77 
78 /// The angle between two vectors in radians
79 // @{
80 template <typename T>
82 // @}
83 
84 /// Componentwise min and maximum
85 template <typename T>
87 template <typename T>
89 
90 /// Componentwise linear interpolation
91 template <typename T,typename S>
92 inline UT_Vector3T<T> SYSlerp(const UT_Vector3T<T> &v1, const UT_Vector3T<T> &v2, S t);
93 
94 /// Bilinear interpolation
95 template <typename T,typename S>
96 inline UT_Vector3T<T> SYSbilerp(const UT_Vector3T<T> &u0v0, const UT_Vector3T<T> &u1v0,
97  const UT_Vector3T<T> &u0v1, const UT_Vector3T<T> &u1v1,
98  S u, S v)
99 { return SYSlerp(SYSlerp(u0v0, u0v1, v), SYSlerp(u1v0, u1v1, v), u); }
100 
101 /// Barycentric interpolation
102 template <typename T, typename S>
104  const UT_Vector3T<T> &v1, const UT_Vector3T<T> &v2, S u, S v)
105 { return v0 * (1 - u - v) + v1 * u + v2 *v; }
106 
107 
108 /// Trilinear hat function over kernel widths in s.
109 template <typename T>
110 inline T SYStrihat(const UT_Vector3T<T> &v, const UT_Vector3T<T> &s);
111 
112 /// Gradient of trilinear hat function over kernel widths in s.
113 template <typename T>
115 
116 /// The orthogonal projection of a vector u onto a vector v
117 template <typename T>
118 inline UT_Vector3T<T> project(const UT_Vector3T<T> &u, const UT_Vector3T<T> &v);
119 
120 // TODO: make UT_Vector4 versions of these:
121 
122 /// Compute the distance between two points
123 template <typename T>
124 inline T distance3d(const UT_Vector3T<T> &p1, const UT_Vector3T<T> &p2);
125 /// Compute the distance squared
126 template <typename T>
127 inline T distance2(const UT_Vector3T<T> &p1, const UT_Vector3T<T> &p2);
128 template <typename T>
129 inline T segmentPointDist2(const UT_Vector3T<T> &pos,
130  const UT_Vector3T<T> &pt1,
131  const UT_Vector3T<T> &pt2 );
132 
133 /// Intersect the lines p1 + v1 * t1 and p2 + v2 * t2.
134 /// t1 and t2 are set so that the lines intersect when
135 /// projected to the plane defined by the two lines.
136 /// This function returns a value which indicates how close
137 /// to being parallel the lines are. Closer to zero means
138 /// more parallel. This is done so that the user of this
139 /// function can decide what epsilon they want to use.
140 template <typename T>
141 UT_API double intersectLines(const UT_Vector3T<T> &p1,
142  const UT_Vector3T<T> &v1,
143  const UT_Vector3T<T> &p2,
144  const UT_Vector3T<T> &v2,
145  T &t1, T &t2);
146 
147 /// Returns true if the segments from p0 to p1 and from a to b intersect, and
148 /// t will contain the parametric value of the intersection on the segment a-b.
149 /// Otherwise returns false. Parallel segments will return false. T is
150 /// guaranteed to be between 0.0 and 1.0 if this function returns true.
151 template <typename T>
153  const UT_Vector3T<T> &p1,
154  const UT_Vector3T<T> &a,
155  const UT_Vector3T<T> &b, T &t);
156 
157 /// Returns the U coordinates of the closest points on each of the two
158 /// parallel line segments
159 template <typename T>
161  const UT_Vector3T<T> &p1,
162  const UT_Vector3T<T> &a,
163  const UT_Vector3T<T> &b);
164 /// Returns the U coordinates of the closest points on each of the two
165 /// line segments
166 template <typename T>
168  const UT_Vector3T<T> &p1,
169  const UT_Vector3T<T> &a,
170  const UT_Vector3T<T> &b);
171 /// Returns the U coordinate of the point on line segment p0->p1
172 /// that is closest to a.
173 template <typename T>
175  const UT_Vector3T<T> &p0,
176  const UT_Vector3T<T> &p1,
177  const UT_Vector3T<T> &a);
178 
179 /// Returns the squared distance between two line segments: p0-p1 and a-b
180 template <typename T>
181 inline T segmentDistance2(const UT_Vector3T<T> &p0,
182  const UT_Vector3T<T> &p1,
183  const UT_Vector3T<T> &a,
184  const UT_Vector3T<T> &b);
185 /// Returns the distance between two line segments: p0-p1 and a-b
186 template <typename T>
187 inline T segmentDistance(const UT_Vector3T<T> &p0,
188  const UT_Vector3T<T> &p1,
189  const UT_Vector3T<T> &a,
190  const UT_Vector3T<T> &b);
191 /// 3D Vector class.
192 template <typename T>
193 class UT_API UT_Vector3T : public UT_FixedVector<T,3,true>
194 {
195 public:
197 
198  // These "using" statements are needed for operator=, operator*=, and
199  // distance, so that the ones in UT_FixedVector aren't hidden by the
200  // additional ones here.
201  using Base::operator=;
202  using Base::operator*=;
203  using Base::distance;
204 
205  // These "using" statements are needed for GCC and Clang, because
206  // otherwise, they ignore all members of UT_FixedVector when
207  // checking validity of code in functions in this class.
208  using Base::vec;
209  using Base::data;
210  using Base::normalize;
211  using Base::length2;
212  typedef T value_type;
213  static const int tuple_size = 3;
214 
215  /// Default constructor.
216  /// No data is initialized! Use it for extra speed.
217  SYS_FORCE_INLINE UT_Vector3T() = default;
218 
219  SYS_FORCE_INLINE UT_Vector3T(const UT_Vector3T<T> &that) = default;
220  SYS_FORCE_INLINE UT_Vector3T(UT_Vector3T<T> &&that) = default;
221 
223  {
224  vec[0] = v;
225  vec[1] = v;
226  vec[2] = v;
227  }
228 
230  {
231  vec[0] = vx;
232  vec[1] = vy;
233  vec[2] = vz;
234  }
236  : Base(v)
237  {}
239  : Base(v)
240  {}
242  : Base(v)
243  {}
244  SYS_FORCE_INLINE UT_Vector3T(const int32 v[tuple_size])
245  : Base(v)
246  {}
247  SYS_FORCE_INLINE UT_Vector3T(const int64 v[tuple_size])
248  : Base(v)
249  {}
250 
251  SYS_FORCE_INLINE explicit UT_Vector3T(const UT_Vector2T<T> &v);
252  SYS_FORCE_INLINE explicit UT_Vector3T(const UT_Vector4T<T> &v);
253 
254  /// Our own type of any given value_type.
255  template <typename S>
257  : Base(v)
258  {}
259 
260  /// Arbitrary UT_FixedVector of the same size
261  template <typename S,bool S_INSTANTIATED>
263  : Base(v)
264  {}
265 
268 
269  template <typename S>
271  { vec[0] = v[0]; vec[1] = v[1]; vec[2] = v[2]; return *this; }
272 
273  /// Assignment operator that truncates a V4 to a V3.
274  /// TODO: remove this. This should require an explicit UT_Vector3()
275  /// construction, since it's unsafe.
276  SYS_DEPRECATED_HDK_REPLACE(16.0,explicit UT_Vector3 constructor to avoid implicit conversion from UT_Vector4)
278 
279  /// It's unclear why this is needed, given UT_FixedVector::operator-(),
280  /// but the compiler seems not to accept not having it.
282  {
283  return UT_Vector3T<T>(-vec[0], -vec[1], -vec[2]);
284  }
285 
286  void clampZero(T tol = T(0.00001f))
287  {
288  if (vec[0] >= -tol && vec[0] <= tol) vec[0] = 0;
289  if (vec[1] >= -tol && vec[1] <= tol) vec[1] = 0;
290  if (vec[2] >= -tol && vec[2] <= tol) vec[2] = 0;
291  }
292 
295  {
296  vec[0] *= v.vec[0];
297  vec[1] *= v.vec[1];
298  vec[2] *= v.vec[2];
299  }
300 
301  /// If you need a multiplication operator that left multiplies the vector
302  /// by a matrix (M * v), use the following colVecMult() functions. If
303  /// you'd rather not use operator*=() for right-multiplications (v * M),
304  /// use the following rowVecMult() functions. The methods that take a 4x4
305  /// matrix first extend this vector to 4D by adding an element equal to 1.0.
306  /// @internal These are implemented in UT_Matrix3.h and UT_Matrix4.h
307  // @{
316  // @}
317 
318 
319  /// This multiply will not extend the vector by adding a fourth element.
320  /// Instead, it converts the Matrix4 to a Matrix3. This means that
321  /// the translate component of the matrix is not applied to the vector
322  /// @internal These are implemented in UT_Matrix4.h
323  // @{
328  // @}
329 
330 
331 
332  /// The *=, multiply, multiply3 and multiplyT routines are provided for
333  /// legacy reasons. They all assume that *this is a row vector. Generally,
334  /// the rowVecMult and colVecMult methods are preferred, since they're
335  /// more explicit about the row vector assumption.
336  // @{
337  template <typename S>
339  template <typename S>
341 
342  template <typename S>
343  SYS_FORCE_INLINE void multiply3(const UT_Matrix4T<S> &mat);
344  // @}
345 
346  /// This multiply will multiply the (row) vector by the transpose of the
347  /// matrix instead of the matrix itself. This is faster than
348  /// transposing the matrix, then multiplying (as well there's potentially
349  /// less storage requirements).
350  // @{
351  template <typename S>
352  SYS_FORCE_INLINE void multiplyT(const UT_Matrix3T<S> &mat);
353  template <typename S>
354  SYS_FORCE_INLINE void multiply3T(const UT_Matrix4T<S> &mat);
355  // @}
356 
357  /// The following methods implement multiplies (row) vector by a matrix,
358  /// however, the resulting vector is specified by the dest parameter
359  /// These operations are safe even if "dest" is the same as "this".
360  // @{
361  template <typename S>
362  SYS_FORCE_INLINE void multiply3(UT_Vector3T<T> &dest,
363  const UT_Matrix4T<S> &mat) const;
364  template <typename S>
365  SYS_FORCE_INLINE void multiplyT(UT_Vector3T<T> &dest,
366  const UT_Matrix3T<S> &mat) const;
367  template <typename S>
368  SYS_FORCE_INLINE void multiply3T(UT_Vector3T<T> &dest,
369  const UT_Matrix4T<S> &mat) const;
370  template <typename S>
371  SYS_FORCE_INLINE void multiply(UT_Vector3T<T> &dest,
372  const UT_Matrix4T<S> &mat) const;
373  template <typename S>
374  SYS_FORCE_INLINE void multiply(UT_Vector3T<T> &dest,
375  const UT_Matrix3T<S> &mat) const;
376  // @}
377 
379  {
380  operator=(::cross(*this, v));
381  }
382 
384  {
385  vec[0] += (va.vec[2]+vb.vec[2])*(vb.vec[1]-va.vec[1]);
386  vec[1] += (va.vec[0]+vb.vec[0])*(vb.vec[2]-va.vec[2]);
387  vec[2] += (va.vec[1]+vb.vec[1])*(vb.vec[0]-va.vec[0]);
388  }
389 
390  /// Finds an arbitrary perpendicular to v, and sets this to it.
391  void arbitraryPerp(const UT_Vector3T<T> &v);
392  /// Makes this orthogonal to the given vector. If they are colinear,
393  /// does an arbitrary perp
394  void makeOrthonormal(const UT_Vector3T<T> &v);
395 
396  /// These allow you to find out what indices to use for different axes
397  // @{
398  int findMinAbsAxis() const
399  {
400  T ax = SYSabs(x()), ay = SYSabs(y());
401  if (ax < ay)
402  return (SYSabs(z()) < ax) ? 2 : 0;
403  else
404  return (SYSabs(z()) < ay) ? 2 : 1;
405  }
406  int findMaxAbsAxis() const
407  {
408  T ax = SYSabs(x()), ay = SYSabs(y());
409  if (ax >= ay)
410  return (SYSabs(z()) >= ax) ? 2 : 0;
411  else
412  return (SYSabs(z()) >= ay) ? 2 : 1;
413  }
414  // @}
415 
416  /// Given this vector as the z-axis, get a frame of reference such that the
417  /// X and Y vectors are orthonormal to the vector. This vector should be
418  /// normalized.
420  {
421  if (SYSabs(x()) < 0.6F) Y = UT_Vector3T<T>(1, 0, 0);
422  else if (SYSabs(z()) < 0.6F) Y = UT_Vector3T<T>(0, 1, 0);
423  else Y = UT_Vector3T<T>(0, 0, 1);
424  X = ::cross(Y, *this);
425  X.normalize();
426  Y = ::cross(*this, X);
427  }
428 
429  /// Calculates the orthogonal projection of a vector u on the *this vector
430  UT_Vector3T<T> project(const UT_Vector3T<T> &u) const;
431 
432  /// Create a matrix of projection onto this vector: the matrix transforms
433  /// a vector v into its projection on the direction of (*this) vector,
434  /// ie. dot(*this, v) * this->normalize();
435  /// If we need to be normalized, set norm to non-false.
436  template <typename S>
437  UT_Matrix3T<S> project(bool norm=true);
438 
439  /// Vector p (representing a point in 3-space) and vector v define
440  /// a line. This member returns the projection of "this" onto the
441  /// line (the point on the line that is closest to this point).
442  UT_Vector3T<T> projection(const UT_Vector3T<T> &p,
443  const UT_Vector3T<T> &v) const;
444 
445  /// Projects this onto the line segement [a,b]. The returned point
446  /// will lie between a and b.
447  UT_Vector3T<T> projectOnSegment(const UT_Vector3T<T> &va,
448  const UT_Vector3T<T> &vb) const;
449  /// Projects this onto the line segment [a, b]. The fpreal t is set
450  /// to the parametric position of intersection, a being 0 and b being 1.
451  UT_Vector3T<T> projectOnSegment(const UT_Vector3T<T> &va, const UT_Vector3T<T> &vb,
452  T &t) const;
453 
454  /// Create a matrix of symmetry around this vector: the matrix transforms
455  /// a vector v into its symmetry around (*this), ie. two times the
456  /// projection of v onto (*this) minus v.
457  /// If we need to be normalized, set norm to non-false.
458  UT_Matrix3 symmetry(bool norm=true);
459 
460  /// This method stores in (*this) the intersection between two 3D lines,
461  /// p1+t*v1 and p2+u*v2. If the two lines do not actually intersect, we
462  /// shift the 2nd line along the perpendicular on both lines (along the
463  /// line of min distance) and return the shifted intersection point; this
464  /// point thus lies on the 1st line.
465  /// If we find an intersection point (shifted or not) we return 0; if
466  /// the two lines are parallel we return -1; and if they intersect
467  /// behind our back we return -2. When we return -2 there still is a
468  /// valid intersection point in (*this).
469  int lineIntersect(const UT_Vector3T<T> &p1, const UT_Vector3T<T> &v1,
470  const UT_Vector3T<T> &p2, const UT_Vector3T<T> &v2);
471 
472  /// Compute the intersection of vector p2+t*v2 and the line segment between
473  /// points pa and pb. If the two lines do not intersect we shift the
474  /// (p2, v2) line along the line of min distance and return the point
475  /// where it intersects the segment. If we find an intersection point
476  /// along the stretch between pa and pb, we return 0. If the lines are
477  /// parallel we return -1. If they intersect before pa we return -2, and
478  /// if after pb, we return -3. The intersection point is valid with
479  /// return codes 0,-2,-3.
480  int segLineIntersect(const UT_Vector3T<T> &pa, const UT_Vector3T<T> &pb,
481  const UT_Vector3T<T> &p2, const UT_Vector3T<T> &v2);
482 
483  /// Determines whether or not the points p0, p1 and "this" are collinear.
484  /// If they are t contains the parametric value of where "this" is found
485  /// on the segment from p0 to p1 and returns true. Otherwise returns
486  /// false. If p0 and p1 are equal, t is set to
487  /// std::numeric_limits<T>::max() and true is returned.
488  bool areCollinear(const UT_Vector3T<T> &p0, const UT_Vector3T<T> &p1,
489  T *t = 0, T tol = 1e-5) const;
490 
491  /// Compute (homogeneous) barycentric co-ordinates of this point
492  /// relative to the triangle defined by t0, t1 and t2. (The point is
493  /// projected into the triangle's plane.)
494  UT_Vector3T<T> getBary(const UT_Vector3T<T> &t0, const UT_Vector3T<T> &t1,
495  const UT_Vector3T<T> &t2, bool *degen = NULL) const;
496 
497 
498  /// Compute the signed distance from us to a line.
499  T distance(const UT_Vector3T<T> &p1, const UT_Vector3T<T> &v1) const;
500  /// Compute the signed distance between two lines.
501  T distance(const UT_Vector3T<T> &p1, const UT_Vector3T<T> &v1,
502  const UT_Vector3T<T> &p2, const UT_Vector3T<T> &v2) const;
503 
504  /// Return the components of the vector. The () operator does NOT check
505  /// for the boundary condition.
506  /// @{
507  SYS_FORCE_INLINE T &x(void) { return vec[0]; }
508  SYS_FORCE_INLINE T x(void) const { return vec[0]; }
509  SYS_FORCE_INLINE T &y(void) { return vec[1]; }
510  SYS_FORCE_INLINE T y(void) const { return vec[1]; }
511  SYS_FORCE_INLINE T &z(void) { return vec[2]; }
512  SYS_FORCE_INLINE T z(void) const { return vec[2]; }
513  SYS_FORCE_INLINE T &r(void) { return vec[0]; }
514  SYS_FORCE_INLINE T r(void) const { return vec[0]; }
515  SYS_FORCE_INLINE T &g(void) { return vec[1]; }
516  SYS_FORCE_INLINE T g(void) const { return vec[1]; }
517  SYS_FORCE_INLINE T &b(void) { return vec[2]; }
518  SYS_FORCE_INLINE T b(void) const { return vec[2]; }
520  {
521  UT_ASSERT_P(i < tuple_size);
522  return vec[i];
523  }
524  SYS_FORCE_INLINE T operator()(unsigned i) const
525  {
526  UT_ASSERT_P(i < tuple_size);
527  return vec[i];
528  }
529  /// @}
530 
531  /// Compute a hash
532  unsigned hash() const { return SYSvector_hash(data(), tuple_size); }
533 
534  // TODO: eliminate these methods. They're redundant, given good inline
535  // constructors.
536  /// Set the values of the vector components
537  void assign(T xx = 0.0f, T yy = 0.0f, T zz = 0.0f)
538  {
539  vec[0] = xx; vec[1] = yy; vec[2] = zz;
540  }
541  /// Set the values of the vector components
542  void assign(const T *v)
543  {
544  vec[0]=v[0]; vec[1]=v[1]; vec[2]=v[2];
545  }
546 
547  /// Express the point in homogeneous coordinates or vice-versa
548  // @{
549  void homogenize(void)
550  {
551  vec[0] *= vec[2];
552  vec[1] *= vec[2];
553  }
554  void dehomogenize(void)
555  {
556  if (vec[2] != 0)
557  {
558  T denom = 1.0f / vec[2];
559  vec[0] *= denom;
560  vec[1] *= denom;
561  }
562  }
563  // @}
564 
565  /// assuming that "this" is a rotation (in radians, of course), the
566  /// equivalent set of rotations which are closest to the "base" rotation
567  /// are found. The equivalent rotations are the same as the original
568  /// rotations +2*n*PI
569  void roundAngles(const UT_Vector3T<T> &base);
570 
571  /// conversion between degrees and radians
572  // @{
573  void degToRad();
574  void radToDeg();
575  // @}
576 
577  /// It seems that given any rotation matrix and transform order,
578  /// there are two distinct triples of rotations that will result in
579  /// the same overall rotation. This method will find the closest of
580  /// the two after finding the closest using the above method.
581  void roundAngles(const UT_Vector3T<T> &b, const UT_XformOrder &o);
582 
583  /// Return the dual of the vector
584  /// The dual is a matrix which acts like the cross product when
585  /// multiplied by other vectors.
586  /// The following are equivalent:
587  /// a.getDual(A); c = colVecMult(A, b)
588  /// c = cross(a, b)
589  template <typename S>
590  void getDual(UT_Matrix3T<S> &dual) const;
591 
592  /// Protected I/O methods
593  // @{
594  void save(std::ostream &os, bool binary = false) const;
595  bool load(UT_IStream &is);
596  // @}
597 
598  /// @{
599  /// Methods to serialize to a JSON stream. The vector is stored as an
600  /// array of 3 reals.
601  bool save(UT_JSONWriter &w) const;
602  bool save(UT_JSONValue &v) const;
603  bool load(UT_JSONParser &p);
604  /// @}
605 
606  /// @{
607  /// Method to return the angle (in radians) between this and another vector
609  {
610  return ::UTangleBetween(*this, v);
611  }
612  /// @}
613 
614  /// Returns the vector size
615  static int entries() { return tuple_size; }
616 
617 private:
618  /// I/O friends
619  // @{
620  friend std::ostream &operator<<(std::ostream &os, const UT_Vector3T<T> &v)
621  {
622  v.save(os);
623  return os;
624  }
625  // @}
626 };
627 
628 // Required for constructor
629 #include "UT_Vector2.h"
630 #include "UT_Vector4.h"
631 
632 template <typename T>
634 {
635  vec[0] = v.x();
636  vec[1] = v.y();
637  vec[2] = T(0);
638 }
639 template <typename T>
641 {
642  vec[0] = v.x();
643  vec[1] = v.y();
644  vec[2] = v.z();
645 }
646 
647 // Free floating functions:
648 template <typename T>
649 inline
651 {
652  return UT_Vector3T<T>(v1.x()+v2.x(), v1.y()+v2.y(), v1.z()+v2.z());
653 }
654 
655 template <typename T>
656 inline
658 {
659  return UT_Vector3T<T>(v1.x()-v2.x(), v1.y()-v2.y(), v1.z()-v2.z());
660 }
661 
662 template <typename T, typename S>
663 inline
665 {
666  return UT_Vector3T<T>(v.x()+scalar, v.y()+scalar, v.z()+scalar);
667 }
668 
669 template <typename T>
670 inline
672 {
673  return UT_Vector3T<T>(v1.x()*v2.x(), v1.y()*v2.y(), v1.z()*v2.z());
674 }
675 
676 template <typename T>
677 inline
679 {
680  return UT_Vector3T<T>(v1.x()/v2.x(), v1.y()/v2.y(), v1.z()/v2.z());
681 }
682 
683 template <typename T, typename S>
684 inline
686 {
687  return UT_Vector3T<T>(v.x()+scalar, v.y()+scalar, v.z()+scalar);
688 }
689 
690 template <typename T, typename S>
691 inline
693 {
694  return UT_Vector3T<T>(v.x()-scalar, v.y()-scalar, v.z()-scalar);
695 }
696 
697 template <typename T, typename S>
698 inline
700 {
701  return UT_Vector3T<T>(scalar-v.x(), scalar-v.y(), scalar-v.z());
702 }
703 
704 template <typename T, typename S>
705 inline
707 {
708  return UT_Vector3T<T>(v.x()*scalar, v.y()*scalar, v.z()*scalar);
709 }
710 
711 template <typename T, typename S>
712 inline
714 {
715  return UT_Vector3T<T>(v.x()*scalar, v.y()*scalar, v.z()*scalar);
716 }
717 
718 template <typename T, typename S>
719 inline
721 {
723  {
724  // This has to be T because S may be int for "v = v/2" code
725  // For the same reason we must cast the 1
726  T inv = ((T)1) / scalar;
727  return UT_Vector3T<T>(v.x()*inv, v.y()*inv, v.z()*inv);
728  }
729  return UT_Vector3T<T>(v.x()/scalar, v.y()/scalar, v.z()/scalar);
730 }
731 
732 template <typename T, typename S>
733 inline
735 {
736  return UT_Vector3T<T>(scalar/v.x(), scalar/v.y(), scalar/v.z());
737 }
738 
739 template <typename T>
740 inline
742 {
743  return v1.x()*v2.x() + v1.y()*v2.y() + v1.z()*v2.z();
744 }
745 
746 template <typename T>
747 inline
749 {
750  // compute the cross product:
751  return UT_Vector3T<T>(
752  v1.y()*v2.z() - v1.z()*v2.y(),
753  v1.z()*v2.x() - v1.x()*v2.z(),
754  v1.x()*v2.y() - v1.y()*v2.x()
755  );
756 }
757 
758 template <typename T>
759 inline
761 {
762  UT_Vector3T<fpreal64> v1crossv2 = cross(v1, v2);
763  fpreal v1dotv2 = dot(v1, v2);
764  return SYSatan2(v1crossv2.length(), v1dotv2);
765 }
766 
767 template <typename T>
768 inline
770 {
771  return UT_Vector3T<T>(SYSabs(v.x()), SYSabs(v.y()), SYSabs(v.z()));
772 }
773 
774 template <typename T>
775 inline
777 {
778  return UT_Vector3T<T>(
779  SYSmin(v1.x(), v2.x()),
780  SYSmin(v1.y(), v2.y()),
781  SYSmin(v1.z(), v2.z())
782  );
783 }
784 
785 template <typename T>
786 inline
788 {
789  return UT_Vector3T<T>(
790  SYSmax(v1.x(), v2.x()),
791  SYSmax(v1.y(), v2.y()),
792  SYSmax(v1.z(), v2.z())
793  );
794 }
795 
796 template <typename T,typename S>
797 inline
799 {
800  return UT_Vector3T<T>(
801  SYSlerp(v1.x(), v2.x(), t),
802  SYSlerp(v1.y(), v2.y(), t),
803  SYSlerp(v1.z(), v2.z(), t));
804 }
805 
806 template <typename T>
807 inline
809  const UT_Vector3T<T> &v2,
810  const UT_Vector3T<T> &t)
811 {
812  return UT_Vector3T<T>(
813  SYSlerp(v1.x(), v2.x(), t.x()),
814  SYSlerp(v1.y(), v2.y(), t.y()),
815  SYSlerp(v1.z(), v2.z(), t.z()));
816 }
817 
818 template <typename T>
819 inline
821  const UT_Vector3T<T> &min,
822  const UT_Vector3T<T> &max)
823 {
824  return UT_Vector3T<T>(
825  SYSclamp(v.x(), min.x(), max.x()),
826  SYSclamp(v.y(), min.y(), max.y()),
827  SYSclamp(v.z(), min.z(), max.z()));
828 }
829 
830 template <typename T>
831 inline
833 {
834  return SYSequalZero(v.x()) && SYSequalZero(v.y()) && SYSequalZero(v.z());
835 }
836 
837 template <typename T>
838 inline
840 {
841  return SYSisFinite(v.x()) && SYSisFinite(v.y()) && SYSisFinite(v.z());
842 }
843 
844 template <typename T>
845 inline
847 {
848  return UT_Vector3T<T>(SYSrecip(v[0]), SYSrecip(v[1]), SYSrecip(v[2]));
849 }
850 
851 template <typename T>
852 inline
854 {
855  return SYShat(v.x(), s.x()) * SYShat(v.y(), s.y()) * SYShat(v.z(), s.z());
856 }
857 
858 template <typename T>
859 inline
861 {
862  const T xhat = SYShat(v.x(), s.x());
863  const T yhat = SYShat(v.y(), s.y());
864  const T zhat = SYShat(v.z(), s.z());
865  return UT_Vector3T<T>(SYSdhat(v.x(), s.x()) * yhat * zhat,
866  xhat * SYSdhat(v.y(), s.y()) * zhat,
867  xhat * yhat * SYSdhat(v.z(), s.z()));
868 }
869 
870 template <typename T>
871 inline
873 {
874  return dot(u, v) / v.length2() * v;
875 }
876 
877 template <typename T>
878 inline
880 {
881  return (v1 - v2).length();
882 }
883 template <typename T>
884 inline
886 {
887  return (v1 - v2).length2();
888 }
889 
890 // calculate distance squared of pos to the line segment defined by pt1 to pt2
891 template <typename T>
892 inline
894  const UT_Vector3T<T> &pt1, const UT_Vector3T<T> &pt2 )
895 {
896  UT_Vector3T<T> vec;
897  T proj_t;
898  T veclen2;
899 
900  vec = pt2 - pt1;
901  proj_t = vec.dot( pos - pt1 );
902  veclen2 = vec.length2();
903 
904  if( proj_t <= (T)0.0 )
905  {
906  // in bottom cap region, calculate distance from pt1
907  vec = pos - pt1;
908  }
909  else if( proj_t >= veclen2 )
910  {
911  // in top cap region, calculate distance from pt2
912  vec = pos - pt2;
913  }
914  else
915  {
916  // middle region, calculate distance from projected pt
917  proj_t /= veclen2;
918  vec = (pt1 + (proj_t * vec)) - pos;
919  }
920 
921  return dot(vec, vec);
922 }
923 
924 // TODO: review the effiency of the following routine, there is a faster
925 // way to get just the distance.
926 template <typename T>
927 inline
929  const UT_Vector3T<T> &q0, const UT_Vector3T<T> &q1)
930 {
931  UT_Vector2 t = segmentClosest(p0, p1, q0, q1);
932  UT_Vector3 a = p0 + (p1 - p0) * t[0];
933  UT_Vector3 b = q0 + (q1 - q0) * t[1];
934  return distance2(a, b);
935 }
936 
937 template <typename T>
938 inline
940  const UT_Vector3T<T> &q0, const UT_Vector3T<T> &q1)
941 {
942  return SYSsqrt(segmentDistance2(p0, p1, q0, q1));
943 }
944 
945 /// Given a 3D position, input, and a 3D parallelpiped with corner p0 and
946 /// directions du, dv, and dw, finds the 0 or 1 locations in the parameter
947 /// space of that parallelpiped that correspond with the input position.
948 /// Only a parameter location approximately between 0 and 1
949 /// is accepted. The return value is the number of accepted parameter locations,
950 /// i.e. 0 or 1.
951 template <typename T>
953  const UT_Vector3T<T> &p0,
954  const UT_Vector3T<T> &du, const UT_Vector3T<T> &dv, const UT_Vector3T<T> &dw,
955  UT_Vector3T<T> &output)
956 {
957  const UT_Vector3T<T> orig = input - p0;
958 
959  const UT_Matrix3T<T> matrix(
960  du.x(), dv.x(), dw.x(),
961  du.y(), dv.y(), dw.y(),
962  du.z(), dv.z(), dw.z()
963  );
964 
965  bool failed = matrix.solve(orig.x(), orig.y(), orig.z(), output);
966  return !failed &&
967  SYSisGreaterOrEqual(output.x(), 0) && SYSisLessOrEqual(output.x(), 1) &&
968  SYSisGreaterOrEqual(output.y(), 0) && SYSisLessOrEqual(output.y(), 1) &&
969  SYSisGreaterOrEqual(output.z(), 0) && SYSisLessOrEqual(output.z(), 1);
970 }
971 
972 template <typename T>
973 inline size_t hash_value(const UT_Vector3T<T> &val)
974 {
975  return val.hash();
976 }
977 
978 // Overload for custom formatting of UT_Vector3T<T> with UTformat.
979 template<typename T>
980 UT_API size_t format(char *buffer, size_t buffer_size, const UT_Vector3T<T> &v);
981 
982 
983 template<typename T>
985 {
987  typedef T DataType;
988  static const exint TupleSize = 3;
989  static const bool isVectorType = true;
990 };
991 
992 #endif
UT_Vector3T< T > rowVecMult(const UT_Vector3T< T > &v, const UT_Matrix3T< S > &m)
Definition: UT_Matrix3.h:1455
GLdouble s
Definition: glew.h:1390
SYS_FORCE_INLINE UT_Vector3T(const UT_Vector3T< S > &v)
Our own type of any given value_type.
Definition: UT_Vector3.h:256
SYS_FORCE_INLINE T & g(void)
Definition: UT_Vector3.h:515
UT_Vector3T< T > SYSlerp(const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2, S t)
Componentwise linear interpolation.
Definition: UT_Vector3.h:798
SYS_FORCE_INLINE constexpr const T * data() const noexcept
UT_API double intersectLines(const UT_Vector3T< T > &p1, const UT_Vector3T< T > &v1, const UT_Vector3T< T > &p2, const UT_Vector3T< T > &v2, T &t1, T &t2)
vint4 max(const vint4 &a, const vint4 &b)
Definition: simd.h:4703
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
GLenum GLenum GLenum input
Definition: glew.h:13879
T dot(const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
The dot and cross products between two vectors (see operator*() too)
Definition: UT_Vector3.h:741
SYS_FORCE_INLINE void operator*=(const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that)
int findMaxAbsAxis() const
These allow you to find out what indices to use for different axes.
Definition: UT_Vector3.h:406
UT_Vector3T< T > SYSrecip(const UT_Vector3T< T > &v)
Definition: UT_Vector3.h:846
T & z(void)
Definition: UT_Vector4.h:387
UT_Vector3T< T > SYSbilerp(const UT_Vector3T< T > &u0v0, const UT_Vector3T< T > &u1v0, const UT_Vector3T< T > &u0v1, const UT_Vector3T< T > &u1v1, S u, S v)
Bilinear interpolation.
Definition: UT_Vector3.h:96
T distance2(const UT_Vector3T< T > &p1, const UT_Vector3T< T > &p2)
Compute the distance squared.
Definition: UT_Vector3.h:885
T distance3d(const UT_Vector3T< T > &p1, const UT_Vector3T< T > &p2)
Compute the distance between two points.
Definition: UT_Vector3.h:879
int UTinverseTrilerpFlat(const UT_Vector3T< T > &input, const UT_Vector3T< T > &p0, const UT_Vector3T< T > &du, const UT_Vector3T< T > &dv, const UT_Vector3T< T > &dw, UT_Vector3T< T > &output)
Definition: UT_Vector3.h:952
UT_Vector3T< T > SYSabs(const UT_Vector3T< T > &v)
Definition: UT_Vector3.h:769
SYS_FORCE_INLINE ThisType & operator=(const ThisType &that)=default
SYS_FORCE_INLINE T operator()(unsigned i) const
Definition: UT_Vector3.h:524
void assign(const T *v)
Set the values of the vector components.
Definition: UT_Vector3.h:542
GLuint const GLfloat * val
Definition: glew.h:2794
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
#define SYS_DEPRECATED_HDK_REPLACE(__V__, __R__)
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:9477
fpreal64 UTangleBetween(const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
The angle between two vectors in radians.
Definition: UT_Vector3.h:760
void homogenize(void)
Express the point in homogeneous coordinates or vice-versa.
Definition: UT_Vector3.h:549
UT_Vector3T< T > SYSmin(const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
Componentwise min and maximum.
Definition: UT_Vector3.h:776
SYS_FORCE_INLINE T x(void) const
Definition: UT_Vector3.h:508
T & x(void)
Definition: UT_Vector2.h:292
T segmentDistance(const UT_Vector3T< T > &p0, const UT_Vector3T< T > &p1, const UT_Vector3T< T > &a, const UT_Vector3T< T > &b)
Returns the distance between two line segments: p0-p1 and a-b.
Definition: UT_Vector3.h:939
UT_Vector3T< T > operator/(const UT_Vector3T< T > &v, S scalar)
Definition: UT_Vector3.h:720
unsigned hash() const
Compute a hash.
Definition: UT_Vector3.h:532
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:75
#define UT_API
Definition: UT_API.h:13
const GLdouble * m
Definition: glew.h:9124
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
const GLdouble * v
Definition: glew.h:1391
static const exint TupleSize
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:507
UT_Vector3T< T > SYStrihatgrad(const UT_Vector3T< T > &v, const UT_Vector3T< T > &s)
Gradient of trilinear hat function over kernel widths in s.
Definition: UT_Vector3.h:860
T SYStrihat(const UT_Vector3T< T > &v, const UT_Vector3T< T > &s)
Trilinear hat function over kernel widths in s.
Definition: UT_Vector3.h:853
3D Vector class.
4D Vector class.
Definition: UT_Vector4.h:163
2D Vector class.
Definition: UT_Vector2.h:145
T segmentPointDist2(const UT_Vector3T< T > &pos, const UT_Vector3T< T > &pt1, const UT_Vector3T< T > &pt2)
Definition: UT_Vector3.h:893
GLdouble GLdouble z
Definition: glew.h:1559
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:511
void getFrameOfReference(UT_Vector3T< T > &X, UT_Vector3T< T > &Y) const
Definition: UT_Vector3.h:419
long long int64
Definition: SYS_Types.h:111
SYS_FORCE_INLINE T & operator()(unsigned i)
Definition: UT_Vector3.h:519
SYS_FORCE_INLINE T g(void) const
Definition: UT_Vector3.h:516
GLfloat GLfloat GLfloat v2
Definition: glew.h:1856
SYS_FORCE_INLINE UT_Vector3T(const fpreal32 v[tuple_size])
Definition: UT_Vector3.h:238
GLclampf f
Definition: glew.h:3499
GLint GLint GLint GLint GLint x
Definition: glew.h:1252
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1252
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
UT_API UT_Vector2T< T > segmentClosest(const UT_Vector3T< T > &p0, const UT_Vector3T< T > &p1, const UT_Vector3T< T > &a, const UT_Vector3T< T > &b)
void clampZero(T tol=T(0.00001f))
Definition: UT_Vector3.h:286
int64 exint
Definition: SYS_Types.h:120
GLuint buffer
Definition: glew.h:1680
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:134
const GLuint GLenum const void * binary
Definition: glew.h:3502
double fpreal64
Definition: SYS_Types.h:196
size_t hash_value(const UT_Vector3T< T > &val)
Definition: UT_Vector3.h:973
static const bool isVectorType
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1890
SYS_FORCE_INLINE UT_Vector3T(const int64 v[tuple_size])
Definition: UT_Vector3.h:247
UT_Vector3T< T > SYSclamp(const UT_Vector3T< T > &v, const UT_Vector3T< T > &min, const UT_Vector3T< T > &max)
Definition: UT_Vector3.h:820
static int entries()
Returns the vector size.
Definition: UT_Vector3.h:615
GLsizei GLsizei GLfloat distance
Definition: glew.h:13640
SYS_FORCE_INLINE UT_StorageAtLeast32Bit< T, T >::Type length2() const noexcept
UT_Vector3T< T > SYSmax(const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
Definition: UT_Vector3.h:787
UT_Vector3T< T > SYSbarycentric(const UT_Vector3T< T > &v0, const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2, S u, S v)
Barycentric interpolation.
Definition: UT_Vector3.h:103
class UT_API UT_Vector3T
UT_API UT_Vector2T< T > segmentClosestParallel(const UT_Vector3T< T > &p0, const UT_Vector3T< T > &p1, const UT_Vector3T< T > &a, const UT_Vector3T< T > &b)
SYS_FORCE_INLINE T b(void) const
Definition: UT_Vector3.h:518
T segmentDistance2(const UT_Vector3T< T > &p0, const UT_Vector3T< T > &p1, const UT_Vector3T< T > &a, const UT_Vector3T< T > &b)
Returns the squared distance between two line segments: p0-p1 and a-b.
Definition: UT_Vector3.h:928
int int32
Definition: SYS_Types.h:39
SYS_FORCE_INLINE UT_Vector3T(T v)
Definition: UT_Vector3.h:222
T & y(void)
Definition: UT_Vector4.h:385
GridType::Ptr normalize(const GridType &grid, bool threaded, InterruptT *interrupt)
Normalize the vectors of the given vector-valued grid.
UT_Vector3T< T > colVecMult3(const UT_Matrix4T< S > &m, const UT_Vector3T< T > &v)
Definition: UT_Matrix4.h:1841
SYS_FORCE_INLINE UT_StorageNum< typename UT_StorageBetter< T, S >::Type >::MathFloat distance(const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const
SYS_FORCE_INLINE UT_Vector3T(const fpreal64 v[tuple_size])
Definition: UT_Vector3.h:241
SYS_FORCE_INLINE T & b(void)
Definition: UT_Vector3.h:517
bool SYSisFinite(const UT_Vector3T< T > &v)
Definition: UT_Vector3.h:839
SYS_FORCE_INLINE UT_Vector3T< T > operator-() const
Definition: UT_Vector3.h:281
UT_FixedVector< T, 3, true > Base
Definition: UT_Vector3.h:196
bool SYSequalZero(const UT_Vector3T< T > &v)
Definition: UT_Vector3.h:832
SYS_FORCE_INLINE UT_StorageAtLeast32Bit< T, S >::Type dot(const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const
SYS_FORCE_INLINE UT_Vector3T(const int32 v[tuple_size])
Definition: UT_Vector3.h:244
GLdouble GLdouble GLdouble b
Definition: glew.h:9122
void assign(T xx=0.0f, T yy=0.0f, T zz=0.0f)
Set the values of the vector components.
Definition: UT_Vector3.h:537
GLfloat GLfloat p
Definition: glew.h:16321
SYS_FORCE_INLINE UT_Vector3T< T > & operator=(const UT_Vector3T< S > &v)
Definition: UT_Vector3.h:270
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:509
double fpreal
Definition: SYS_Types.h:276
void dehomogenize(void)
Express the point in homogeneous coordinates or vice-versa.
Definition: UT_Vector3.h:554
UT_API bool intersectSegments(const UT_Vector3T< T > &p0, const UT_Vector3T< T > &p1, const UT_Vector3T< T > &a, const UT_Vector3T< T > &b, T &t)
SYS_FORCE_INLINE T z(void) const
Definition: UT_Vector3.h:512
UT_Vector3T< T > rowVecMult3(const UT_Vector3T< T > &v, const UT_Matrix4T< S > &m)
Definition: UT_Matrix4.h:1819
SYS_FORCE_INLINE UT_Vector3T(T vx, T vy, T vz)
Definition: UT_Vector3.h:229
UT_FixedVector< T, 3 > FixedVectorType
Definition: UT_Vector3.h:986
SYS_FORCE_INLINE T y(void) const
Definition: UT_Vector3.h:510
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
Definition: glew.h:12681
UT_Vector3T< T > colVecMult(const UT_Matrix3T< S > &m, const UT_Vector3T< T > &v)
Definition: UT_Matrix3.h:1473
SYS_FORCE_INLINE T r(void) const
Definition: UT_Vector3.h:514
UT_Vector3T< T > cross(const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
The dot and cross products between two vectors (see operator*() too)
Definition: UT_Vector3.h:748
GLfloat v0
Definition: glew.h:1848
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:76
SYS_FORCE_INLINE Storage::MathFloat normalize()
T & x(void)
Definition: UT_Vector4.h:383
T & y(void)
Definition: UT_Vector2.h:294
SYS_FORCE_INLINE UT_Vector3T()=default
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
Definition: glew.h:12681
UT_Vector3T< T > project(const UT_Vector3T< T > &u, const UT_Vector3T< T > &v)
The orthogonal projection of a vector u onto a vector v.
Definition: UT_Vector3.h:872
SYS_FORCE_INLINE UT_Vector3T(const UT_FixedVector< S, tuple_size, S_INSTANTIATED > &v)
Arbitrary UT_FixedVector of the same size.
Definition: UT_Vector3.h:262
vint4 min(const vint4 &a, const vint4 &b)
Definition: simd.h:4694
SYS_FORCE_INLINE void normal(const UT_Vector3T< T > &va, const UT_Vector3T< T > &vb)
Definition: UT_Vector3.h:383
SYS_FORCE_INLINE void multiplyComponents(const UT_Vector3T< T > &v)
Definition: UT_Vector3.h:294
SYS_FORCE_INLINE Storage::MathFloat length() const
SYS_FORCE_INLINE T & r(void)
Definition: UT_Vector3.h:513
SYS_FORCE_INLINE UT_Vector3T(const fpreal16 v[tuple_size])
Definition: UT_Vector3.h:235
float fpreal32
Definition: SYS_Types.h:195
GLdouble GLdouble t
Definition: glew.h:1398
GLfloat GLfloat v1
Definition: glew.h:1852
GLuint GLenum matrix
Definition: glew.h:14742
UT_API size_t format(char *buffer, size_t buffer_size, const UT_Vector3T< T > &v)
fpreal64 angleTo(const UT_Vector3T< T > &v) const
Definition: UT_Vector3.h:608
SYS_FORCE_INLINE void cross(const UT_Vector3T< T > &v)
Definition: UT_Vector3.h:378
int findMinAbsAxis() const
These allow you to find out what indices to use for different axes.
Definition: UT_Vector3.h:398