mirror of
https://github.com/HandmadeMath/HandmadeMath.git
synced 2026-04-18 14:20:27 +00:00
Add HMM_RotateV2
This commit is contained in:
@@ -2527,6 +2527,17 @@ static inline HMM_Quat HMM_QFromAxisAngle_LH(HMM_Vec3 Axis, float Angle)
|
||||
return HMM_QFromAxisAngle_RH(Axis, -Angle);
|
||||
}
|
||||
|
||||
COVERAGE(HMM_RotateV2, 1)
|
||||
static inline HMM_Vec2 HMM_RotateV2(HMM_Vec2 V, float Angle)
|
||||
{
|
||||
ASSERT_COVERED(HMM_RotateV2)
|
||||
|
||||
float sinA = HMM_SinF(Angle);
|
||||
float cosA = HMM_CosF(Angle);
|
||||
|
||||
return HMM_V2(V.X * cosA - V.Y * sinA, V.X * sinA + V.Y * cosA);
|
||||
}
|
||||
|
||||
// implementation from
|
||||
// https://blog.molecular-matters.com/2013/05/24/a-faster-quaternion-vector-multiplication/
|
||||
COVERAGE(HMM_RotateV3Q, 1)
|
||||
|
||||
Reference in New Issue
Block a user