Wraith  0.1.5
Basic 3D game engine in C++
MathTools Namespace Reference

Classes

struct  Interval
 

Functions

bool Intersect (const CollisionVolume &collisionVolume_1, const CollisionVolume &collisionVolume_2)
 Test intersection between two collision volumes. More...
 
bool Intersect (const CollisionVolumeBSphere &BSphere_1, const CollisionVolumeBSphere &BSphere_2)
 Test intersection between two BSpheres. More...
 
bool Intersect (const CollisionVolumeBSphere &BSphere, const CollisionVolumeAABB &AABB)
 Test intersection between BSphere and AABB. More...
 
bool Intersect (const CollisionVolumeBSphere &BSphere, const CollisionVolumeOBB &OBB)
 Test intersection between BSphere and OBB. More...
 
bool Intersect (const CollisionVolumeBSphere &BSphere, const CollisionVolumeOctree &Octree)
 Test intersection between BSphere and Octree. More...
 
bool Intersect (const CollisionVolumeAABB &AABB_1, const CollisionVolumeAABB &AABB_2)
 Test intersection between two AABBs. More...
 
bool Intersect (const CollisionVolumeAABB &AABB, const CollisionVolumeOBB &OBB)
 Test intersection between AABB and OBB. More...
 
bool Intersect (const CollisionVolumeAABB &AABB, const CollisionVolumeOctree &Octree)
 Test intersection between AABB and Octree. More...
 
bool Intersect (const CollisionVolumeOBB &OBB_1, const CollisionVolumeOBB &OBB_2)
 Test intersection between two OBBs. More...
 
bool Intersect (const CollisionVolumeOBB &OBB, const CollisionVolumeOctree &Octree)
 Test intersection between an OBB and an Octree. More...
 
bool Intersect (const CollisionVolumeOctree &Octree_1, const CollisionVolumeOctree &Octree_2)
 Test intersection between two Octrees. More...
 
bool Intersect (const CollisionVolume &collisionVolume, const CollisionVolumeOctree &Octree)
 
bool Intersect (const CollisionVolumeAABB &AABB, const Vect &point)
 Test intersection between an AABB and a point. More...
 
bool Intersect (const CollisionVolumeOBB &OBB, const Vect &point)
 Test intersection between an OBB and a point. More...
 
void OutputAxesToTest (const CollisionVolumeOBB &OBB_1, const CollisionVolumeOBB &OBB_2, Vect *axes)
 Computes and outputs all axes to test. More...
 
void OutputAxesToTest (const CollisionVolumeAABB &AABB, const CollisionVolumeOBB &OBB, Vect *axes)
 Computes and outputs all axes to test. More...
 
bool DoesOverlapsOnAxis (const CollisionVolumeOBB &OBB_1, const CollisionVolumeOBB &OBB_2, const Vect &axis)
 Determines if two Boxes overlap on specified axis. More...
 
bool DoesOverlapsOnAxis (const CollisionVolumeAABB &AABB, const CollisionVolumeOBB &OBB, const Vect &axis)
 Determines if two Boxes overlap on specified axis. More...
 
float getMaxBoxProjectionLength (const CollisionVolumeOBB &OBB, const Vect &axis)
 Computes max projections length of Box onto an axis. More...
 
float getMaxBoxProjectionLength (const CollisionVolumeAABB &AABB, const Vect &axis)
 Computes max projections length of Box onto an axis. More...
 
bool Intersect (const CollisionVolumeOBB &OBB, const Triangle &triangle)
 Test intersection between an OBB and a Triangle. More...
 
Triangle AdjustTriangle (const CollisionVolumeOBB &OBB, const Triangle &triangle)
 
void OutputAxesToTest (const CollisionVolumeOBB &OBB, const Triangle &triangle, Vect *axes)
 Computes and outputs all axes to test. More...
 
bool DoesOverlapsOnAxis (const CollisionVolumeOBB &OBB, const Triangle &triangle, const Vect &axis)
 Determines if Box and triangle overlap on specified axis. More...
 
Matrix ExtractScaleMatrix (const Matrix &worldMatrix)
 Extracts scale matrix. More...
 
Vect ExtractScaleXYZ (const Matrix &worldMatrix)
 Extracts XYZ scale of a world matrix. More...
 
float ExtractScaleX (const Matrix &worldMatrix)
 Extracts X-scale from world matrix. More...
 
float ExtractScaleY (const Matrix &worldMatrix)
 Extracts Y scale from the world matrix. More...
 
float ExtractScaleZ (const Matrix &worldMatrix)
 Extracts Z scale from world matrix. More...
 
Matrix ExtractTranslationMatrix (const Matrix &worldMatrix)
 Extracts translation matrix from world matrix. More...
 
Vect ExtractTranslationXYZ (const Matrix &worldMatrix)
 Extract translation vector from world matrix. More...
 
Matrix RotationFromTowards (const Vect &current, const Vect &target)
 Computes rotation matrix to rotate vector from current to target. More...
 
Vect MultiplyComponents (const Vect &vect_1, const Vect &vect_2)
 Multiplies two vectors by each component (x1 * x2, y1 * y2, z1 * z2). More...
 
Vect Min (const Vect &vect_1, const Vect &vect_2)
 Constructs Vect using the mininum values of two Vects. More...
 
Vect Max (const Vect &vect_1, const Vect &vect_2)
 Constructs Vect using the maximum values of two Vects. More...
 
Vect Clamp (const Vect &value, const Vect &min, const Vect &max)
 Clamps the given Vect . More...
 
Vect Projection (const Vect &vect_1, const Vect &vect_2)
 Projection of vect_1 onto vect_2. More...
 
