Implement V3::Direction
This commit is contained in:
@@ -37,6 +37,11 @@ public:
|
|||||||
b = b.Normalize();
|
b = b.Normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Returns the DirectionVector for a given angle.
|
||||||
|
Vector3 Direction(const Vector3 &rhs) const;
|
||||||
|
|
||||||
|
|
||||||
static void Orthonormalize(Vector3& a, Vector3& b, Vector3& c)
|
static void Orthonormalize(Vector3& a, Vector3& b, Vector3& c)
|
||||||
{
|
{
|
||||||
a = a.Normalize();
|
a = a.Normalize();
|
||||||
|
@@ -213,7 +213,6 @@ namespace LinearAlgebra {
|
|||||||
elems[0][2] = c1*a.x*a.z+s*a.y;
|
elems[0][2] = c1*a.x*a.z+s*a.y;
|
||||||
elems[1][2] = c1*a.y*a.z-s*a.x;
|
elems[1][2] = c1*a.y*a.z-s*a.x;
|
||||||
elems[2][2] = c+c1*a.z*a.z;
|
elems[2][2] = c+c1*a.z*a.z;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix3x3 Matrix3x3::RotateAxisAngle(const Vector3 &axis, float angleRadians) {
|
Matrix3x3 Matrix3x3::RotateAxisAngle(const Vector3 &axis, float angleRadians) {
|
||||||
|
@@ -301,5 +301,12 @@ namespace LinearAlgebra {
|
|||||||
return lhs.AngleBetween(rhs);
|
return lhs.AngleBetween(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector3 Vector3::Direction(const Vector3 &rhs) const {
|
||||||
|
float x = (cos(Math::Radians(rhs.y)) * cos(Math::Radians(rhs.x)));
|
||||||
|
float y = -sin(Math::Radians(rhs.x));
|
||||||
|
float z = (sin(Math::Radians(rhs.y)) * cos(Math::Radians(rhs.x)));
|
||||||
|
return {x, y, z};
|
||||||
|
}
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
}
|
}
|
Reference in New Issue
Block a user