38 memset(&
m_m,0,
sizeof(
m_m));
74 memcpy(
m_m,&_m.m_m,
sizeof(
m_m));
101 memset(&
m_m,0,
sizeof(
m_m));
107 memset(
m_m,0,
sizeof(
m_m));
119 temp.
m_m[0][0] =
m_m[0][0] * _m.m_m[0][0] +
m_m[0][1] * _m.m_m[1][0] +
m_m[0][2] * _m.m_m[2][0] ;
120 temp.
m_m[0][1] =
m_m[0][0] * _m.m_m[0][1] +
m_m[0][1] * _m.m_m[1][1] +
m_m[0][2] * _m.m_m[2][1] ;
121 temp.
m_m[0][2] =
m_m[0][0] * _m.m_m[0][2] +
m_m[0][1] * _m.m_m[1][2] +
m_m[0][2] * _m.m_m[2][2] ;
122 temp.
m_m[1][0] =
m_m[1][0] * _m.m_m[0][0] +
m_m[1][1] * _m.m_m[1][0] +
m_m[1][2] * _m.m_m[2][0] ;
123 temp.
m_m[1][1] =
m_m[1][0] * _m.m_m[0][1] +
m_m[1][1] * _m.m_m[1][1] +
m_m[1][2] * _m.m_m[2][1] ;
124 temp.
m_m[1][2] =
m_m[1][0] * _m.m_m[0][2] +
m_m[1][1] * _m.m_m[1][2] +
m_m[1][2] * _m.m_m[2][2] ;
125 temp.
m_m[2][0] =
m_m[2][0] * _m.m_m[0][0] +
m_m[2][1] * _m.m_m[1][0] +
m_m[2][2] * _m.m_m[2][0] ;
126 temp.
m_m[2][1] =
m_m[2][0] * _m.m_m[0][1] +
m_m[2][1] * _m.m_m[1][1] +
m_m[2][2] * _m.m_m[2][1] ;
127 temp.
m_m[2][2] =
m_m[2][0] * _m.m_m[0][2] +
m_m[2][1] * _m.m_m[1][2] +
m_m[2][2] * _m.m_m[2][2] ;
186 const Real* iterB = &_m.m_openGL[0];
190 for( ; iterA !=
end; ++iterA, ++iterB, ++iterR)
192 *iterR = *iterA + *iterB;
200 const Real* iterB = &_m.m_openGL[0];
203 for( ; iterA !=
end; ++iterA, ++iterB)
217 for( ; iterA !=
end; ++iterA, ++iterB)
219 *iterB = (*iterA) * _i;
227 for(
int y=0;
y<3; ++
y)
229 for(
int x=0;
x<3; ++
x)
247 for(
int col=0; col<3; ++col)
261 Real sr = sinf( beta );
262 Real cr = cosf( beta );
273 Real sr = sinf( beta );
274 Real cr = cosf( beta );
285 Real sr = sinf( beta );
286 Real cr = cosf( beta );
332 m_m[0][0]=_x*xC+
c;
m_m[0][1]= xyC-zs;
m_m[0][2]= zxC+ys;
333 m_m[1][0]=xyC+zs;
m_m[1][1]=_y*yC+
c;
m_m[1][2]= yzC-xs;
334 m_m[2][0]=zxC-ys;
m_m[2][1]=yzC+xs;
m_m[2][2]=_z*zC+
c;
351 std::cerr<<
"ngl 0 determinant \n";
Real determinant() const noexcept
get the determinant of the matrix
some useful definitions and functions
Vec3 getLeftVector() const noexcept
get the left vector of the matrix (-ve 1st Row)
Mat3 basic 3x3 matrix for certain glsl ops.
Mat3 inverse() noexcept
set the matrix to be the inverse
Real m_00
individual matrix element maps to m_m[0][0] or m_openGL[0]
Vec3 getRightVector() const noexcept
get the right vector of the matrix ( 1nd Row)
void rotateX(Real _deg) noexcept
set this matrix to a rotation matrix in the X axis for value _deg note the matrix should be set to id...
Real m_12
individual matrix element maps to m_m[1][2] or m_openGL[6]
std::array< Real, 9 > m_openGL
The matrix in m_openGL 16 Real array format usefull for OpenGL fv formats mapped to m_m[][] elements ...
GLint GLint GLint GLint GLint GLint y
Real m_m[3][3]
Mat3 element m_m as a 4x4 array mapped by union to m_nn elements and m_openGL.
simple Vec3 encapsulates a 3 float object like glsl vec3 but not maths use the Vec3 class for maths a...
implementation files for RibExport class
PRECISION Real
create a variable called Real which is the main data type we use (GLfloat for most cases) ...
Mat3 operator*(const Mat3 &_m) const noexcept
operator for matrix multiplication
a simple 2 tuple container for compatibility with glsl
void euler(Real _angle, Real _x, Real _y, Real _z) noexcept
axis / angle rotation using the Euler method
Vec3 getUpVector() const noexcept
get the up vector of the matrix (2nd Row)
const Mat3 & transpose() noexcept
method to transpose the matrix
void setAtXY(GLint _x, GLint _y, Real _equals) noexcept
set the value at m_m[_x][_y] to _equals
Defines the class Quaternion based on John Vinces lecture notes basically we have a scalar part and t...
Real m_11
individual matrix element maps to m_m[1][1] or m_openGL[5]
const Mat3 & null() noexcept
clear the matrix to all 0
Vec3 getDownVector() const noexcept
get the down vector of the matrix ( -ve 2nd Row)
Mat3() noexcept
ctor will always create an identity matrix
Vec3 getForwardVector() const noexcept
get the forward vector of the matrix (-ve 3rd Row)
GLint GLint GLint GLint GLint x
Real m_10
individual matrix element maps to m_m[1][0] or m_openGL[4]
Vec3 getBackVector() const noexcept
get the back vector of the matrix ( 3nd Row)
void rotateY(Real _deg) noexcept
set this matrix to a rotation matrix in the Y axis for value _deg note the matrix should be set to id...
Mat3 operator+(const Mat3 &_m) const noexcept
operator to add two matrices together
Real m_20
individual matrix element maps to m_m[2][0] or m_openGL[8]
NGL_DLLEXPORT Real radians(const Real _deg)
converts Degrees to Radians
Real m_21
individual matrix element maps to m_m[2][1] or m_openGL[9]
Matrix Class to do simple matrix operations included operator overloaded functions for maths and matr...
const Mat3 & operator*=(const Mat3 &_m) noexcept
operator to mult this matrix by value _m
void rotateZ(Real _deg) noexcept
set this matrix to a rotation matrix in the Z axis for value _deg note the matrix should be set to id...
Real m_02
individual matrix element maps to m_m[0][2] or m_openGL[2]
re impliment asserts so we don't exit on failure
void scale(Real _x, Real _y, Real _z) noexcept
set the matrix scale values
Real m_01
individual matrix element maps to m_m[0][1] or m_openGL[1]
const Mat3 & identity() noexcept
make the matrix m the identity matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
const Mat3 & operator+=(const Mat3 &_m) noexcept
+= operator
Real m_22
individual matrix element maps to m_m[2][2] or m_openGL[10]