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
vlMatrix4x4 ();
void operator= (float element);
void operator= (vlMatrix4x4& source);
float *operator[](const unsigned int i) const {return &(Element[i][0]);};
// Calculate the inverse of in and
// return it in out.
void Invert (vlMatrix4x4 in,vlMatrix4x4 & out);
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);
float Determinant (vlMatrix4x4 & in);
char *GetClassName () {return "vlMatrix4x4";};
......
......@@ -33,17 +33,21 @@ void vlMatrix4x4::operator= (float element)
this->Modified ();
}
void vlMatrix4x4::VectorMultiply(float,float,float,float,float result[4])
void vlMatrix4x4::VectorMultiply(float in[4],float result[4])
{
int i;
float v1 = in[0];
float v2 = in[1];
float v3 = in[2];
float v4 = in[3];
for (i = 0; i < 4; i++)
{
result[i] =
result[0] * this->Element[0][3] +
result[1] * this->Element[1][3] +
result[2] * this->Element[2][3] +
result[3] * this->Element[3][3];
v1 * this->Element[0][i] +
v2 * this->Element[1][i] +
v3 * this->Element[2][i] +
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