HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Matrix2.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  */
7 
8 #pragma once
9 
10 #ifndef __UT_Matrix2_h__
11 #define __UT_Matrix2_h__
12 
13 #include "UT_API.h"
14 #include "UT_Assert.h"
15 #include "UT_FixedVector.h"
16 #include "UT_VectorTypes.h"
17 
18 #include <SYS/SYS_Types.h>
19 #include <SYS/SYS_Math.h>
20 #include <SYS/SYS_StaticAssert.h>
21 #include <iosfwd>
22 
23 class UT_IStream;
24 class UT_JSONWriter;
25 class UT_JSONValue;
26 class UT_JSONParser;
27 
28 // Free floating operators that return a UT_Matrix2T<T> object.
29 template <typename T> UT_API
31 template <typename T, typename S> UT_API
33 template <typename T, typename S> UT_API
35 template <typename T> UT_API
37 template <typename T> UT_API
39 
40 template <typename T> UT_API
42 template <typename T, typename S> UT_API
44 template <typename T, typename S> UT_API
46 template <typename T> UT_API
48 template <typename T> UT_API
50 
51 template <typename T> UT_API
53 template <typename T,typename S> UT_API
55 template <typename T,typename S> UT_API
57 
58 template <typename T> UT_API
60 template <typename T> UT_API
62 
63 template <typename T>
64 inline UT_Matrix2T<T> SYSmin (const UT_Matrix2T<T> &v1, const UT_Matrix2T<T> &v2);
65 template <typename T>
66 inline UT_Matrix2T<T> SYSmax (const UT_Matrix2T<T> &v1, const UT_Matrix2T<T> &v2);
67 template <typename T,typename S>
68 inline UT_Matrix2T<T> SYSlerp(const UT_Matrix2T<T> &v1, const UT_Matrix2T<T> &v2, S t);
69 
70 /// Bilinear interpolation
71 template <typename T,typename S>
72 inline UT_Matrix2T<T> SYSbilerp(const UT_Matrix2T<T> &u0v0, const UT_Matrix2T<T> &u1v0,
73  const UT_Matrix2T<T> &u0v1, const UT_Matrix2T<T> &u1v1,
74  S u, S v)
75 { return SYSlerp(SYSlerp(u0v0, u0v1, v), SYSlerp(u1v0, u1v1, v), u); }
76 
77 /// Barycentric interpolation
78 template <typename T, typename S>
80  const UT_Matrix2T<T> &v1, const UT_Matrix2T<T> &v2, S u, S v)
81 { return v0 * (1 - u - v) + v1 * u + v2 *v; }
82 
83 
84 /// This class implements a 2x2 matrix in row-major order.
85 ///
86 /// Most of Houdini operates with row vectors that are left-multiplied with
87 /// matrices. e.g., z = v * M
88 template <typename T>
90 {
91 public:
92 
93  typedef T value_type;
94  static const int tuple_size = 4;
95 
96  /// Construct uninitialized matrix.
97  SYS_FORCE_INLINE UT_Matrix2T() = default;
98 
99  /// Default copy constructor
100  constexpr UT_Matrix2T(const UT_Matrix2T &) = default;
101 
102  /// Default move constructor
103  constexpr UT_Matrix2T(UT_Matrix2T &&) = default;
104 
105  /// Construct identity matrix, multipled by scalar.
106  explicit constexpr UT_Matrix2T(T val) noexcept
107  : matx{{val,T(0)},{T(0),val}}
108  {
109  SYS_STATIC_ASSERT(sizeof(UT_Matrix2T<T>) == tuple_size * sizeof(T));
110  }
111  /// Construct a deep copy of the input row-major data.
112  /// @{
113  explicit constexpr UT_Matrix2T(const fpreal32 m[2][2]) noexcept
114  : matx{{T(m[0][0]),T(m[0][1])},{T(m[1][0]),T(m[1][1])}}
115  {}
116  explicit constexpr UT_Matrix2T(const fpreal64 m[2][2]) noexcept
117  : matx{{T(m[0][0]),T(m[0][1])},{T(m[1][0]),T(m[1][1])}}
118  {}
119  /// @}
120 
121  /// Arbitrary UT_FixedVector of the same size
122  template <typename S>
124  : matx{{T(v[0]),T(v[1])},{T(v[2]),T(v[3])}}
125  {}
126 
127  /// This constructor is for convenience.
128  constexpr UT_Matrix2T(T val00, T val01, T val10, T val11) noexcept
129  : matx{{val00,val01},{val10,val11}}
130  {}
131 
132  /// Base type conversion constructor
133  template <typename S>
134  UT_Matrix2T(const UT_Matrix2T<S> &m) noexcept
135  : matx{{T(m(0,0)),T(m(0,1))},{T(m(1,0)),T(m(1,1))}}
136  {}
137 
138  /// Conversion to a 2x2 from a 3x3 matrix by ignoring the
139  /// last row and last column.
140  template <typename S>
141  explicit UT_Matrix2T(const UT_Matrix3T<S> &m) noexcept
142  : matx{{T(m(0,0)),T(m(0,1))},{T(m(1,0)),T(m(1,1))}}
143  {}
144 
145  /// Default copy assignment operator
146  UT_Matrix2T<T> &operator=(const UT_Matrix2T<T> &m) = default;
147 
148  /// Default move assignment operator
149  UT_Matrix2T<T> &operator=(UT_Matrix2T<T> &&m) = default;
150 
151  /// Conversion operator that returns a 2x2 from a 3x3 matrix by ignoring the
152  /// last row and last column.
153  template <typename S>
154  UT_Matrix2T<T> &operator=(const UT_Matrix3T<S> &m);
155 
157  {
158  return UT_Matrix2T<T>(
159  -matx[0][0], -matx[0][1],
160  -matx[1][0], -matx[1][1]);
161  }
162 
164  {
165  matx[0][0]+=m.matx[0][0]; matx[0][1]+=m.matx[0][1];
166  matx[1][0]+=m.matx[1][0]; matx[1][1]+=m.matx[1][1];
167  return *this;
168  }
170  {
171  matx[0][0]-=m.matx[0][0]; matx[0][1]-=m.matx[0][1];
172  matx[1][0]-=m.matx[1][0]; matx[1][1]-=m.matx[1][1];
173  return *this;
174  }
176 
177  constexpr bool operator==(const UT_Matrix2T<T> &m) const noexcept
178  {
179  return (&m == this) || (
180  matx[0][0]==m(0,0) && matx[0][1]==m(0,1) &&
181  matx[1][0]==m(1,0) && matx[1][1]==m(1,1) );
182  }
183  constexpr bool operator!=(const UT_Matrix2T<T> &m) const noexcept
184  {
185  return !(*this == m);
186  }
187 
189  {
190  matx[0][0] = val; matx[0][1] = 0;
191  matx[1][0] = 0; matx[1][1] = val;
192  return *this;
193  }
195  {
196  matx[0][0]+=scalar; matx[0][1]+=scalar;
197  matx[1][0]+=scalar; matx[1][1]+=scalar;
198  return *this;
199  }
201  {
202  return operator+=(-scalar);
203  }
205  {
206  matx[0][0]*=scalar; matx[0][1]*=scalar;
207  matx[1][0]*=scalar; matx[1][1]*=scalar;
208  return *this;
209  }
211  {
212  return operator*=( 1.0f/scalar );
213  }
214 
215  // Vector2 operators:
216  template <typename S>
217  inline
218  UT_Matrix2T<T> &operator=(const UT_Vector2T<S> &vec);
219  template <typename S>
220  inline
222  template <typename S>
223  inline
225 
226  constexpr T determinant() const noexcept
227  {
228  return matx[0][0]*matx[1][1] - matx[0][1]*matx[1][0];
229  }
230  constexpr T trace() const noexcept
231  { return matx[0][0] + matx[1][1]; }
232 
233  /// Returns eigenvalues of this matrix
234  template <typename S>
235  int eigenvalues(UT_Vector2T<S> &r, UT_Vector2T<S> &i) const;
236 
237  /// Invert this matrix and return 0 if OK, 1 if singular.
238  int invert()
239  {
240  // NOTE: The other invert function should work on *this,
241  // since it does all reading before all writing.
242  return invert(*this);
243  }
244 
245  /// Invert the matrix and return 0 if OK, 1 if singular.
246  /// Puts the inverted matrix in m, and leaves this matrix unchanged.
247  int invert(UT_Matrix2T<T> &m) const
248  {
249  // Effectively rescale the matrix for the determinant check,
250  // because if the whole matrix is close to zero, having a
251  // small determinant may be fine.
252  T scale2 = SYSmax(matx[0][0]*matx[0][0],
253  matx[0][1]*matx[0][1],
254  matx[1][0]*matx[1][0],
255  matx[1][1]*matx[1][1]);
256  T det = determinant();
257  if (!SYSequalZero(det, tolerance()*scale2))
258  {
259  // Finish all reading before writing to m,
260  // so that invert() can call invert(*this)
261  m = UT_Matrix2T<T>( matx[1][1],-matx[0][1],
262  -matx[1][0], matx[0][0]);
263  m *= (1.0f/det);
264 
265  return 0;
266  }
267  return 1;
268  }
269 
270  /// Returns the tolerance of our class.
271  T tolerance() const;
272 
273  // Solve a 2x2 system of equations Ax=b, where A is this matrix, b is
274  // given and x is unknown. The method returns 0 if the determinant is not
275  // 0, and 1 otherwise.
276  template <typename S>
277  int solve(const UT_Vector2T<S> &b, UT_Vector2T<S> &x) const
278  {
279  // Effectively rescale the matrix for the determinant check,
280  // because if the whole matrix is close to zero, having a
281  // small determinant may be fine.
282  T scale2 = SYSmax(matx[0][0]*matx[0][0],
283  matx[0][1]*matx[0][1],
284  matx[1][0]*matx[1][0],
285  matx[1][1]*matx[1][1]);
286  T det = determinant();
287  if (!SYSequalZero(det, tolerance()*scale2))
288  {
289  T recipdet = 1.0f/det;
290  x = UT_Vector2T<S>(
291  recipdet * (matx[1][1]*b.x() - matx[0][1]*b.y()),
292  recipdet * (matx[0][0]*b.y() - matx[1][0]*b.x()));
293  return 0;
294  }
295  return 1;
296  }
297 
298  // Transpose this matrix or return its transpose.
299  void transpose(void)
300  {
301  T tmp;
302  tmp=matx[0][1]; matx[0][1]=matx[1][0]; matx[1][0]=tmp;
303  }
304  UT_Matrix2T<T> transpose(void) const;
305 
306  // check for equality within a tolerance level
307  bool isEqual( const UT_Matrix2T<T> &m,
308  T tolerance=T(SYS_FTOLERANCE) ) const
309  {
310  return (&m == this) || (
311  SYSisEqual( matx[0][0], m.matx[0][0], tolerance ) &&
312  SYSisEqual( matx[0][1], m.matx[0][1], tolerance ) &&
313 
314  SYSisEqual( matx[1][0], m.matx[1][0], tolerance ) &&
315  SYSisEqual( matx[1][1], m.matx[1][1], tolerance ) );
316  }
317 
318  // Matrix += b * v1 * v2T
319  template <typename S>
321  const UT_Vector2T<S> &v1, const UT_Vector2T<S> &v2)
322  {
323  T bv1;
324  bv1 = b * v1.x();
325  matx[0][0]+=bv1*v2.x();
326  matx[0][1]+=bv1*v2.y();
327  bv1 = b * v1.y();
328  matx[1][0]+=bv1*v2.x();
329  matx[1][1]+=bv1*v2.y();
330  }
331 
332  /// Set the matrix to identity
333  void identity()
334  {
335  matx[0][0]=(T)1;matx[0][1]=(T)0;
336  matx[1][0]=(T)0;matx[1][1]=(T)1;
337  }
338  /// Set the matrix to zero
339  void zero() { *this = 0; }
340 
341  bool isIdentity() const
342  {
343  // NB: DO NOT USE TOLERANCES
344  return(
345  matx[0][0]==1.0f && matx[0][1]==0.0f &&
346  matx[1][0]==0.0f && matx[1][1]==1.0f);
347  }
348  bool isZero() const
349  {
350  // NB: DO NOT USE TOLERANCES
351  return (
352  matx[0][0]==0.0f && matx[0][1]==0.0f &&
353  matx[1][0]==0.0f && matx[1][1]==0.0f);
354  }
355 
356  /// Create a rotation matrix for the given angle in radians
357  static UT_Matrix2T<T> rotationMat(T theta);
358 
359  /// Rotate by theta radians
360  void rotate(T theta)
361  { (*this) *= rotationMat(theta); }
362 
363  /// Multiply this matrix by a scale matrix with diagonal (sx, sy):
364  /// @{
365  void scale(T sx, T sy)
366  {
367  matx[0][0] *= sx; matx[0][1] *= sy;
368  matx[1][0] *= sx; matx[1][1] *= sy;
369  }
370  inline void scale(const UT_Vector2T<T> &s)
371  { scale(s(0), s(1)); }
372  /// @}
373 
374  /// Initialize this matrix to zero.
375  void initialize()
376  {
377  matx[0][0]=matx[0][1]= (T)0;
378  matx[1][0]=matx[1][1]= (T)0;
379  }
380 
381  /// Return a matrix entry. No bounds checking on subscripts.
382  // @{
383  SYS_FORCE_INLINE T &operator()(unsigned row, unsigned col) noexcept
384  {
385  UT_ASSERT_P(row < 2 && col < 2);
386  return matx[row][col];
387  }
388  SYS_FORCE_INLINE T operator()(unsigned row, unsigned col) const noexcept
389  {
390  UT_ASSERT_P(row < 2 && col < 2);
391  return matx[row][col];
392  }
393  // @}
394 
395  /// Return the raw matrix data.
396  // @{
397  const T *data(void) const { return myFloats; }
398  T *data(void) { return myFloats; }
399  // @}
400 
401  /// Compute a hash
402  unsigned hash() const { return SYSvector_hash(data(), tuple_size); }
403 
404  /// Return a matrix row. No bounds checking on subscript.
405  // @{
406  T *operator()(unsigned row)
407  {
408  UT_ASSERT_P(row < 2);
409  return matx[row];
410  }
411  const T *operator()(unsigned row) const
412  {
413  UT_ASSERT_P(row < 2);
414  return matx[row];
415  }
416  inline
417  const UT_Vector2T<T> &operator[](unsigned row) const;
418  inline
419  UT_Vector2T<T> &operator[](unsigned row);
420  // @}
421 
422  /// Euclidean or Frobenius norm of a matrix.
423  /// Does sqrt(sum(a_ij ^2))
425  { return SYSsqrt(getEuclideanNorm2()); }
426  /// Euclidean norm squared.
427  T getEuclideanNorm2() const;
428 
429  // I/O methods. Return 0 if read/write successful, -1 if unsuccessful.
430  int save(std::ostream &os, int binary) const;
431  bool load(UT_IStream &is);
432 
433  void outAsciiNoName(std::ostream &os) const;
434 
435  /// @{
436  /// Methods to serialize to a JSON stream. The matrix is stored as an
437  /// array of 4 reals.
438  bool save(UT_JSONWriter &w) const;
439  bool save(UT_JSONValue &v) const;
440  bool load(UT_JSONParser &p);
441  /// @}
442 
443  // I/O friends:
444  friend std::ostream &operator<<(std::ostream &os, const UT_Matrix2T<T> &v)
445  {
446  // v.className(os);
447  v.outAsciiNoName(os);
448  return os;
449  }
450 
451  /// Returns the vector size
452  static int entries() { return tuple_size; }
453 
454 private:
455  void writeClassName(std::ostream &os) const;
456  static const char *className();
457 
458  union {
459  T matx[2][2];
460  T myFloats[tuple_size];
461  };
462 };
463 
464 #include "UT_Vector2.h"
465 
466 template <>
467 inline
469 {
470  return 1e-5f;
471 }
472 
473 template <>
474 inline
476 {
477  return 1e-11;
478 }
479 
480 // Special instantiations to handle the fact that we have UT_Vector2T<int64>::getBary()
481 template <>
482 inline
484 {
485  return 0;
486 }
487 
488 template <>
489 inline
491 {
492  return 0;
493 }
494 
495 template <typename T>
496 template <typename S>
497 inline
499 {
500  matx[0][0] = matx[0][1] = vec.x();
501  matx[1][0] = matx[1][1] = vec.y();
502  return *this;
503 }
504 
505 template <typename T>
506 template <typename S>
507 inline
509 {
510  matx[0][0]+=vec.x(); matx[0][1]+=vec.x();
511  matx[1][0]+=vec.y(); matx[1][1]+=vec.y();
512  return *this;
513 }
514 
515 template <typename T>
516 template <typename S>
517 inline
519 {
520  matx[0][0]-=vec.x(); matx[0][1]-=vec.x();
521  matx[1][0]-=vec.y(); matx[1][1]-=vec.y();
522  return *this;
523 }
524 
525 template <typename T>
526 inline
528 {
529  UT_ASSERT_P(row < 2);
530  return *(const UT_Vector2T<T>*)(matx[row]);
531 }
532 
533 template <typename T>
534 inline
536 {
537  UT_ASSERT_P(row < 2);
538  return *(UT_Vector2T<T>*)(matx[row]);
539 }
540 
541 
542 // Free floating functions:
543 template <typename T, typename S>
544 inline
546 {
547  return mat+vec;
548 }
549 
550 template <typename T>
551 inline
553 {
554  return m1+sc;
555 }
556 
557 template <typename T>
558 inline
560 {
561  return m1+(-sc);
562 }
563 
564 template <typename T,typename S>
565 inline
567 {
568  return m1*sc;
569 }
570 
571 template <typename T>
572 inline
574 {
575  return m1 * (1.0f/scalar);
576 }
577 
578 template <typename T>
579 inline
581 {
582  return UT_Matrix2T<T>(
583  SYSmin(v1(0,0), v2(0,0)),
584  SYSmin(v1(0,1), v2(0,1)),
585  SYSmin(v1(1,0), v2(1,0)),
586  SYSmin(v1(1,1), v2(1,1))
587  );
588 }
589 
590 template <typename T>
591 inline
593 {
594  return UT_Matrix2T<T>(
595  SYSmax(v1(0,0), v2(0,0)),
596  SYSmax(v1(0,1), v2(0,1)),
597  SYSmax(v1(1,0), v2(1,0)),
598  SYSmax(v1(1,1), v2(1,1))
599  );
600 }
601 
602 template <typename T,typename S>
603 inline
605 {
606  return UT_Matrix2T<T>(
607  SYSlerp(v1(0,0), v2(0,0), t),
608  SYSlerp(v1(0,1), v2(0,1), t),
609  SYSlerp(v1(1,0), v2(1,0), t),
610  SYSlerp(v1(1,1), v2(1,1), t)
611  );
612 }
613 
614 #ifndef UT_DISABLE_VECTORIZE_MATRIX
615 template <>
616 inline
618 {
619  const v4uf l(v1.data());
620  const v4uf r(v2.data());
621 
622  UT_Matrix2T<float> result_mat;
623  vm_store(result_mat.data(), SYSlerp(l, r, t).vector);
624  return result_mat;
625 }
626 #endif
627 
628 template<typename T>
630 {
632  typedef T DataType;
633  static const exint TupleSize = 4;
634  static const bool isVectorType = true;
635 };
636 
637 // Overload for custom formatting of UT_Matrix2T<T> with UTformat.
638 template<typename T>
639 UT_API size_t format(char *buffer, size_t buffer_size, const UT_Matrix2T<T> &v);
640 
641 #endif
GLdouble s
Definition: glew.h:1390
void identity()
Set the matrix to identity.
Definition: UT_Matrix2.h:333
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
GLboolean invert
Definition: glew.h:1422
void rotate(T theta)
Rotate by theta radians.
Definition: UT_Matrix2.h:360
#define SYS_STATIC_ASSERT(expr)
void initialize()
Initialize this matrix to zero.
Definition: UT_Matrix2.h:375
constexpr UT_Matrix2T(const fpreal32 m[2][2]) noexcept
Definition: UT_Matrix2.h:113
constexpr T determinant() const noexcept
Definition: UT_Matrix2.h:226
T tolerance() const
Returns the tolerance of our class.
const T * operator()(unsigned row) const
Return a matrix row. No bounds checking on subscript.
Definition: UT_Matrix2.h:411
constexpr bool operator!=(const UT_Matrix2T< T > &m) const noexcept
Definition: UT_Matrix2.h:183
int solve(const UT_Vector2T< S > &b, UT_Vector2T< S > &x) const
Definition: UT_Matrix2.h:277
SYS_FORCE_INLINE T & operator()(unsigned row, unsigned col) noexcept
Return a matrix entry. No bounds checking on subscripts.
Definition: UT_Matrix2.h:383
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
GLenum GLenum GLenum GLenum GLenum scale
Definition: glew.h:13880
UT_API size_t format(char *buffer, size_t buffer_size, const UT_Matrix2T< T > &v)
SYS_FORCE_INLINE T operator()(unsigned row, unsigned col) const noexcept
Return a matrix entry. No bounds checking on subscripts.
Definition: UT_Matrix2.h:388
T & x(void)
Definition: UT_Vector2.h:292
UT_Matrix2T< T > & operator=(T val)
Definition: UT_Matrix2.h:188
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:75
#define UT_API
Definition: UT_API.h:13
UT_Matrix2T< T > SYSbilerp(const UT_Matrix2T< T > &u0v0, const UT_Matrix2T< T > &u1v0, const UT_Matrix2T< T > &u0v1, const UT_Matrix2T< T > &u1v1, S u, S v)
Bilinear interpolation.
Definition: UT_Matrix2.h:72
const GLdouble * m
Definition: glew.h:9124
GLdouble l
Definition: glew.h:9122
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
const GLdouble * v
Definition: glew.h:1391
static const exint TupleSize
UT_Matrix2T< T > & operator/=(T scalar)
Definition: UT_Matrix2.h:210
UT_Matrix2T< T > SYSlerp(const UT_Matrix2T< T > &v1, const UT_Matrix2T< T > &v2, S t)
Definition: UT_Matrix2.h:604
void scale(T sx, T sy)
Definition: UT_Matrix2.h:365
2D Vector class.
Definition: UT_Vector2.h:145
const T * data(void) const
Return the raw matrix data.
Definition: UT_Matrix2.h:397
UT_Matrix2T< T > SYSbarycentric(const UT_Matrix2T< T > &v0, const UT_Matrix2T< T > &v1, const UT_Matrix2T< T > &v2, S u, S v)
Barycentric interpolation.
Definition: UT_Matrix2.h:79
static int entries()
Returns the vector size.
Definition: UT_Matrix2.h:452
void scale(const UT_Vector2T< T > &s)
Definition: UT_Matrix2.h:370
unsigned hash() const
Compute a hash.
Definition: UT_Matrix2.h:402
constexpr UT_Matrix2T(T val) noexcept
Construct identity matrix, multipled by scalar.
Definition: UT_Matrix2.h:106
void transpose(void)
Definition: UT_Matrix2.h:299
T * operator()(unsigned row)
Return a matrix row. No bounds checking on subscript.
Definition: UT_Matrix2.h:406
long long int64
Definition: SYS_Types.h:111
GLfloat GLfloat GLfloat v2
Definition: glew.h:1856
T getEuclideanNorm() const
Definition: UT_Matrix2.h:424
GLclampf f
Definition: glew.h:3499
GLint GLint GLint GLint GLint x
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
OIIO_FORCEINLINE const vint4 & operator+=(vint4 &a, const vint4 &b)
Definition: simd.h:4246
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
static const bool isVectorType
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1890
Definition: VM_SIMD.h:188
T matx[2][2]
Definition: UT_Matrix2.h:459
bool isZero() const
Definition: UT_Matrix2.h:348
UT_Matrix2T< T > & operator=(UT_Matrix2T< T > &&m)=default
Default move assignment operator.
UT_Matrix2T< T > & operator+=(const UT_Matrix2T< T > &m)
Definition: UT_Matrix2.h:163
int int32
Definition: SYS_Types.h:39
const Vec2< S > & operator*=(Vec2< S > &v, const Matrix33< T > &m)
Definition: ImathMatrix.h:3322
int invert(UT_Matrix2T< T > &m) const
Definition: UT_Matrix2.h:247
bool isIdentity() const
Definition: UT_Matrix2.h:341
bool SYSequalZero(const UT_Vector3T< T > &v)
Definition: UT_Vector3.h:832
class UT_API UT_Matrix2T
UT_Matrix2T< T > & operator-=(const UT_Matrix2T< T > &m)
Definition: UT_Matrix2.h:169
GLdouble GLdouble GLdouble b
Definition: glew.h:9122
GLfloat GLfloat p
Definition: glew.h:16321
const UT_Vector2T< T > & operator[](unsigned row) const
Return a matrix row. No bounds checking on subscript.
Definition: UT_Matrix2.h:527
void zero()
Set the matrix to zero.
Definition: UT_Matrix2.h:339
UT_API UT_Matrix2T< T > operator/(const UT_Matrix2T< T > &mat, T sc)
Definition: UT_Matrix2.h:573
UT_Matrix2T< T > operator-() const
Definition: UT_Matrix2.h:156
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
void outerproductUpdate(T b, const UT_Vector2T< S > &v1, const UT_Vector2T< S > &v2)
Definition: UT_Matrix2.h:320
GLfloat v0
Definition: glew.h:1848
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:76
T * data(void)
Return the raw matrix data.
Definition: UT_Matrix2.h:398
bool isEqual(const UT_Matrix2T< T > &m, T tolerance=T(SYS_FTOLERANCE)) const
Definition: UT_Matrix2.h:307
UT_Matrix2T< T > SYSmin(const UT_Matrix2T< T > &v1, const UT_Matrix2T< T > &v2)
Definition: UT_Matrix2.h:580
OIIO_FORCEINLINE const vint4 & operator-=(vint4 &a, const vint4 &b)
Definition: simd.h:4269
#define SYS_FTOLERANCE
Definition: SYS_Types.h:207
T & y(void)
Definition: UT_Vector2.h:294
UT_Matrix2T< T > & operator-=(T scalar)
Definition: UT_Matrix2.h:200
int invert()
Invert this matrix and return 0 if OK, 1 if singular.
Definition: UT_Matrix2.h:238
#define const
Definition: zconf.h:214
GLenum GLenum void * row
Definition: glew.h:4965
UT_Matrix2T< T > & operator+=(T scalar)
Definition: UT_Matrix2.h:194
UT_Matrix2T< T > & operator*=(T scalar)
Definition: UT_Matrix2.h:204
UT_Matrix2T< T > SYSmax(const UT_Matrix2T< T > &v1, const UT_Matrix2T< T > &v2)
Definition: UT_Matrix2.h:592
constexpr bool operator==(const UT_Matrix2T< T > &m) const noexcept
Definition: UT_Matrix2.h:177
constexpr T trace() const noexcept
Definition: UT_Matrix2.h:230
float fpreal32
Definition: SYS_Types.h:195
GLdouble GLdouble t
Definition: glew.h:1398
GLfloat GLfloat v1
Definition: glew.h:1852
UT_FixedVector< T, 4 > FixedVectorType
Definition: UT_Matrix2.h:631
GLsizei GLboolean transpose
Definition: glew.h:1864