HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_Matrix3.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  * COMMENTS:
7  */
8 
9 #ifndef __HOM_Matrix3_h__
10 #define __HOM_Matrix3_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_Defines.h"
14 #include "HOM_Errors.h"
15 #include "HOM_Module.h"
16 #include "HOM_Vector3.h"
17 #include "HOM_PtrOrNull.h"
18 #include <UT/UT_DMatrix3.h>
19 #include <vector>
20 
21 SWIGOUT(%rename(Matrix3) HOM_Matrix3;)
22 
24 {
25 public:
27  {
29  myMatrix3.zero();
30  }
31  HOM_Matrix3(double diagonal_value)
32  {
34  myMatrix3 = diagonal_value;
35  }
36  HOM_Matrix3(const std::vector<double>&values)
37  {
39  setTo(values);
40  }
41  HOM_Matrix3(const std::vector<std::vector<double> > &values)
42  {
44  setTo(values);
45  }
46 
47  SWIGOUT(%ignore HOM_Matrix3(const UT_DMatrix3&);)
48  HOM_Matrix3(const UT_DMatrix3 &matrix3)
49  : myMatrix3(matrix3)
50  { HOM_CONSTRUCT_OBJECT(this) }
51  HOM_Matrix3(const UT_Matrix3 &matrix3)
52  : myMatrix3(matrix3)
53  { HOM_CONSTRUCT_OBJECT(this) }
54 
56  { HOM_DESTRUCT_OBJECT(this) }
57 
59  { return matrix3.myPointer && myMatrix3 == matrix3.myPointer->myMatrix3; }
60 
62  { return !operator==(matrix3); }
63 
64  bool isAlmostEqual(HOM_Matrix3 &matrix3, double tolerance=0.00001);
65 
66  int __hash__();
69 
70  SWIGOUT(%ignore operator=;)
71  HOM_Matrix3 &operator=(const std::vector<std::vector<double> > &tuple);
73  {
74  myMatrix3 = matrix3.myMatrix3;
75  return *this;
76  }
77 
78  double at(int row, int col);
79 
80  std::vector<double> asTuple();
81  std::vector<std::vector<double> > asTupleOfTuples();
82 
83  void setAt(int row, int col, double value);
84  void setTo(const std::vector<double> &tuple);
85  void setTo(const std::vector<std::vector<double> > &tuple);
86 
88  { myMatrix3.identity(); }
89 
90  void setToZero()
91  { myMatrix3.zero(); }
92 
94  { return HOM_Matrix3(myMatrix3 + matrix3.myMatrix3); }
96  { return HOM_Matrix3(myMatrix3 - matrix3.myMatrix3); }
98  { return HOM_Matrix3(myMatrix3 * matrix3.myMatrix3); }
99  HOM_Matrix3 __mul__(double scalar)
100  { return HOM_Matrix3(myMatrix3 * scalar); }
102  { return HOM_Matrix3(matrix3.myMatrix3 * myMatrix3); }
103 
104  HOM_Matrix3 transposed();
105  HOM_Matrix3 inverted();
106  double determinant()
107  { return myMatrix3.determinant(); }
108 
109  SWIGOUT(%kwargs extractRotates;)
110  HOM_Vector3 extractRotates(const char *rotate_order="xyz");
111 
113  { return &myMatrix3; }
114 
115 
116  SWIGOUT(%ignore myMatrix3;)
117  UT_DMatrix3 myMatrix3;
118 };
119 
120 #endif
HOM_Matrix3 preMult(HOM_Matrix3 &matrix3)
Definition: HOM_Matrix3.h:101
UT_DMatrix3 myMatrix3
Definition: HOM_Matrix3.h:117
HOM_Matrix3 __mul__(double scalar)
Definition: HOM_Matrix3.h:99
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1053
double determinant()
Definition: HOM_Matrix3.h:106
virtual int __hash__()=0
HOM_Matrix3 & operator=(const HOM_Matrix3 &matrix3)
Definition: HOM_Matrix3.h:72
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:344
void setToIdentity()
Definition: HOM_Matrix3.h:87
HOM_Matrix3(const std::vector< std::vector< double > > &values)
Definition: HOM_Matrix3.h:41
#define HOM_API
Definition: HOM_API.h:13
HOM_Matrix3 __mul__(HOM_Matrix3 &matrix3)
Definition: HOM_Matrix3.h:97
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1052
void * _asVoidPointer()
Definition: HOM_Matrix3.h:112
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1601
void setToZero()
Definition: HOM_Matrix3.h:90
bool operator!=(HOM_PtrOrNull< HOM_Matrix3 > matrix3)
Definition: HOM_Matrix3.h:61
png_bytepp row
Definition: png.h:1836
HOM_Matrix3(const std::vector< double > &values)
Definition: HOM_Matrix3.h:36
GLsizei const GLfloat * value
Definition: glcorearb.h:823
HOM_Matrix3 __add__(HOM_Matrix3 &matrix3)
Definition: HOM_Matrix3.h:93
HOM_Matrix3(const UT_DMatrix3 &matrix3)
Definition: HOM_Matrix3.h:48
virtual std::string __str__()=0
HOM_Matrix3(const UT_Matrix3 &matrix3)
Definition: HOM_Matrix3.h:51
HOM_Matrix3 __sub__(HOM_Matrix3 &matrix3)
Definition: HOM_Matrix3.h:95
bool operator==(HOM_PtrOrNull< HOM_Matrix3 > matrix3)
Definition: HOM_Matrix3.h:58
HOM_Matrix3(double diagonal_value)
Definition: HOM_Matrix3.h:31
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:590