1
0
forked from josh/j3ml

Implement Mat4x4 member docs

This commit is contained in:
2024-02-01 17:23:48 -05:00
parent 35fded8ec0
commit c858d3b889
2 changed files with 41 additions and 11 deletions

View File

@@ -375,15 +375,15 @@ namespace LinearAlgebra {
return Vector3 { At(0, 0), At(1,1), At(2,2) };
}
Vector4 Matrix4x4::WorldX() const {
Vector3 Matrix4x4::WorldX() const {
return GetColumn3(0);
}
Vector4 Matrix4x4::WorldY() const {
Vector3 Matrix4x4::WorldY() const {
return GetColumn3(1);
}
Vector4 Matrix4x4::WorldZ() const {
Vector3 Matrix4x4::WorldZ() const {
return GetColumn3(2);
}
@@ -404,4 +404,19 @@ namespace LinearAlgebra {
Vector3 Matrix4x4::operator*(const Vector3 &rhs) const { return this->Transform(rhs);}
Vector4 Matrix4x4::operator*(const Vector4 &rhs) const { return this->Transform(rhs);}
Vector4 Matrix4x4::Transform(float tx, float ty, float tz, float tw) const {
return Transform({tx, ty, tz, tw});
}
Vector4 Matrix4x4::Transform(const Vector4 &rhs) const {
return Vector4(At(0, 0) * rhs.x + At(0, 1) * rhs.y + At(0, 2) * rhs.z + At(0, 3) * rhs.w,
At(1, 0) * rhs.x + At(1, 1) * rhs.y + At(1, 2) * rhs.z + At(1, 3) * rhs.w,
At(2, 0) * rhs.x + At(2, 1) * rhs.y + At(2, 2) * rhs.z + At(2, 3) * rhs.w,
At(3, 0) * rhs.x + At(3, 1) * rhs.y + At(3, 2) * rhs.z + At(3, 3) * rhs.w);
}
Vector3 Matrix4x4::GetTranslatePart() const {
return GetColumn3(3);
}
}