mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Adds the getSignedAngleBetweenVectors function, which is like the existing getAngleBetweenVectors, but will returned a signed angle value, which helps to inform the full 360 angle, rather than the 'nearest 180'.
This commit is contained in:
parent
5c8a82180b
commit
c2c34cdd5d
3 changed files with 34 additions and 0 deletions
|
|
@ -371,6 +371,18 @@ F32 getAngleBetweenVectors(VectorF vecA, VectorF vecB)
|
|||
return angle;
|
||||
}
|
||||
|
||||
F32 getSignedAngleBetweenVectors(VectorF vecA, VectorF vecB, VectorF norm)
|
||||
{
|
||||
// angle in 0-180
|
||||
F32 angle = getAngleBetweenVectors(vecA, vecB);
|
||||
F32 sign = mSign(mDot(norm, mCross(vecA, vecB)));
|
||||
|
||||
// angle in -179-180
|
||||
F32 signed_angle = angle * sign;
|
||||
|
||||
return signed_angle;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void transformBoundingBox(const Box3F &sbox, const MatrixF &mat, const Point3F scale, Box3F &dbox)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue