Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members Related Pages
VrmlMatrix.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 # ifndef OPENVRML_VRMLMATRIX_H
00022 # define OPENVRML_VRMLMATRIX_H
00023
00024 # include <assert.h>
00025 # include <stddef.h>
00026 # include <iostream>
00027 # include <iosfwd>
00028 # include "common.h"
00029
00030 namespace OpenVRML {
00031
00032 class VrmlMatrix;
00033
00034 std::ostream & OPENVRML_SCOPE operator<<(std::ostream & out,
00035 const VrmlMatrix & mat);
00036 bool OPENVRML_SCOPE operator==(const VrmlMatrix & lhs,
00037 const VrmlMatrix & rhs) throw ();
00038 bool OPENVRML_SCOPE operator!=(const VrmlMatrix & lhs,
00039 const VrmlMatrix & rhs) throw ();
00040
00041 class SFVec3f;
00042 class SFRotation;
00043
00044 class OPENVRML_SCOPE VrmlMatrix {
00045 float matrix[4][4];
00046
00047 public:
00048 VrmlMatrix() throw ();
00049 VrmlMatrix(float f11, float f12, float f13, float f14,
00050 float f21, float f22, float f23, float f24,
00051 float f31, float f32, float f33, float f34,
00052 float f41, float f42, float f43, float f44) throw ();
00053 explicit VrmlMatrix(const float m[4][4]) throw ();
00054
00055
00056
00057 float (&operator[](size_t index) throw ())[4];
00058 const float (&operator[](size_t index) const throw ())[4];
00059 const float (&get() const throw ())[4][4];
00060
00061 void setRotate(const float axisAngle[4]) throw ();
00062 void setRotate(const SFRotation & axisAngle) throw ();
00063 void setScale(float s) throw ();
00064 void setScale(const float s[3]) throw ();
00065 void setScale(const SFVec3f & s) throw ();
00066 void setTranslate(const float t[3]) throw ();
00067 void setTranslate(const SFVec3f & t) throw ();
00068
00069 void setTransform(const SFVec3f & translation,
00070 const SFRotation & rotation,
00071 const SFVec3f & scale,
00072 const SFRotation & scaleOrientation,
00073 const SFVec3f & center) throw ();
00074 void getTransform(SFVec3f & translation,
00075 SFRotation & rotation,
00076 SFVec3f & scale) const throw ();
00077 void getTransform(SFVec3f & translation,
00078 SFRotation & rotation,
00079 SFVec3f & scale,
00080 SFVec3f & shear) const throw ();
00081
00082 const VrmlMatrix affine_inverse() const throw ();
00083 const VrmlMatrix transpose() const throw ();
00084
00085 const VrmlMatrix multLeft(const VrmlMatrix & mat) const throw ();
00086 const VrmlMatrix multRight(const VrmlMatrix & mat) const throw ();
00087
00088 void multMatrixVec(const SFVec3f &src, SFVec3f &dst) const throw ();
00089 void multMatrixVec(const float src[3], float dst[3]) const throw ();
00090 void multVecMatrix(const SFVec3f &src, SFVec3f &dst) const throw ();
00091 void multVecMatrix(const float src[3], float dst[3]) const throw ();
00092
00093 float det3(int r1, int r2, int r3, int c1, int c2, int c3) const
00094 throw ();
00095 float det4() const throw ();
00096 };
00097
00098 inline bool operator!=(const VrmlMatrix & lhs, const VrmlMatrix & rhs)
00099 throw ()
00100 {
00101 return !(lhs == rhs);
00102 }
00103
00104 inline float (&VrmlMatrix::operator[](size_t index) throw ())[4]
00105 {
00106 assert(index < 4);
00107 return this->matrix[index];
00108 }
00109
00110 inline const float (&VrmlMatrix::operator[](size_t index) const throw ())[4]
00111 {
00112 assert(index < 4);
00113 return this->matrix[index];
00114 }
00115
00116 inline const float (&VrmlMatrix::get() const throw ())[4][4]
00117 {
00118 return this->matrix;
00119 }
00120 }
00121
00122 #endif // OPENVRML_VRMLMATRIX_H