Skip to content

Commit

Permalink
Matrix4::isAffineEqual implemented by Eigen
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Mott committed Mar 28, 2021
1 parent 4f5c49a commit b826434
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions libs/math/Matrix4.h
Expand Up @@ -367,11 +367,11 @@ class Matrix4
*/
void scaleBy(const Vector3& scale, const Vector3& pivot);

/**
* Returns true if this and the given matrix are exactly element-wise equal.
* This and the other matrix must be affine.
*/
bool isAffineEqual(const Matrix4& other) const;
/// Compare the affine part of this matrix with another for equality
bool isAffineEqual(const Matrix4& other) const
{
return eigen().affine() == other.eigen().affine();
}

/**
* Returns RIGHTHANDED if this is right-handed, else returns LEFTHANDED.
Expand Down Expand Up @@ -499,22 +499,6 @@ inline bool operator!=(const Matrix4& l, const Matrix4& r)
return !(l == r);
}

inline bool Matrix4::isAffineEqual(const Matrix4& other) const
{
return xx() == other.xx() &&
xy() == other.xy() &&
xz() == other.xz() &&
yx() == other.yx() &&
yy() == other.yy() &&
yz() == other.yz() &&
zx() == other.zx() &&
zy() == other.zy() &&
zz() == other.zz() &&
tx() == other.tx() &&
ty() == other.ty() &&
tz() == other.tz();
}

inline Matrix4::Handedness Matrix4::getHandedness() const
{
return (xCol().getVector3().crossProduct(yCol().getVector3()).dot(zCol().getVector3()) < 0.0f) ? LEFTHANDED : RIGHTHANDED;
Expand Down

0 comments on commit b826434

Please sign in to comment.