MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Typedefs | Functions
Mezzanine::MathTools Namespace Reference

This namespace is the home of a number of utility variables and methods to facilitate various math related tasks. More...

Typedefs

typedef std::pair< Boolean, RayGeometryRayTestResult
 This is a type used for the return of a ray intersection test. More...
 
typedef std::pair< Boolean,
Vector3
PlaneRayTestResult
 This is a type used for the ray intersection tests performed on Planes. More...
 

Functions

Real ACos (const Real &Interval)
 Calculates the principal value of the arc Cosine of an angle. More...
 
Real ASin (const Real &Interval)
 Calculates the principal value of the arc Sine of an angle. More...
 
Real ATan (const Real &Interval)
 Calculates the principal value of the arc Tangent of an angle. More...
 
Real Ceil (const Real &Val)
 Rounds a Real up. More...
 
Real Cos (const Real &Radians)
 Calculates the Cosine of an angle. More...
 
Real DegreesToRadians (const Real &Degrees)
 Converts an angle in Degree's to the same angle Radians. More...
 
Real Fabs (const Real &Val)
 Gets the absolute value of a Real. More...
 
Real Floor (const Real &Val)
 Rounds a Real down. More...
 
Real Fmod (const Real &Numerator, const Real &Denominator)
 Modulo, fo' Reals. Returns the remainder of the division between two Reals. More...
 
Real GetDegToRadMultiplier ()
 Gets a multiplier used in converting Degree angular units to Radians.
 
Real GetHalfPi ()
 Gets half of Pi.
 
Real GetPi ()
 Gets Pi.
 
Real GetQuarterPi ()
 Gets Quarter Pi.
 
Real GetRadToDegMultiplier ()
 Gets a multiplier used in converting Radian angular units to degrees.
 
Real GetTwoPi ()
 Gets Pi times two.
 
PlaneRayTestResult Intersects (const Plane &Surface, const Ray &Cast)
 Checks to see if a ray intersects with a Plane. More...
 
GeometryRayTestResult Intersects (const AxisAlignedBox &Box, const Ray &Cast)
 Checks to see if a ray intersects with an AABB. More...
 
GeometryRayTestResult Intersects (const Sphere &Ball, const Ray &Cast)
 Checks to see if a ray intersects with a Sphere. More...
 
Boolean IsInside (const AxisAlignedBox &Box, const Vector3 &Point)
 Checks to see if a point in 3D space is within an AABB. More...
 
Boolean IsInside (const Sphere &Ball, const Vector3 &Point)
 Checks to see if a point in 3D space is within a Sphere. More...
 
Boolean Overlap (const AxisAlignedBox &Box, const Sphere &Ball)
 Checks to see if an AABB and Sphere are overlapping. More...
 
Boolean Overlap (const AxisAlignedBox &Box, const Plane &Surface)
 Checks to see if an AANN and Plane are overlapping. More...
 
Boolean Overlap (const Plane &Surface, const Sphere &Ball)
 Checks to see if a Plane and Sphere are overlapping. More...
 
Boolean Overlap (const AxisAlignedBox &Box1, const AxisAlignedBox &Box2)
 Checks to see if two AABBs are overlapping. More...
 
Boolean Overlap (const Sphere &Ball1, const Sphere &Ball2)
 Checks to see if two Spheres are overlapping. More...
 
Boolean Overlap (const Plane &Surface1, const Plane &Surface2)
 Checks to see if two Planes are overlapping. More...
 
Real Pow (const Real &Val, const Real &Power)
 Raises a Real to a power. More...
 
Real RadiansToDegrees (const Real &Radians)
 Converts an angle in Radians's to the same angle Degrees. More...
 
Real Sin (const Real &Radians)
 Calculates the Sine of an angle. More...
 
Real Sqrt (const Real &Val)
 Gets the square root of a Real. More...
 
Real Tan (const Real &Radians)
 Calculates the Tangent of an angle. More...
 
bool WithinTolerance (const Real &First, const Real &Second, const Real &Tolerance)
 Checks to see if two Reals are within a certain range of each other. More...
 

Detailed Description

This namespace is the home of a number of utility variables and methods to facilitate various math related tasks.

Typedef Documentation

This is a type used for the return of a ray intersection test.

This type provides more verbose return data that can be used for further tests.

Definition at line 60 of file mathtool.h.

This is a type used for the ray intersection tests performed on Planes.

This type provides more verbose return data that can be used for further tests.

Definition at line 57 of file mathtool.h.

Function Documentation

Real Mezzanine::MathTools::ACos ( const Real &  Interval)

Calculates the principal value of the arc Cosine of an angle.

Parameters
IntervalThe Interval to calculate the arc Cosine. Range is -1.0 to 1.0.
Returns
Returns a Real representing the principal value of the arc Cosine of the angle provided in Radians.

Definition at line 158 of file mathtool.cpp.

Real Mezzanine::MathTools::ASin ( const Real &  Interval)

Calculates the principal value of the arc Sine of an angle.

Parameters
IntervalThe Interval to calculate the arc Cosine. Range is -1.0 to 1.0.
Returns
Returns a Real representing the principal value of the arc Sine of the angle provided in Radians.

Definition at line 161 of file mathtool.cpp.

Real Mezzanine::MathTools::ATan ( const Real &  Interval)

Calculates the principal value of the arc Tangent of an angle.

Parameters
IntervalThe Interval to calculate the arc Cosine. Range is -1.0 to 1.0.
Returns
Returns a Real representing the principal value of the arc Tangent of the angle provided in Radians.

Definition at line 164 of file mathtool.cpp.

Real Mezzanine::MathTools::Ceil ( const Real &  Val)

Rounds a Real up.

Parameters
ValThe value to be rounded.
Returns
Returns the result of the rounding.

Definition at line 125 of file mathtool.cpp.

Real Mezzanine::MathTools::Cos ( const Real &  Radians)

Calculates the Cosine of an angle.

Parameters
RadiansThe angle to be computed in Radians.
Returns
Returns a Real representing the Cosine of the angle provided.

Definition at line 149 of file mathtool.cpp.

Real Mezzanine::MathTools::DegreesToRadians ( const Real &  Degrees)

Converts an angle in Degree's to the same angle Radians.

Parameters
DegreesThe number of Degree's to convert.
Returns
Returns the converted number in Radians.

Definition at line 170 of file mathtool.cpp.

Real Mezzanine::MathTools::Fabs ( const Real &  Val)

Gets the absolute value of a Real.

Parameters
ValThe value to get the absolute value of.
Returns
Returns the absolute value of the Real.

Definition at line 137 of file mathtool.cpp.

Real Mezzanine::MathTools::Floor ( const Real &  Val)

Rounds a Real down.

Parameters
ValThe value to be rounded.
Returns
Returns the result of the rounding.

Definition at line 128 of file mathtool.cpp.

Real Mezzanine::MathTools::Fmod ( const Real &  Numerator,
const Real &  Denominator 
)

Modulo, fo' Reals. Returns the remainder of the division between two Reals.

Parameters
NumeratorThe number on top.
DenominatorThe number on bottom.
Returns
Returns the remainder of division between the two Reals passed in.

Definition at line 140 of file mathtool.cpp.

PlaneRayTestResult Mezzanine::MathTools::Intersects ( const Plane &  Surface,
const Ray &  Cast 
)

Checks to see if a ray intersects with a Plane.

Parameters
SurfaceThe Plane to check for intersection.
CastThe casted ray to check for intersection.
Returns
Returns true if the ray intersects with the provided Plane.

Definition at line 238 of file mathtool.cpp.

GeometryRayTestResult Mezzanine::MathTools::Intersects ( const AxisAlignedBox &  Box,
const Ray &  Cast 
)

Checks to see if a ray intersects with an AABB.

Parameters
BoxThe AABB to check for intersection.
CastThe casted ray to check for intersection.
Returns
Returns a std::pair containing whether or not the ray hit, and if it did also a ray that is the subsection of the casted ray that went through the AABB.

Definition at line 255 of file mathtool.cpp.

GeometryRayTestResult Mezzanine::MathTools::Intersects ( const Sphere &  Ball,
const Ray &  Cast 
)

Checks to see if a ray intersects with a Sphere.

Parameters
BallThe Sphere to check for intersection.
CastThe casted ray to check for intersection.
Returns
Returns a std::pair containing whether or not the ray hit, and if it did also a ray that is the subsection of the casted ray that went through the Sphere.

Definition at line 300 of file mathtool.cpp.

Boolean Mezzanine::MathTools::IsInside ( const AxisAlignedBox &  Box,
const Vector3 &  Point 
)

Checks to see if a point in 3D space is within an AABB.

Parameters
BoxThe AABB to check if the point is inside.
PointThe point in 3D space to check if it is within the AABB.
Returns
Returns true if the provided point is within the AABB, false otherwise.

Definition at line 182 of file mathtool.cpp.

Boolean Mezzanine::MathTools::IsInside ( const Sphere &  Ball,
const Vector3 &  Point 
)

