Added rotate method with quaternions for Vector3 #301
|
@ -35,7 +35,17 @@ namespace SHADE
|
|||
: position { pos }
|
||||
, orientation { SHQuaternion::FromEuler(rot) }
|
||||
, scale { scl }
|
||||
{}
|
||||
{
|
||||
ComputeTRS();
|
||||
}
|
||||
|
||||
SHTransform::SHTransform(const SHVec3& pos, const SHQuaternion& quat, const SHVec3& scl) noexcept
|
||||
: position { pos }
|
||||
, orientation { quat }
|
||||
, scale { scl }
|
||||
{
|
||||
ComputeTRS();
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Operator Overload Definitions */
|
||||
|
|
|
@ -167,6 +167,10 @@ namespace SHADE
|
|||
{
|
||||
return Convert::ToCLI(SHVec3::Rotate(Convert::ToNative(vec), Convert::ToNative(axis), radians));
|
||||
}
|
||||
Vector3 Vector3::Rotate(Vector3 vec, Quaternion quat)
|
||||
{
|
||||
return Convert::ToCLI(SHVec3::Rotate(Convert::ToNative(vec), Convert::ToNative(quat)));
|
||||
}
|
||||
Vector3 Vector3::Min(Vector3 lhs, Vector3 rhs)
|
||||
{
|
||||
float lx = lhs.x, rx = rhs.x;
|
||||
|
|
|
@ -19,10 +19,17 @@ of DigiPen Institute of Technology is prohibited.
|
|||
// Project Includes
|
||||
#include "Vector2.hxx"
|
||||
|
||||
value struct Quaternion;
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Forward Declarations */
|
||||
/*-------------------------------------------------------------------------- --- */
|
||||
value struct Quaternion;
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Type Definitions */
|
||||
/*-------------------------------------------------------------------------- --- */
|
||||
|
||||
///<summary>
|
||||
/// CLR version of SHADE Engine's Vector3 class that represents a 3-Dimensional Vector.
|
||||
/// Designed to closely match Unity's Vector3 struct.
|
||||
|
@ -308,6 +315,12 @@ namespace SHADE
|
|||
/// <returns>The Vector3 that represents the rotated vector.</returns>
|
||||
static Vector3 Rotate(Vector3 vec, Vector3 axis, float radians);
|
||||
/// <summary>
|
||||
/// Rotates a Vector3 using a Quaternion.
|
||||
/// </summary>
|
||||
/// <param name="vec">A Vector3 to rotate.</param>
|
||||
/// <param name="quat">A Quaternion to rotate the vector with.</param>
|
||||
static Vector3 Rotate(Vector3 vec, Quaternion quat);
|
||||
/// <summary>
|
||||
/// Computes and returns a Vector3 that is made from the smallest components of
|
||||
/// the two specified Vector3s.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue