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