Add more utility methods to Transform and Matrix3x3

This commit is contained in:
Wojtek Figat
2022-06-16 10:50:53 +02:00
parent bc8cc75ad8
commit 995e5bc6ff
5 changed files with 252 additions and 31 deletions

View File

@@ -80,6 +80,8 @@ public:
{
}
Transform(const Vector3& position, const Matrix3x3& rotationScale);
public:
String ToString() const;
@@ -192,12 +194,24 @@ public:
return result;
}
/// <summary>
/// Performs transformation of the given vector in local space to the world space of this transform.
/// </summary>
/// <param name="vector">The local space vector.</param>
/// <param name="result">The world space vector.</param>
void LocalToWorldVector(const Vector3& vector, Vector3& result) const;
/// <summary>
/// Performs transformation of the given vector in local space to the world space of this transform.
/// </summary>
/// <param name="vector">The local space vector.</param>
/// <returns>The world space vector.</returns>
Vector3 LocalToWorldVector(const Vector3& vector) const;
Vector3 LocalToWorldVector(const Vector3& vector) const
{
Vector3 result;
LocalToWorldVector(vector, result);
return result;
}
/// <summary>
/// Performs transformation of the given point in local space to the world space of this transform.
@@ -244,12 +258,24 @@ public:
return result;
}
/// <summary>
/// Performs transformation of the given vector in world space to the local space of this transform.
/// </summary>
/// <param name="vector">The world space vector.</param>
/// <param name="result">The local space vector.</param>
void WorldToLocalVector(const Vector3& vector, Vector3& result) const;
/// <summary>
/// Performs transformation of the given vector in world space to the local space of this transform.
/// </summary>
/// <param name="vector">The world space vector.</param>
/// <returns>The local space vector.</returns>
Vector3 WorldToLocalVector(const Vector3& vector) const;
Vector3 WorldToLocalVector(const Vector3& vector) const
{
Vector3 result;
WorldToLocalVector(vector, result);
return result;
}
public:
FORCE_INLINE Transform operator*(const Transform& other) const