Torque2D Reference
Loading...
Searching...
No Matches
CoreMath Namespace Reference

Functions

Vector2 mGetClosestPointOnLine (Vector2 &a, Vector2 &b, Vector2 &point)
 Returns a point on the given line AB that is closest to 'point'.
bool mPointInRectangle (const Vector2 &point, const Vector2 &rectMin, const Vector2 &rectMax)
 Calculate point in rectangle.
bool mLineRectangleIntersect (const Vector2 &startPoint, const Vector2 &endPoint, const Vector2 &rectMin, const Vector2 &rectMax, F32 *pTime=NULL)
 Calculate line/rectangle intersection.
F32 mGetRandomF (F32 from, F32 to)
 Random Float Range.
F32 mGetRandomF (void)
 Random Float.
S32 mGetRandomI (const S32 from, const S32 to)
 Random Integer Range.
S32 mGetRandomI (void)
 Random Integer.
void mCalculateAABB (const b2Vec2 *const pAABBVertices, const b2Transform &xf, b2AABB *pAABB)
void mCalculateOOBB (const b2Vec2 *const pAABBVertices, const b2Transform &xf, b2Vec2 *pOOBBVertices)
 Calculate an OOBB.
void mCalculateInverseOOBB (const b2Vec2 *const pAABBVertices, const b2Transform &xf, b2Vec2 *pOOBBVertices)
 Calculate an OOBB.
b2AABB mRectFtoAABB (const RectF &rect)
 Convert RectF to AABB.
void mAABBtoOOBB (const b2AABB &aabb, b2Vec2 *pOOBBVertices)
 Convert AABB to OOBB.
void mOOBBtoAABB (b2Vec2 *pOOBBVertices, b2AABB &aabb)
 Convert OOBB to AABB.
void mRotateAABB (const b2AABB &aabb, const F32 &angle, b2AABB &transformedAABB)
 Rotate an AABB.
b2Vec2 mRotateAboutArbitraryPoint (const b2Transform &T, const b2Vec2 &v)

Variables

RandomLCG gRandomGenerator

Function Documentation

◆ mAABBtoOOBB()

void mAABBtoOOBB ( const b2AABB & aabb,
b2Vec2 * pOOBBVertices )
inline

Convert AABB to OOBB.

◆ mCalculateAABB()

void mCalculateAABB ( const b2Vec2 *const pAABBVertices,
const b2Transform & xf,
b2AABB * pAABB )
inline

◆ mCalculateInverseOOBB()

void mCalculateInverseOOBB ( const b2Vec2 *const pAABBVertices,
const b2Transform & xf,
b2Vec2 * pOOBBVertices )
inline

Calculate an OOBB.

◆ mCalculateOOBB()

void mCalculateOOBB ( const b2Vec2 *const pAABBVertices,
const b2Transform & xf,
b2Vec2 * pOOBBVertices )
inline

Calculate an OOBB.

◆ mGetClosestPointOnLine()

Vector2 mGetClosestPointOnLine ( Vector2 & a,
Vector2 & b,
Vector2 & point )

Returns a point on the given line AB that is closest to 'point'.

Returns a point on the given line ab that is closest to 'point'.

Parameters
aThe start of the line.
bThe end of the line.
pointThe point to test with
Returns
A Point2F of the nearest point that lies on the line

◆ mGetRandomF() [1/2]

F32 mGetRandomF ( F32 from,
F32 to )
inline

Random Float Range.

◆ mGetRandomF() [2/2]

F32 mGetRandomF ( void )
inline

Random Float.

◆ mGetRandomI() [1/2]

S32 mGetRandomI ( const S32 from,
const S32 to )
inline

Random Integer Range.

◆ mGetRandomI() [2/2]

S32 mGetRandomI ( void )
inline

Random Integer.

◆ mLineRectangleIntersect()

bool mLineRectangleIntersect ( const Vector2 & startPoint,
const Vector2 & endPoint,
const Vector2 & rectMin,
const Vector2 & rectMax,
F32 * pTime )

Calculate line/rectangle intersection.

◆ mOOBBtoAABB()

void mOOBBtoAABB ( b2Vec2 * pOOBBVertices,
b2AABB & aabb )
inline

Convert OOBB to AABB.

◆ mPointInRectangle()

bool mPointInRectangle ( const Vector2 & point,
const Vector2 & rectMin,
const Vector2 & rectMax )

Calculate point in rectangle.

◆ mRectFtoAABB()

b2AABB mRectFtoAABB ( const RectF & rect)
inline

Convert RectF to AABB.

◆ mRotateAABB()

void mRotateAABB ( const b2AABB & aabb,
const F32 & angle,
b2AABB & transformedAABB )
inline

Rotate an AABB.

◆ mRotateAboutArbitraryPoint()

b2Vec2 mRotateAboutArbitraryPoint ( const b2Transform & T,
const b2Vec2 & v )
inline

Transform the incoming point 'v' by rotating it about the point (and by the amount) specified in the transform 'T'. NOTE: b2Math has a method called b2Mul() that is similar, but doesn't take into account the offset in T. So I made this.

Variable Documentation

◆ gRandomGenerator

RandomLCG gRandomGenerator