00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __HOM_Matrix4_h__
00017 #define __HOM_Matrix4_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 "HOM_Matrix3.h"
00025 #include <UT/UT_DMatrix4.h>
00026 #include <vector>
00027 #include <stdexcept>
00028
00029 SWIGOUT(%rename(Matrix4) HOM_Matrix4;)
00030
00031 class HOM_API HOM_Matrix4
00032 {
00033 public:
00034 HOM_Matrix4() throw(HOM_Error)
00035 {
00036 HOM_CONSTRUCT_OBJECT(this)
00037 myMatrix4.zero();
00038 }
00039 HOM_Matrix4(double diagonal_value) throw(HOM_Error)
00040 {
00041 HOM_CONSTRUCT_OBJECT(this)
00042 myMatrix4 = diagonal_value;
00043 }
00044 HOM_Matrix4(const std::vector<double> &values)
00045 throw(HOM_InvalidSize, HOM_Error)
00046 {
00047 HOM_CONSTRUCT_OBJECT(this);
00048 setTo(values);
00049 }
00050 HOM_Matrix4(const std::vector<std::vector<double> > &values)
00051 throw(HOM_InvalidSize, HOM_Error)
00052 {
00053 HOM_CONSTRUCT_OBJECT(this);
00054 setTo(values);
00055 }
00056 HOM_Matrix4(HOM_Matrix3 &matrix3)
00057 {
00058 HOM_CONSTRUCT_OBJECT(this);
00059 myMatrix4 = matrix3.myMatrix3;
00060 }
00061
00062 SWIGOUT(%ignore HOM_Matrix4(const UT_DMatrix4&);)
00063 HOM_Matrix4(const UT_DMatrix4 &matrix4) throw(HOM_Error)
00064 : myMatrix4(matrix4)
00065 { HOM_CONSTRUCT_OBJECT(this) }
00066
00067 ~HOM_Matrix4()
00068 { HOM_DESTRUCT_OBJECT(this) }
00069
00070 bool operator==(HOM_Matrix4 &matrix4)
00071 { return myMatrix4 == matrix4.myMatrix4; }
00072
00073 bool operator!=(HOM_Matrix4 &matrix4)
00074 { return myMatrix4 != matrix4.myMatrix4; }
00075
00076 bool isAlmostEqual(HOM_Matrix4 &matrix4, double tolerance=0.00001);
00077
00078 int __hash__();
00079 std::string __str__();
00080 std::string __repr__();
00081
00082 SWIGOUT(%ignore operator=;)
00083 HOM_Matrix4 &operator=(const std::vector<std::vector<double> > &sequence)
00084 throw(HOM_InvalidSize);
00085 HOM_Matrix4 &operator=(const HOM_Matrix4& matrix4)
00086 {
00087 myMatrix4 = matrix4.myMatrix4;
00088 return *this;
00089 }
00090
00091 double at(int row, int col) throw(std::out_of_range);
00092
00093 SWIGPYTHONOUT(%feature("autodoc",
00094 "asTuple(self) -> tuple of floats") asTuple;)
00095 std::vector<double> asTuple();
00096
00097 SWIGPYTHONOUT(%feature("autodoc",
00098 "asTupleOfTuples(self) -> tuple of tuple of floats") asTupleOfTuples;)
00099 std::vector<std::vector<double> > asTupleOfTuples();
00100
00101 void setAt(int row, int col, double value) throw(std::out_of_range);
00102 void setTo(const std::vector<double> &sequence) throw(HOM_InvalidSize);
00103 void setTo(const std::vector<std::vector<double> > &sequence)
00104 throw(HOM_InvalidSize);
00105
00106 void setToIdentity()
00107 { myMatrix4.identity(); }
00108
00109 void setToZero()
00110 { myMatrix4.zero(); }
00111
00112 HOM_Matrix4 __add__(HOM_Matrix4 &matrix4)
00113 { return HOM_Matrix4(myMatrix4 + matrix4.myMatrix4); }
00114 HOM_Matrix4 __sub__(HOM_Matrix4 &matrix4)
00115 { return HOM_Matrix4(myMatrix4 - matrix4.myMatrix4); }
00116 HOM_Matrix4 __mul__(HOM_Matrix4 &matrix4)
00117 { return HOM_Matrix4(myMatrix4 * matrix4.myMatrix4); }
00118 HOM_Matrix4 __mul__(double scalar)
00119 { return HOM_Matrix4(myMatrix4 * scalar); }
00120 HOM_Matrix4 preMult(HOM_Matrix4 &matrix4)
00121 { return HOM_Matrix4(matrix4.myMatrix4 * myMatrix4); }
00122
00123 HOM_Matrix4 transposed();
00124 HOM_Matrix4 inverted() throw(HOM_OperationFailed);
00125 double determinant()
00126 { return myMatrix4.determinant(); }
00127
00128 SWIGPYTHONOUT(%feature("autodoc",
00129 "explode(self, transform_order='srt', rotate_order='xyz') -> dict of string to Vector3") explode;)
00130 SWIGOUT(%kwargs explode;)
00131 std::map<std::string, HOM_Vector3> explode(
00132 const char *transform_order="srt",
00133 const char *rotate_order="xyz",
00134 const HOM_Vector3 &pivot=HOM_Vector3())
00135 throw(HOM_ValueError, HOM_OperationFailed);
00136
00137 HOM_Vector3 extractTranslates(const char *transform_order="srt")
00138 throw(HOM_OperationFailed, HOM_ValueError);
00139
00140 SWIGPYTHONOUT(%feature("autodoc",
00141 "extractRotates(self, transform_order='srt', rotate_order='xyz', pivot=hou.Vector3()) -> Vector3") extractRotates;)
00142 SWIGOUT(%kwargs extractRotates;)
00143 HOM_Vector3 extractRotates(
00144 const char *transform_order="srt",
00145 const char *rotate_order="xyz",
00146 const HOM_Vector3 &pivot=HOM_Vector3())
00147 throw(HOM_OperationFailed, HOM_ValueError);
00148
00149 SWIGPYTHONOUT(%feature("autodoc",
00150 "extractScales(self, transform_order='srt', pivot=hou.Vector3()) -> Vector3") extractScales;)
00151 SWIGOUT(%kwargs extractScales;)
00152 HOM_Vector3 extractScales(
00153 const char *transform_order="srt",
00154 const HOM_Vector3 &pivot=HOM_Vector3())
00155 throw(HOM_OperationFailed, HOM_ValueError);
00156
00157 SWIGPYTHONOUT(%feature("autodoc",
00158 "extractShears(self, transform_order='srt', pivot=hou.Vector3()) -> Vector3") extractShears;)
00159 SWIGOUT(%kwargs extractShears;)
00160 HOM_Vector3 extractShears(
00161 const char *transform_order="srt",
00162 const HOM_Vector3 &pivot=HOM_Vector3())
00163 throw(HOM_OperationFailed, HOM_ValueError);
00164
00165 SWIGOUT(%newobject extractRotationMatrix3;)
00166 HOM_Matrix3 *extractRotationMatrix3()
00167 throw(HOM_Error);
00168
00169 SWIGOUT(%ignore myMatrix4;)
00170 UT_DMatrix4 myMatrix4;
00171 };
00172
00173 #endif