Skip to content

Commit

Permalink
fixed long overdue matrix methods
Browse files Browse the repository at this point in the history
git-svn-id: svn://libnui.net/nui/trunk/nui3@4777 9db30882-7939-4ce0-a36a-45f8a15c01b5
  • Loading branch information
meeloo committed Sep 11, 2009
1 parent 3cfcc0f commit a8b9531
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions include/nglMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,7 @@ template <class T> class nglMatrix
/// Setup a translation matrix
void SetTranslation (const nglVector<T>& rDelta)
{
SetIdentity();
Elt.M14 = rDelta[0];
Elt.M24 = rDelta[1];
Elt.M34 = rDelta[2];
SetTranslation(rDelta[0], rDelta[1], rDelta[2]);
}

/// Setup a translation matrix
Expand All @@ -233,17 +230,15 @@ template <class T> class nglMatrix
/// Compose with a translation
void Translate (const nglVector<T>& rDelta)
{
Elt.M14 += rDelta[0];
Elt.M24 += rDelta[1];
Elt.M34 += rDelta[2];
Translate(rDelta[0], rDelta[1], rDelta[2]);
}

/// Compose with a translation
void Translate (T X, T Y, T Z)
{
Elt.M14 += X;
Elt.M24 += Y;
Elt.M34 += Z;
nglMatrix<T> m;
m.SetTranslation(X, Y, Z);
*this *= m;
}

/// Setup a scaling transformation (homothetia)
Expand All @@ -269,15 +264,9 @@ template <class T> class nglMatrix
/// Apply a scaling transformation
void Scale (T X, T Y, T Z)
{
Elt.M11 *= X;
Elt.M21 *= X;
Elt.M31 *= X;
Elt.M12 *= Y;
Elt.M22 *= Y;
Elt.M32 *= Y;
Elt.M13 *= Z;
Elt.M23 *= Z;
Elt.M33 *= Z;
nglMatrix<T> m;
m.SetScaling(X, Y, Z);
*this *= m;
}

/// Apply a scaling transformation
Expand Down

0 comments on commit a8b9531

Please sign in to comment.