Mathematics utilitarian functions and classes. More...
Data Structures | |
| class | AngleAxis |
| The angle-axis rotation representation ( angle rotated around axis ). More... | |
| class | Box |
| An axis aligned 3D box. More... | |
| class | Matrix |
| A 4x4 matrix. More... | |
| class | OrientedBox |
| This is an oriented (rotated) bounding box, used for early collision tests. More... | |
| class | Plane |
| A 3D infinite plane. More... | |
| class | Quaternion |
| The mighty quaternion, holding rotation. More... | |
| class | Ray |
| A ray, stored as first point and direction. More... | |
| class | Vector3D |
| A 3D vector. More... | |
Functions | |
| template<class T > | |
| void | swapValues (T &rA, T &rB) |
| swap variables of any type | |
| template<class T > | |
| T | clampValue (T aA, T aMin, T aMax) |
| clamp variables of any type | |
| NYTRO_EXPORT float32 | getCos2D (float32 x1, float32 y1, float32 x2, float32 y2) |
| NYTRO_EXPORT Vector3D | getHermitePoint (Vector3D &rA, Vector3D &rAN, Vector3D &rBN, Vector3D &rB, float32 aTime) |
| compute hermite point using control points rA,rB incoming tangent rAN, outgoing rBN, at interpolation point aTime [0..1] | |
| NYTRO_EXPORT void | getShadowMatrix (float32 aShadowMat[4][4], float32 aGroundPlane[4], float32 aLightPos[4]) |
| compute a shadow matrix | |
| NYTRO_EXPORT void | getReflectedPoint (Vector3D &rN, Vector3D &rL, Vector3D &rR) |
| NYTRO_EXPORT void | getRefractedPoint (Vector3D &rN, Vector3D &rL, Vector3D &rR, float32 aCoef) |
| NYTRO_EXPORT void | getProjectedPoint (Vector3D &rP1, Vector3D &rP2, Vector3D &rP3, Vector3D &rP, Vector3D &rProj) |
| NYTRO_EXPORT void | setRandomSeed (int32 aSeed) |
| set the random seed | |
| NYTRO_EXPORT int32 | getRandomInteger (int32 aMax) |
| NYTRO_EXPORT float32 | getRandomFloat (float32 aLow, float32 aHigh) |
| NYTRO_EXPORT bool | sphereIntersect (Vector3D &rSphereCenter1, Vector3D &rSphereCenter2, Vector3D &rVelocity1, Vector3D &rVelocity2, float32 aRadius1, float32 aRadius2, float32 &rTimeIn, float32 &rTimeOut) |
| intersect spheres with centers aSphereCenter1 and aSphereCenter2, with velocities aVelocity1, aVelocity2, with radiuses aRadius1, aRadius2, into rTimeIn and rTimeOut | |
| NYTRO_EXPORT bool | triangleLineIntersect (Vector3D &rP1, Vector3D &rP2, Vector3D &rP3, Vector3D &rL1, Vector3D &rL2, Vector3D &rIntersection, float32 &rTime, bool bAcceptBackface=true) |
| intersect triangle [rP1,rP2,rP3] and line [rL1,rL2], put into rIntersection the intersection point at rTime [0..1] | |
| NYTRO_EXPORT bool | lineLineIntersect (Vector3D &rLA1, Vector3D &rLA2, Vector3D &rLB1, Vector3D &rLB2, Vector3D &rL1, Vector3D &rL2, float32 &rT1, float32 &rT2, float32 aTolerance=0.0001) |
| intersect two infinite 3D lines rLA1, rLB1 and rLA2, rLB2 resulting a segment rL1,rL2 which is the smallest segment between the two lines it will also return the rT1 on line 1, and rT2 on line 2 (the actual rL1 and rL2), aTolerance is the error threshold used to detect intersection | |
| NYTRO_EXPORT bool | segmentSegmentIntersect (Vector3D &rLA1, Vector3D &rLA2, Vector3D &rLB1, Vector3D &rLB2, Vector3D &rL1, Vector3D &rL2, float32 &rT1, float32 &rT2, float32 aSmallestDistance=0, float32 aTolerance=0.0001) |
| intersect two finite 3D segment lines rLA1, rLB1 and rLA2, rLB2 resulting a segment rL1,rL2 which is the smallest segment between the two lines it will also return the rT1 on line 1, and rT2 on line 2 (the actual rL1 and rL2), aTolerance is the error threshold used to detect intersection | |
| NYTRO_EXPORT bool | linePolylineIntersect (Vector3D &rA, Vector3D &rB, vector< Vector3D > &rPolyline, float32 aSmallestDistance=1, float32 aTolerance=0.0001) |
| intersect a line with a polyline | |
| NYTRO_EXPORT float32 | getEasedValue (float32 aPrevious, float32 aCurrent, float32 aNext, float32 aEaseFrom, float32 aEaseTo) |
| ease a value | |
| NYTRO_EXPORT float32 | getRandomNormalizedFloat () |
| NYTRO_EXPORT Vector3D | getClosestPointOnLineSegment (Vector3D &rA, Vector3D &rB, Vector3D &rP, bool &rEdge) |
| NYTRO_EXPORT Vector3D | getClosestPointOnLine (Vector3D &rA, Vector3D &rB, Vector3D &rP) |
| NYTRO_EXPORT bool | isPointInsideEdge (Vector3D &rA, Vector3D &rB, Vector3D &rP) |
| NYTRO_EXPORT bool | intersectRaySphere (Vector3D &rCenter, float32 aRadius, Ray &rRay, float32 &rHitTime, Vector3D &rHitPosIn, Vector3D &rHitPosOut) |
| intersect a ray/line with a sphere | |
Variables | |
| const float64 | kConst_2PI = 6.283185307f |
| const float64 | kConst_PI = 3.141592654f |
| const float64 | kConst_HalfPI = 1.570796327f |
| const float64 | kConst_Eps = 0.001f |
| const float64 | kConst_Epsilon = 1.0e-6 |
| const float64 | kConst_PIOver180 = kConst_PI / 180.0f |
| const float64 | kConst_180OverPI = 180.0f / kConst_PI |
| const float64 | kConst_PIx180 = kConst_PI * 180.0f |
| const float32 | kMeterUnit = 1.0f |
| how many world units is 1 meter | |
| const float32 | kFeetUnit = kMeterUnit * 0.3048f |
| const float32 | kOneKm = kMeterUnit*1000.0f |
| const float32 | kOneMile = kOneKm*1.609344f |
| const float32 | kOneNauticalMile = kOneKm*1.852f |
| const float64 | M_PI = kConst_PI |
| const float64 | PI = kConst_PI |
Mathematics utilitarian functions and classes.
| T Nytro::Math::clampValue | ( | T | aA, | |
| T | aMin, | |||
| T | aMax | |||
| ) | [inline] |
| NYTRO_EXPORT Vector3D Nytro::Math::getClosestPointOnLine | ( | Vector3D & | rA, | |
| Vector3D & | rB, | |||
| Vector3D & | rP | |||
| ) |
| NYTRO_EXPORT Vector3D Nytro::Math::getClosestPointOnLineSegment | ( | Vector3D & | rA, | |
| Vector3D & | rB, | |||
| Vector3D & | rP, | |||
| bool & | rEdge | |||
| ) |
| NYTRO_EXPORT float32 Nytro::Math::getCos2D | ( | float32 | x1, | |
| float32 | y1, | |||
| float32 | x2, | |||
| float32 | y2 | |||
| ) |
| NYTRO_EXPORT float32 Nytro::Math::getEasedValue | ( | float32 | aPrevious, | |
| float32 | aCurrent, | |||
| float32 | aNext, | |||
| float32 | aEaseFrom, | |||
| float32 | aEaseTo | |||
| ) |
ease a value
| NYTRO_EXPORT Vector3D Nytro::Math::getHermitePoint | ( | Vector3D & | rA, | |
| Vector3D & | rAN, | |||
| Vector3D & | rBN, | |||
| Vector3D & | rB, | |||
| float32 | aTime | |||
| ) |
compute hermite point using control points rA,rB incoming tangent rAN, outgoing rBN, at interpolation point aTime [0..1]
| NYTRO_EXPORT void Nytro::Math::getProjectedPoint | ( | Vector3D & | rP1, | |
| Vector3D & | rP2, | |||
| Vector3D & | rP3, | |||
| Vector3D & | rP, | |||
| Vector3D & | rProj | |||
| ) |
| NYTRO_EXPORT float32 Nytro::Math::getRandomFloat | ( | float32 | aLow, | |
| float32 | aHigh | |||
| ) |
| NYTRO_EXPORT int32 Nytro::Math::getRandomInteger | ( | int32 | aMax | ) |
| NYTRO_EXPORT float32 Nytro::Math::getRandomNormalizedFloat | ( | ) |
| NYTRO_EXPORT void Nytro::Math::getReflectedPoint | ( | Vector3D & | rN, | |
| Vector3D & | rL, | |||
| Vector3D & | rR | |||
| ) |
| NYTRO_EXPORT void Nytro::Math::getRefractedPoint | ( | Vector3D & | rN, | |
| Vector3D & | rL, | |||
| Vector3D & | rR, | |||
| float32 | aCoef | |||
| ) |
| NYTRO_EXPORT void Nytro::Math::getShadowMatrix | ( | float32 | aShadowMat[4][4], | |
| float32 | aGroundPlane[4], | |||
| float32 | aLightPos[4] | |||
| ) |
compute a shadow matrix
| NYTRO_EXPORT bool Nytro::Math::intersectRaySphere | ( | Vector3D & | rCenter, | |
| float32 | aRadius, | |||
| Ray & | rRay, | |||
| float32 & | rHitTime, | |||
| Vector3D & | rHitPosIn, | |||
| Vector3D & | rHitPosOut | |||
| ) |
intersect a ray/line with a sphere
| NYTRO_EXPORT bool Nytro::Math::isPointInsideEdge | ( | Vector3D & | rA, | |
| Vector3D & | rB, | |||
| Vector3D & | rP | |||
| ) |
| NYTRO_EXPORT bool Nytro::Math::lineLineIntersect | ( | Vector3D & | rLA1, | |
| Vector3D & | rLA2, | |||
| Vector3D & | rLB1, | |||
| Vector3D & | rLB2, | |||
| Vector3D & | rL1, | |||
| Vector3D & | rL2, | |||
| float32 & | rT1, | |||
| float32 & | rT2, | |||
| float32 | aTolerance = 0.0001 | |||
| ) |
intersect two infinite 3D lines rLA1, rLB1 and rLA2, rLB2 resulting a segment rL1,rL2 which is the smallest segment between the two lines
it will also return the rT1 on line 1, and rT2 on line 2 (the actual rL1 and rL2), aTolerance is the error threshold used to detect intersection
| NYTRO_EXPORT bool Nytro::Math::linePolylineIntersect | ( | Vector3D & | rA, | |
| Vector3D & | rB, | |||
| vector< Vector3D > & | rPolyline, | |||
| float32 | aSmallestDistance = 1, |
|||
| float32 | aTolerance = 0.0001 | |||
| ) |
intersect a line with a polyline
| NYTRO_EXPORT bool Nytro::Math::segmentSegmentIntersect | ( | Vector3D & | rLA1, | |
| Vector3D & | rLA2, | |||
| Vector3D & | rLB1, | |||
| Vector3D & | rLB2, | |||
| Vector3D & | rL1, | |||
| Vector3D & | rL2, | |||
| float32 & | rT1, | |||
| float32 & | rT2, | |||
| float32 | aSmallestDistance = 0, |
|||
| float32 | aTolerance = 0.0001 | |||
| ) |
intersect two finite 3D segment lines rLA1, rLB1 and rLA2, rLB2 resulting a segment rL1,rL2 which is the smallest segment between the two lines
it will also return the rT1 on line 1, and rT2 on line 2 (the actual rL1 and rL2), aTolerance is the error threshold used to detect intersection
| NYTRO_EXPORT void Nytro::Math::setRandomSeed | ( | int32 | aSeed | ) |
set the random seed
| NYTRO_EXPORT bool Nytro::Math::sphereIntersect | ( | Vector3D & | rSphereCenter1, | |
| Vector3D & | rSphereCenter2, | |||
| Vector3D & | rVelocity1, | |||
| Vector3D & | rVelocity2, | |||
| float32 | aRadius1, | |||
| float32 | aRadius2, | |||
| float32 & | rTimeIn, | |||
| float32 & | rTimeOut | |||
| ) |
intersect spheres with centers aSphereCenter1 and aSphereCenter2, with velocities aVelocity1, aVelocity2, with radiuses aRadius1, aRadius2, into rTimeIn and rTimeOut
| void Nytro::Math::swapValues | ( | T & | rA, | |
| T & | rB | |||
| ) | [inline] |
| NYTRO_EXPORT bool Nytro::Math::triangleLineIntersect | ( | Vector3D & | rP1, | |
| Vector3D & | rP2, | |||
| Vector3D & | rP3, | |||
| Vector3D & | rL1, | |||
| Vector3D & | rL2, | |||
| Vector3D & | rIntersection, | |||
| float32 & | rTime, | |||
| bool | bAcceptBackface = true | |||
| ) |
intersect triangle [rP1,rP2,rP3] and line [rL1,rL2], put into rIntersection the intersection point at rTime [0..1]
| const float64 Nytro::Math::kConst_180OverPI = 180.0f / kConst_PI |
| const float64 Nytro::Math::kConst_2PI = 6.283185307f |
| const float64 Nytro::Math::kConst_Eps = 0.001f |
| const float64 Nytro::Math::kConst_Epsilon = 1.0e-6 |
| const float64 Nytro::Math::kConst_HalfPI = 1.570796327f |
| const float64 Nytro::Math::kConst_PI = 3.141592654f |
| const float64 Nytro::Math::kConst_PIOver180 = kConst_PI / 180.0f |
| const float64 Nytro::Math::kConst_PIx180 = kConst_PI * 180.0f |
| const float32 Nytro::Math::kFeetUnit = kMeterUnit * 0.3048f |
| const float32 Nytro::Math::kMeterUnit = 1.0f |
| const float32 Nytro::Math::kOneKm = kMeterUnit*1000.0f |
| const float32 Nytro::Math::kOneMile = kOneKm*1.609344f |
| const float32 Nytro::Math::kOneNauticalMile = kOneKm*1.852f |
| const float64 Nytro::Math::M_PI = kConst_PI |
| const float64 Nytro::Math::PI = kConst_PI |