float ProjectionLength (const Vect &vect_1, const Vect &vect_2)
 Projection length of vect_1 onto vect_2. More...
 
float power (float base, int exponent)
 raises base to the power of integers. More...
 
template<typename type >
type Clamp (type value, type min, type max)
 Clamp the given value. More...
 
bool IsInRange (const Vect &vect, const Vect &vect_1, const Vect &vect_2)
 Determines if a Vect is in between two Vect values More...
 
bool IsInRange (float number, float number_1, float number_2)
 
bool IsLessThan (const Vect &vect_1, const Vect &vect_2)
 Determines if a Vect is less than another Vect. More...
 
bool IsGreaterThan (const Vect &vect_1, const Vect &vect_2)
 Determines if a Vect is greater than another Vect. More...
 
bool DoIntervalsOverlap (const Interval &interval_1, const Interval &interval_2)
 Determines if two intervals overlap More...
 

Detailed Description

namespace: MathTools

summary: A places where are tools to be used by engine and even the user.

Function Documentation

◆ Clamp() [1/2]

Vect MathTools::Clamp ( const Vect &  value,
const Vect &  min,
const Vect &  max 
)

Clamps the given Vect .

Parameters
valueThe value.
minThe minimum.
maxThe maximum.
Returns
A vector.

◆ Clamp() [2/2]

template<typename type >
type MathTools::Clamp ( type  value,
type  min,
type  max 
)

Clamp the given value.

Template Parameters
typeType of the type.
Parameters
valueThe value.
minThe minimum.
maxThe maximum.
Returns
A type.

◆ DoesOverlapsOnAxis() [1/3]

bool MathTools::DoesOverlapsOnAxis ( const CollisionVolumeAABB AABB,
const CollisionVolumeOBB OBB,
const Vect &  axis 
)

Determines if two Boxes overlap on specified axis.

The axis is pure vector, so Vect[w] must be 0.

Parameters
AABBAn AABB.
OBBAn OBB.
axisAn axis.
Returns
True if it succeeds, false if it fails.

◆ DoesOverlapsOnAxis() [2/3]

bool MathTools::DoesOverlapsOnAxis ( const CollisionVolumeOBB OBB,
const Triangle triangle,
const Vect &  axis 
)

Determines if Box and triangle overlap on specified axis.

The axis is pure vector, so Vect[w] must be 0.

Parameters
OBBAn OBB.
triangleAn triangle.
axisAn axis.
Returns
True if it succeeds, false if it fails.

◆ DoesOverlapsOnAxis() [3/3]

bool MathTools::DoesOverlapsOnAxis ( const CollisionVolumeOBB OBB_1,
const CollisionVolumeOBB OBB_2,
const Vect &  axis 
)

Determines if two Boxes overlap on specified axis.

The axis is pure vector, so Vect[w] must be 0.

Parameters
OBB_1An OBB.
OBB_2An OBB.
axisAn axis.
Returns
True if it succeeds, false if it fails.

◆ getMaxBoxProjectionLength() [1/2]

float MathTools::getMaxBoxProjectionLength ( const CollisionVolumeAABB AABB,
const Vect &  axis 
)

Computes max projections length of Box onto an axis.

The axis is pure vector, so Vect[w] must be 0.

Parameters
AABBAn AABB.
axisAn axis.
Returns
return Max Projection length.

◆ getMaxBoxProjectionLength() [2/2]

float MathTools::getMaxBoxProjectionLength ( const CollisionVolumeOBB OBB,
const Vect &  axis 
)

Computes max projections length of Box onto an axis.

The axis is pure vector, so Vect[w] must be 0.

Parameters
OBBAn OBB.
axisAn axis.
Returns
return Max Projection length.

◆ Intersect()

bool MathTools::Intersect ( const CollisionVolume collisionVolume_1,
const CollisionVolume collisionVolume_2 
)

Test intersection between two collision volumes.

Parameters
collisionVolume_1The first collision volume.
collisionVolume_2The second collision volume.
Returns
True if it succeeds, false if it fails.

◆ OutputAxesToTest() [1/3]

void MathTools::OutputAxesToTest ( const CollisionVolumeAABB AABB,
const CollisionVolumeOBB OBB,
Vect *  axes 
)

Computes and outputs all axes to test.

Only 15 axes are computed.

Parameters
AABBAn AABB.
OBBAn OBB.
axesA array of Vect to write data to
Returns
Nothing.

◆ OutputAxesToTest() [2/3]

void MathTools::OutputAxesToTest ( const CollisionVolumeOBB OBB,
const Triangle triangle,
Vect *  axes 
)

Computes and outputs all axes to test.

Only 13 axes are computed.

Parameters
OBBAn OBB.
triangleAn triangle.
axesA array of Vect to write data to
Returns
Nothing.

◆ OutputAxesToTest() [3/3]

void MathTools::OutputAxesToTest ( const CollisionVolumeOBB OBB_1,
const CollisionVolumeOBB OBB_2,
Vect *  axes 
)

Computes and outputs all axes to test.

Only 15 axes are computed.

Parameters
OBB_1An OBB.
OBB_2An OBB.
axesA array of Vect to write data to
Returns
Nothing.

◆ Projection()

Vect MathTools::Projection ( const Vect &  vect_1,
const Vect &  vect_2 
)

Projection of vect_1 onto vect_2.

Parameters
vect_1A Vect.
vect_2A vect.
Returns
The projection vect.

◆ ProjectionLength()

float MathTools::ProjectionLength ( const Vect &  vect_1,
const Vect &  vect_2 
)

Projection length of vect_1 onto vect_2.

Parameters
vect_1A Vect.
vect_2A vect.
Returns
The projection length.