Torque2D Reference
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Functions | Variables
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'. More...
 
bool mPointInRectangle (const Vector2 &point, const Vector2 &rectMin, const Vector2 &rectMax)
 Calculate point in rectangle. More...
 
bool mLineRectangleIntersect (const Vector2 &startPoint, const Vector2 &endPoint, const Vector2 &rectMin, const Vector2 &rectMax, F32 *pTime=NULL)
 Calculate line/rectangle intersection. More...
 
F32 mGetRandomF (F32 from, F32 to)
 Random Float Range. More...
 
F32 mGetRandomF (void)
 Random Float. More...
 
S32 mGetRandomI (const S32 from, const S32 to)
 Random Integer Range. More...
 
S32 mGetRandomI (void)
 Random Integer. More...
 
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. More...
 
void mCalculateInverseOOBB (const b2Vec2 *const pAABBVertices, const b2Transform &xf, b2Vec2 *pOOBBVertices)
 Calculate an OOBB. More...
 
b2AABB mRectFtoAABB (const RectF &rect)
 Convert RectF to AABB. More...
 
void mAABBtoOOBB (const b2AABB &aabb, b2Vec2 *pOOBBVertices)
 Convert AABB to OOBB. More...
 
void mOOBBtoAABB (b2Vec2 *pOOBBVertices, b2AABB &aabb)
 Convert OOBB to AABB. More...
 
void mRotateAABB (const b2AABB &aabb, const F32 &angle, b2AABB &transformedAABB)
 Rotate an AABB. More...
 

Variables

RandomLCG gRandomGenerator
 

Function Documentation

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

Convert AABB to OOBB.

void CoreMath::mCalculateAABB ( const b2Vec2 *const  pAABBVertices,
const b2Transform &  xf,
b2AABB *  pAABB 
)
inline
void CoreMath::mCalculateInverseOOBB ( const b2Vec2 *const  pAABBVertices,
const b2Transform &  xf,
b2Vec2 *  pOOBBVertices 
)
inline

Calculate an OOBB.

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

Calculate an OOBB.

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
F32 CoreMath::mGetRandomF ( F32  from,
F32  to 
)
inline

Random Float Range.

F32 CoreMath::mGetRandomF ( void  )
inline

Random Float.

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

Random Integer Range.

S32 CoreMath::mGetRandomI ( void  )
inline

Random Integer.

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

Calculate line/rectangle intersection.

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

Convert OOBB to AABB.

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

Calculate point in rectangle.

b2AABB CoreMath::mRectFtoAABB ( const RectF rect)
inline

Convert RectF to AABB.

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

Rotate an AABB.

Variable Documentation

RandomLCG gRandomGenerator