00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __HOM_Matrix3_h__
00017 #define __HOM_Matrix3_h__
00018
00019 #include "HOM_API.h"
00020 #include "HOM_Defines.h"
00021 #include "HOM_Errors.h"
00022 #include "HOM_Module.h"
00023 #include "HOM_Vector3.h"
00024 #include <UT/UT_DMatrix3.h>
00025 #include <vector>
00026
00027 SWIGOUT(%rename(Matrix3) HOM_Matrix3;)
00028
00029 class HOM_API HOM_Matrix3
00030 {
00031 public:
00032 HOM_Matrix3() throw(HOM_Error)
00033 {
00034 HOM_CONSTRUCT_OBJECT(this)
00035 myMatrix3.zero();
00036 }
00037 HOM_Matrix3(double diagonal_value) throw(HOM_Error)
00038 {
00039 HOM_CONSTRUCT_OBJECT(this)
00040 myMatrix3 = diagonal_value;
00041 }
00042 HOM_Matrix3(const std::vector<double>&values)
00043 throw(HOM_InvalidSize, HOM_Error)
00044 {
00045 HOM_CONSTRUCT_OBJECT(this);
00046 setTo(values);
00047 }
00048
00049 SWIGOUT(%ignore HOM_Matrix3(const UT_DMatrix3&);)
00050 HOM_Matrix3(const UT_DMatrix3 &matrix3) throw(HOM_Error)
00051 : myMatrix3(matrix3)
00052 { HOM_CONSTRUCT_OBJECT(this) }
00053
00054 ~HOM_Matrix3()
00055 { HOM_DESTRUCT_OBJECT(this) }
00056
00057 bool operator==(HOM_Matrix3 &matrix3)
00058 { return myMatrix3 == matrix3.myMatrix3; }
00059
00060 bool operator!=(HOM_Matrix3 &matrix3)
00061 { return myMatrix3 != matrix3.myMatrix3; }
00062
00063 bool isAlmostEqual(HOM_Matrix3 &matrix3, double tolerance=0.00001);
00064
00065 int __hash__();
00066 std::string __str__();
00067 std::string __repr__();
00068
00069 SWIGOUT(%ignore operator=;)
00070 HOM_Matrix3 &operator=(const std::vector<std::vector<double> > &tuple)
00071 throw(HOM_InvalidSize);
00072 HOM_Matrix3 &operator=(const HOM_Matrix3& matrix3)
00073 {
00074 myMatrix3 = matrix3.myMatrix3;
00075 return *this;
00076 }
00077
00078 double at(int row, int col) throw(std::out_of_range);
00079
00080 SWIGPYTHONOUT(%feature("autodoc",
00081 "asTuple(self) -> tuple of floats") asTuple;)
00082 std::vector<double> asTuple();
00083
00084 SWIGPYTHONOUT(%feature("autodoc",
00085 "asTupleOfTuples(self) -> tuple of tuple of floats") asTupleOfTuples;)
00086 std::vector<std::vector<double> > asTupleOfTuples();
00087
00088
00089 void setAt(int row, int col, double value) throw(std::out_of_range);
00090 void setTo(const std::vector<double> &tuple) throw(HOM_InvalidSize);
00091 void setTo(const std::vector<std::vector<double> > &tuple)
00092 throw(HOM_InvalidSize);
00093
00094 void setToIdentity()
00095 { myMatrix3.identity(); }
00096
00097 void setToZero()
00098 { myMatrix3.zero(); }
00099
00100 HOM_Matrix3 __add__(HOM_Matrix3 &matrix3)
00101 { return HOM_Matrix3(myMatrix3 + matrix3.myMatrix3); }
00102 HOM_Matrix3 __sub__(HOM_Matrix3 &matrix3)
00103 { return HOM_Matrix3(myMatrix3 - matrix3.myMatrix3); }
00104 HOM_Matrix3 __mul__(HOM_Matrix3 &matrix3)
00105 { return HOM_Matrix3(myMatrix3 * matrix3.myMatrix3); }
00106 HOM_Matrix3 __mul__(double scalar)
00107 { return HOM_Matrix3(myMatrix3 * scalar); }
00108 HOM_Matrix3 preMult(HOM_Matrix3 &matrix3)
00109 { return HOM_Matrix3(matrix3.myMatrix3 * myMatrix3); }
00110
00111 HOM_Matrix3 transposed();
00112 HOM_Matrix3 inverted() throw(HOM_OperationFailed);
00113 double determinant()
00114 { return myMatrix3.determinant(); }
00115
00116 SWIGOUT(%kwargs extractRotates;)
00117 HOM_Vector3 extractRotates(const char *rotate_order="xyz")
00118 throw(HOM_OperationFailed, HOM_ValueError);
00119
00120 SWIGOUT(%ignore myMatrix3;)
00121 UT_DMatrix3 myMatrix3;
00122 };
00123
00124 #endif