Checks to see if a point in 3D space is within a Sphere.

Parameters
BallThe Sphere to check if the point is inside.
PointThe point in 3D space to check if it is within the Sphere.
Returns
Returns true if the provided point is within the sphere, false otherwise.

Definition at line 189 of file mathtool.cpp.

Boolean Mezzanine::MathTools::Overlap ( const AxisAlignedBox &  Box,
const Sphere &  Ball 
)

Checks to see if an AABB and Sphere are overlapping.

Parameters
BoxThe AABB to check for overlap.
BallThe Sphere to check for overlap.
Returns
Returns true if the AABB and Sphere overlap, false otherwise.

Definition at line 194 of file mathtool.cpp.

Boolean Mezzanine::MathTools::Overlap ( const AxisAlignedBox &  Box,
const Plane &  Surface 
)

Checks to see if an AANN and Plane are overlapping.

Parameters
BoxThe AABB to check for overlap.
SurfaceThe Plane to check for overlap.
Returns
Returns true if the AABB and Pland overlap, false otherwise.

Definition at line 211 of file mathtool.cpp.

Boolean Mezzanine::MathTools::Overlap ( const Plane &  Surface,
const Sphere &  Ball 
)

Checks to see if a Plane and Sphere are overlapping.

Parameters
SurfaceThe Plane to check for overlap.
BallThe Sphere to check for overlap.
Returns
Returns true if the Plane and Sphere overlap, false otherwise.

Definition at line 216 of file mathtool.cpp.

Boolean Mezzanine::MathTools::Overlap ( const AxisAlignedBox &  Box1,
const AxisAlignedBox &  Box2 
)

Checks to see if two AABBs are overlapping.

Parameters
Box1The first AABB to check for overlap.
Box2The second AABB to check for overlap.
Returns
Returns true if the two AABBs are overlapping, false otherwise.

Definition at line 221 of file mathtool.cpp.

Boolean Mezzanine::MathTools::Overlap ( const Sphere &  Ball1,
const Sphere &  Ball2 
)

Checks to see if two Spheres are overlapping.

Parameters
Ball1The first Sphere to check for overlap.
Ball2The second Sphere to check for overlap.
Returns
Returns true if the two Spheres are overlapping, false otherwise.

Definition at line 227 of file mathtool.cpp.

Boolean Mezzanine::MathTools::Overlap ( const Plane &  Surface1,
const Plane &  Surface2 
)

Checks to see if two Planes are overlapping.

Parameters
Surface1The first Plane to check for overlap.
Surface2The second Plane to check for overlap.
Returns
Returns true if the two Planes are overlapping, false otherwise.

Definition at line 233 of file mathtool.cpp.

Real Mezzanine::MathTools::Pow ( const Real &  Val,
const Real &  Power 
)

Raises a Real to a power.

Parameters
ValThe base number to be raised.
PowerThe power (or exponent) to raise the Real by.
Returns
Returns the Raised Eeal.

Definition at line 131 of file mathtool.cpp.

Real Mezzanine::MathTools::RadiansToDegrees ( const Real &  Radians)

Converts an angle in Radians's to the same angle Degrees.

Parameters
RadiansThe number of Radians's to convert.
Returns
Returns the converted number in Degrees.

Definition at line 173 of file mathtool.cpp.

Real Mezzanine::MathTools::Sin ( const Real &  Radians)

Calculates the Sine of an angle.

Parameters
RadiansThe angle to be computed in Radians.
Returns
Returns a Real representing the Sine of the angle provided.

Definition at line 152 of file mathtool.cpp.

Real Mezzanine::MathTools::Sqrt ( const Real &  Val)

Gets the square root of a Real.

Parameters
ValThe number to be calculated.
Returns
Returns the calculated square root.

Definition at line 134 of file mathtool.cpp.

Real Mezzanine::MathTools::Tan ( const Real &  Radians)

Calculates the Tangent of an angle.

Parameters
RadiansThe angle to be computed in Radians.
Returns
Returns a Real representing the Tangent of the angle provided.

Definition at line 155 of file mathtool.cpp.

bool Mezzanine::MathTools::WithinTolerance ( const Real &  First,
const Real &  Second,
const Real &  Tolerance 
)

Checks to see if two Reals are within a certain range of each other.

Parameters
FirstThe first of two Reals to compare.
SecondThe second of two Reals to compare.
ToleranceThe leeway allowed in how far the two can be apart.
Returns
Returns true if the two numbers are within the amount specified by Tolerance of each other, false otherwise.

Definition at line 143 of file mathtool.cpp.