Implement static operator*
This commit is contained in:
@@ -95,8 +95,6 @@ namespace LinearAlgebra {
|
|||||||
@see RotateFromTo(). */
|
@see RotateFromTo(). */
|
||||||
static Matrix4x4 LookAt(const Vector3& localFwd, const Vector3& targetDir, const Vector3& localUp, const Vector3& worldUp);
|
static Matrix4x4 LookAt(const Vector3& localFwd, const Vector3& targetDir, const Vector3& localUp, const Vector3& worldUp);
|
||||||
|
|
||||||
static Matrix4x4 FromTranslation(const Vector3& translation);
|
|
||||||
|
|
||||||
/// Returns the translation part.
|
/// Returns the translation part.
|
||||||
/** The translation part is stored in the fourth column of this matrix.
|
/** The translation part is stored in the fourth column of this matrix.
|
||||||
This is equivalent to decomposing this matrix in the form M = T * M', i.e. this translation is applied last,
|
This is equivalent to decomposing this matrix in the form M = T * M', i.e. this translation is applied last,
|
||||||
|
@@ -7,6 +7,8 @@ namespace LinearAlgebra {
|
|||||||
using namespace J3ML;
|
using namespace J3ML;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// A 2D (x, y) ordered pair.
|
/// A 2D (x, y) ordered pair.
|
||||||
class Vector2 {
|
class Vector2 {
|
||||||
public:
|
public:
|
||||||
@@ -121,6 +123,10 @@ namespace LinearAlgebra {
|
|||||||
/// Multiplies this vector by a vector, element-wise
|
/// Multiplies this vector by a vector, element-wise
|
||||||
/// @note Mathematically, the multiplication of two vectors is not defined in linear space structures,
|
/// @note Mathematically, the multiplication of two vectors is not defined in linear space structures,
|
||||||
/// but this function is provided here for syntactical convenience.
|
/// but this function is provided here for syntactical convenience.
|
||||||
|
Vector2 operator *(const Vector2& rhs) const
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
Vector2 Mul(const Vector2& v) const;
|
Vector2 Mul(const Vector2& v) const;
|
||||||
|
|
||||||
/// Divides this vector by a scalar.
|
/// Divides this vector by a scalar.
|
||||||
@@ -147,4 +153,9 @@ namespace LinearAlgebra {
|
|||||||
float y = 0;
|
float y = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static Vector2 operator*(float lhs, const Vector2 &rhs)
|
||||||
|
{
|
||||||
|
return rhs * lhs;
|
||||||
|
}
|
||||||
}
|
}
|
@@ -514,11 +514,4 @@ namespace LinearAlgebra {
|
|||||||
At(row, 2) *= scalar;
|
At(row, 2) *= scalar;
|
||||||
At(row, 3) *= scalar;
|
At(row, 3) *= scalar;
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix4x4 Matrix4x4::FromTranslation(const Vector3 &translation) {
|
|
||||||
Matrix4x4 m;
|
|
||||||
m.SetTranslatePart(translation);
|
|
||||||
m.Set3x3Part(Matrix3x3::Identity);
|
|
||||||
return m;
|
|
||||||
}
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user