Commit 65d436d2 authored by Ken Martin's avatar Ken Martin
Browse files

Added some methods

parent 18c0fbb2
...@@ -26,13 +26,14 @@ class vlMatrix4x4 : public vlObject ...@@ -26,13 +26,14 @@ class vlMatrix4x4 : public vlObject
vlMatrix4x4 (); vlMatrix4x4 ();
void operator= (float element); void operator= (float element);
void operator= (vlMatrix4x4& source); void operator= (vlMatrix4x4& source);
float *operator[](const unsigned int i) const {return &(Element[i][0]);};
// Calculate the inverse of in and // Calculate the inverse of in and
// return it in out. // return it in out.
void Invert (vlMatrix4x4 in,vlMatrix4x4 & out); void Invert (vlMatrix4x4 in,vlMatrix4x4 & out);
void Invert (void) { Invert(*this,*this);}; void Invert (void) { Invert(*this,*this);};
void VectorMultiply(float,float,float,float,float a[4]); void VectorMultiply(float in[4], float out[4]);
void Adjoint (vlMatrix4x4 & in,vlMatrix4x4 & out); void Adjoint (vlMatrix4x4 & in,vlMatrix4x4 & out);
float Determinant (vlMatrix4x4 & in); float Determinant (vlMatrix4x4 & in);
char *GetClassName () {return "vlMatrix4x4";}; char *GetClassName () {return "vlMatrix4x4";};
......
...@@ -33,17 +33,21 @@ void vlMatrix4x4::operator= (float element) ...@@ -33,17 +33,21 @@ void vlMatrix4x4::operator= (float element)
this->Modified (); this->Modified ();
} }
void vlMatrix4x4::VectorMultiply(float,float,float,float,float result[4]) void vlMatrix4x4::VectorMultiply(float in[4],float result[4])
{ {
int i; int i;
float v1 = in[0];
float v2 = in[1];
float v3 = in[2];
float v4 = in[3];
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
result[i] = result[i] =
result[0] * this->Element[0][3] + v1 * this->Element[0][i] +
result[1] * this->Element[1][3] + v2 * this->Element[1][i] +
result[2] * this->Element[2][3] + v3 * this->Element[2][i] +
result[3] * this->Element[3][3]; v4 * this->Element[3][i];
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment