Wraith  0.1.5
Basic 3D game engine in C++
Math Tools

Provides a few math tools from MathTools namespace that user can use. A few tools include getting scale and translation from a. More...

Collaboration diagram for Math Tools:

Functions

bool MathTools::Intersect (const CollisionVolumeBSphere &BSphere_1, const CollisionVolumeBSphere &BSphere_2)
 Test intersection between two BSpheres. More...
 
bool MathTools::Intersect (const CollisionVolumeBSphere &BSphere, const CollisionVolumeAABB &AABB)
 Test intersection between BSphere and AABB. More...
 
bool MathTools::Intersect (const CollisionVolumeBSphere &BSphere, const CollisionVolumeOBB &OBB)
 Test intersection between BSphere and OBB. More...
 
bool MathTools::Intersect (const CollisionVolumeBSphere &BSphere, const CollisionVolumeOctree &Octree)
 Test intersection between BSphere and Octree. More...
 
bool MathTools::Intersect (const CollisionVolumeAABB &AABB_1, const CollisionVolumeAABB &AABB_2)
 Test intersection between two AABBs. More...
 
bool MathTools::Intersect (const CollisionVolumeAABB &AABB, const CollisionVolumeOBB &OBB)
 Test intersection between AABB and OBB. More...
 
bool MathTools::Intersect (const CollisionVolumeAABB &AABB, const CollisionVolumeOctree &Octree)
 Test intersection between AABB and Octree. More...
 
bool MathTools::Intersect (const CollisionVolumeOBB &OBB_1, const CollisionVolumeOBB &OBB_2)
 Test intersection between two OBBs. More...
 
bool MathTools::Intersect (const CollisionVolumeOBB &OBB, const CollisionVolumeOctree &Octree)
 Test intersection between an OBB and an Octree. More...
 
bool MathTools::Intersect (const CollisionVolumeOctree &Octree_1, const CollisionVolumeOctree &Octree_2)
 Test intersection between two Octrees. More...
 
bool MathTools::Intersect (const CollisionVolumeAABB &AABB, const Vect &point)
 Test intersection between an AABB and a point. More...
 
bool MathTools::Intersect (const CollisionVolumeOBB &OBB, const Vect &point)
 Test intersection between an OBB and a point. More...
 
bool MathTools::Intersect (const CollisionVolumeOBB &OBB, const Triangle &triangle)
 Test intersection between an OBB and a Triangle. More...
 
Matrix MathTools::ExtractScaleMatrix (const Matrix &worldMatrix)
 Extracts scale matrix. More...
 
Vect MathTools::ExtractScaleXYZ (const Matrix &worldMatrix)
 Extracts XYZ scale of a world matrix. More...
 
float MathTools::ExtractScaleX (const Matrix &worldMatrix)
 Extracts X-scale from world matrix. More...
 
float MathTools::ExtractScaleY (const Matrix &worldMatrix)
 Extracts Y scale from the world matrix. More...
 
float MathTools::ExtractScaleZ (const Matrix &worldMatrix)
 Extracts Z scale from world matrix. More...
 
Matrix MathTools::ExtractTranslationMatrix (const Matrix &worldMatrix)
 Extracts translation matrix from world matrix. More...
 
Vect MathTools::ExtractTranslationXYZ (const Matrix &worldMatrix)
 Extract translation vector from world matrix. More...
 
Matrix MathTools::RotationFromTowards (const Vect &current, const Vect &target)
 Computes rotation matrix to rotate vector from current to target. More...
 
Vect MathTools::MultiplyComponents (const Vect &vect_1, const Vect &vect_2)
 Multiplies two vectors by each component (x1 * x2, y1 * y2, z1 * z2). More...
 
Vect MathTools::Min (const Vect &vect_1, const Vect &vect_2)
 Constructs Vect using the mininum values of two Vects. More...
 
Vect MathTools::Max (const Vect &vect_1, const Vect &vect_2)
 Constructs Vect using the maximum values of two Vects. More...
 
float MathTools::power (float base, int exponent)
 raises base to the power of integers. More...
 
bool MathTools::IsInRange (const Vect &vect, const Vect &vect_1, const Vect &vect_2)
 Determines if a Vect is in between two Vect values More...
 
bool MathTools::IsLessThan (const Vect &vect_1, const Vect &vect_2)
 Determines if a Vect is less than another Vect. More...
 
bool MathTools::IsGreaterThan (const Vect &vect_1, const Vect &vect_2)
 Determines if a Vect is greater than another Vect. More...
 
bool MathTools::DoIntervalsOverlap (const Interval &interval_1, const Interval &interval_2)
 Determines if two intervals overlap More...
 

Detailed Description

Provides a few math tools from MathTools namespace that user can use. A few tools include getting scale and translation from a.

Function Documentation

◆ DoIntervalsOverlap()

bool MathTools::DoIntervalsOverlap ( const Interval interval_1,
const Interval interval_2 
)

Determines if two intervals overlap

Uses MathTools::Interval struct testing intervals

Parameters
interval_1An interval.
interval_2An interval.
Returns
True if intervals overlap, otherwise false.

◆ ExtractScaleMatrix()

Matrix MathTools::ExtractScaleMatrix ( const Matrix &  worldMatrix)

Extracts scale matrix.

assumes matrix is a world matrix composed of translation, rotation and scale.

Parameters
worldMatrixThe world matrix.
Returns
The scale matrix.

◆ ExtractScaleX()

float MathTools::ExtractScaleX ( const Matrix &  worldMatrix)

Extracts X-scale from world matrix.

assumes matrix is a world matrix composed of translation, rotation and scale.

Parameters
worldMatrixThe world matrix.
Returns
The X scale.

◆ ExtractScaleXYZ()

Vect MathTools::ExtractScaleXYZ ( const Matrix &  worldMatrix)

Extracts XYZ scale of a world matrix.

assumes matrix is a world matrix composed of translation, rotation and scale.

Parameters
worldMatrixThe world matrix.
Returns
The XYZ scale in a Vector.

◆ ExtractScaleY()

float MathTools::ExtractScaleY ( const Matrix &  worldMatrix)

Extracts Y scale from the world matrix.

assumes matrix is a world matrix composed of translation, rotation and scale.

Parameters
worldMatrixThe world matrix.
Returns
The Y scale.

◆ ExtractScaleZ()

float MathTools::ExtractScaleZ ( const Matrix &  worldMatrix)

Extracts Z scale from world matrix.

assumes matrix is a world matrix composed of translation, rotation and scale.

Parameters
worldMatrixThe world matrix.
Returns
The Z scale.

◆ ExtractTranslationMatrix()

Matrix MathTools::ExtractTranslationMatrix ( const Matrix &  worldMatrix)

Extracts translation matrix from world matrix.

assumes matrix is a world matrix composed of translation, rotation and scale.

Parameters
worldMatrixThe world matrix.
Returns
The translation matrix.

◆ ExtractTranslationXYZ()

Vect MathTools::ExtractTranslationXYZ ( const Matrix &  worldMatrix)

Extract translation vector from world matrix.

assumes matrix is a world matrix composed of translation, rotation and scale.

Parameters
worldMatrixThe world matrix.
Returns
The translation vector.

◆ Intersect() [1/13]

bool MathTools::Intersect ( const CollisionVolumeAABB AABB,
const CollisionVolumeOBB OBB 
)

Test intersection between AABB and OBB.

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

◆ Intersect() [2/13]

bool MathTools::Intersect ( const CollisionVolumeAABB AABB,
const CollisionVolumeOctree Octree 
)

Test intersection between AABB and Octree.

Parameters
AABBAn AABB.
OctreeAn Octree.
Returns
True if it succeeds, false if it fails.

◆ Intersect() [3/13]

bool MathTools::Intersect ( const CollisionVolumeAABB AABB,
const Vect &  point 
)

Test intersection between an AABB and a point.

Parameters
AABBAn AABB.
pointA point.
Returns
True if it succeeds, false if it fails.

◆ Intersect() [4/13]

bool MathTools::Intersect ( const CollisionVolumeAABB AABB_1,
const CollisionVolumeAABB AABB_2 
)

Test intersection between two AABBs.

Parameters
AABB_1An AABB.
AABB_2An AABB.
Returns
True if it succeeds, false if it fails.

◆ Intersect() [5/13]

bool MathTools::Intersect ( const CollisionVolumeBSphere BSphere,
const CollisionVolumeAABB AABB 
)

Test intersection between BSphere and AABB.

Parameters
BSphereA BSphere.
AABBAn AABB.
Returns
True if it succeeds, false if it fails.

◆ Intersect() [6/13]

bool MathTools::Intersect ( const CollisionVolumeBSphere BSphere,
const CollisionVolumeOBB OBB 
)

Test intersection between BSphere and OBB.

Parameters
BSphereA BSphere.
OBBAn OBB.
Returns
True if it succeeds, false if it fails.

◆ Intersect() [7/13]

bool MathTools::Intersect ( const CollisionVolumeBSphere BSphere,
const CollisionVolumeOctree Octree 
)

Test intersection between BSphere and Octree.

Parameters
BSphereA BSphere.
OctreeAn Octree.
Returns
True if it succeeds, false if it fails.

◆ Intersect() [8/13]

bool MathTools::Intersect ( const CollisionVolumeBSphere BSphere_1,
const CollisionVolumeBSphere BSphere_2 
)

Test intersection between two BSpheres.

Parameters
BSphere_1The first sphere.
BSphere_2The second sphere.
Returns
True if it succeeds, false if it fails.

◆ Intersect() [9/13]

bool MathTools::Intersect ( const CollisionVolumeOBB OBB,
const CollisionVolumeOctree Octree 
)

Test intersection between an OBB and an Octree.

Parameters
OBBAn OBB.
OctreeAn Octree.
Returns
True if it succeeds, false if it fails.

◆ Intersect() [10/13]

bool MathTools::Intersect ( const CollisionVolumeOBB OBB,
const Triangle triangle 
)

Test intersection between an OBB and a Triangle.

Parameters
OBBAn OBB.
triangleA triangle.
Returns
True if it succeeds, false if it fails.

◆ Intersect() [11/13]

bool MathTools::Intersect ( const CollisionVolumeOBB OBB,
const Vect &  point 
)

Test intersection between an OBB and a point.

Parameters
OBBAn OBB.
pointA point.
Returns
True if it succeeds, false if it fails.

◆ Intersect() [12/13]

bool MathTools::Intersect ( const CollisionVolumeOBB OBB_1,
const CollisionVolumeOBB OBB_2 
)

Test intersection between two OBBs.

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

◆ Intersect() [13/13]

bool MathTools::Intersect ( const CollisionVolumeOctree Octree_1,
const CollisionVolumeOctree Octree_2 
)

Test intersection between two Octrees.

Parameters
Octree_1An Octree.
Octree_2An Octree.
Returns
True if it succeeds, false if it fails.

◆ IsGreaterThan()

bool MathTools::IsGreaterThan ( const Vect &  vect_1,
const Vect &  vect_2 
)

Determines if a Vect is greater than another Vect.

Parameters
vect_1A Vect.
vect_2A Vect.
Returns
True if greater than , otherwise false.

◆ IsInRange()

bool MathTools::IsInRange ( const Vect &  vect,
const Vect &  vect_1,
const Vect &  vect_2 
)

Determines if a Vect is in between two Vect values

Parameters
vectA Vect.
vect_1A Vect.
vect_2A Vect.
Returns
True if within range, otherwise false.

◆ IsLessThan()

bool MathTools::IsLessThan ( const Vect &  vect_1,
const Vect &  vect_2 
)

Determines if a Vect is less than another Vect.

Parameters
vect_1A Vect.
vect_2A Vect.
Returns
True if less than , otherwise false.

◆ Max()

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

Constructs Vect using the maximum values of two Vects.

Parameters
vect_1A Vect.
vect_2A Vect.
Returns
Vect with maximum values.

◆ Min()

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

Constructs Vect using the mininum values of two Vects.

Parameters
vect_1A Vect.
vect_2A Vect.
Returns
Vect with minimum values.

◆ MultiplyComponents()

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

Multiplies two vectors by each component (x1 * x2, y1 * y2, z1 * z2).

Parameters
vect_1A Vect.
vect_2A Vect.
Returns
A Vect

◆ power()

float MathTools::power ( float  base,
int  exponent 
)

raises base to the power of integers.

Parameters
baseThe base.
exponentAn interger exponent.
Returns
A type.

◆ RotationFromTowards()

Matrix MathTools::RotationFromTowards ( const Vect &  current,
const Vect &  target 
)

Computes rotation matrix to rotate vector from current to target.

.

Parameters
currentA Vect.
targetA Vect.
Returns
a rotation matrix.