HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HOM_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  * COMMENTS:
7  */
8 
9 #ifndef __HOM_Matrix2_h__
10 #define __HOM_Matrix2_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_Matrix2.h>
19 #include <vector>
20 
21 SWIGOUT(%rename(Matrix2) HOM_Matrix2;)
22 
24 {
25 public:
27  {
29  myMatrix2.zero();
30  }
31  HOM_Matrix2(double diagonal_value)
32  {
34  myMatrix2 = diagonal_value;
35  }
36  HOM_Matrix2(const std::vector<double>&values)
37  {
39  setTo(values);
40  }
41  HOM_Matrix2(const std::vector<std::vector<double> > &values)
42  {
44  setTo(values);
45  }
46 
47  SWIGOUT(%ignore HOM_Matrix2(const UT_DMatrix2&);)
48  HOM_Matrix2(const UT_DMatrix2 &matrix2)
49  : myMatrix2(matrix2)
50  { HOM_CONSTRUCT_OBJECT(this) }
51 
53  { HOM_DESTRUCT_OBJECT(this) }
54 
56  { return matrix2.myPointer && myMatrix2 == matrix2.myPointer->myMatrix2; }
57 
59  { return !operator==(matrix2); }
60 
61  bool isAlmostEqual(HOM_Matrix2 &matrix2, double tolerance=0.00001);
62 
63  int __hash__();
64  std::string __str__();
66 
67  SWIGOUT(%ignore operator=;)
68  HOM_Matrix2 &operator=(const std::vector<std::vector<double> > &tuple);
70  {
71  myMatrix2 = matrix2.myMatrix2;
72  return *this;
73  }
74 
75  double at(int row, int col);
76 
77  std::vector<double> asTuple();
78  std::vector<std::vector<double> > asTupleOfTuples();
79 
80  void setAt(int row, int col, double value);
81  void setTo(const std::vector<double> &tuple);
82  void setTo(const std::vector<std::vector<double> > &tuple);
83 
85  { myMatrix2.identity(); }
86 
87  void setToZero()
88  { myMatrix2.zero(); }
89 
91  { return HOM_Matrix2(myMatrix2 + matrix2.myMatrix2); }
93  { return HOM_Matrix2(myMatrix2 - matrix2.myMatrix2); }
95  { return HOM_Matrix2(myMatrix2 * matrix2.myMatrix2); }
96  HOM_Matrix2 __mul__(double scalar)
97  { return HOM_Matrix2(myMatrix2 * scalar); }
99  { return HOM_Matrix2(matrix2.myMatrix2 * myMatrix2); }
100 
101  HOM_Matrix2 transposed();
102  HOM_Matrix2 inverted();
103  double determinant()
104  { return myMatrix2.determinant(); }
105 
107  { return &myMatrix2; }
108 
109 
110  SWIGOUT(%ignore myMatrix2;)
111  UT_DMatrix2 myMatrix2;
112 };
113 
114 #endif
HOM_Matrix2 __mul__(double scalar)
Definition: HOM_Matrix2.h:96
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:974
HOM_Matrix2(const std::vector< double > &values)
Definition: HOM_Matrix2.h:36
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
HOM_Matrix2 __sub__(HOM_Matrix2 &matrix2)
Definition: HOM_Matrix2.h:92
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
void setToIdentity()
Definition: HOM_Matrix2.h:84
HOM_Matrix2 & operator=(const HOM_Matrix2 &matrix2)
Definition: HOM_Matrix2.h:69
HOM_Matrix2 __add__(HOM_Matrix2 &matrix2)
Definition: HOM_Matrix2.h:90
void * _asVoidPointer()
Definition: HOM_Matrix2.h:106
HOM_Matrix2(const std::vector< std::vector< double > > &values)
Definition: HOM_Matrix2.h:41
void setToZero()
Definition: HOM_Matrix2.h:87
#define HOM_API
Definition: HOM_API.h:13
bool operator==(HOM_PtrOrNull< HOM_Matrix2 > matrix2)
Definition: HOM_Matrix2.h:55
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:973
HOM_Matrix2(const UT_DMatrix2 &matrix2)
Definition: HOM_Matrix2.h:48
double determinant()
Definition: HOM_Matrix2.h:103
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1601
png_bytepp row
Definition: png.h:1836
HOM_Matrix2 preMult(HOM_Matrix2 &matrix2)
Definition: HOM_Matrix2.h:98
GLsizei const GLfloat * value
Definition: glcorearb.h:823
bool operator!=(HOM_PtrOrNull< HOM_Matrix2 > matrix2)
Definition: HOM_Matrix2.h:58
virtual std::string __repr__()=0
HOM_Matrix2(double diagonal_value)
Definition: HOM_Matrix2.h:31
virtual int __hash__()=0
UT_DMatrix2 myMatrix2
Definition: HOM_Matrix2.h:111
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:596
HOM_Matrix2 __mul__(HOM_Matrix2 &matrix2)
Definition: HOM_Matrix2.h:94