Implements general math tools. More...
Files | |
file | CBezier.h |
Implements support for Bezier curves and surface patches. | |
file | CConstants.h |
Implements mathematical constants. | |
file | CGeometry.h |
Implements general geometry utility functions. | |
file | CMarchingCubes.h |
Implementation of the marching cube algorithm. | |
file | CMaths.h |
Implements general math utility functions. | |
file | CMatrix3d.h |
Implements a 3D matrix. | |
file | CPolySolver.h |
Implements polynomial solvers. | |
file | CQuaternion.h |
Implements a quaternion. | |
file | CTransform.h |
Implements a transformation matrix. | |
file | CVector3d.h |
Implements a 3D vector. | |
Classes | |
struct | chai3d::cMarchingCubeTriangle |
struct | chai3d::cMarchingCubeGridCell |
struct | chai3d::cMatrix3d |
This class implements a 3D matrix. More... | |
struct | chai3d::cQuaternion |
This class implements a quaternion. More... | |
struct | chai3d::cTransform |
This class implements a 4D transformation matrix encoded as column-major. More... | |
struct | chai3d::cVector3d |
This class implements a 3D vector. More... | |
Functions | |
cVector3d | chai3d::cEvalBezierCurve (const cVector3d *a_controlPoints, double a_t) |
This function determines the position of a point along a Bezier curve. More... | |
cVector3d | chai3d::cEvalBezierPatch (const cVector3d *a_controlPoints, double a_u, double a_v) |
This function determines the position of a point along a Bezier patch. More... | |
cVector3d | chai3d::cDerivBezier (const cVector3d *a_controlPoints, double a_t) |
This function determines the derivative of a point along a Bezier curve. More... | |
cVector3d | chai3d::cDerivUBezier (const cVector3d *a_controlPoints, double a_u, double a_v) |
This function determines the derivative of a point on a Bezier patch along the u parametric direction. More... | |
cVector3d | chai3d::cDerivVBezier (const cVector3d *a_controlPoints, double a_u, double a_v) |
This function determines the derivative of a point on a Bezier patch along the v parametric direction. More... | |
cVector3d | chai3d::cSurfaceNormalBezier (const cVector3d *a_controlPoints, double a_u, double a_v) |
This function determines the surface normal at a point on a Bezier patch. More... | |
double | chai3d::cTriangleArea (const cVector3d &a_vertex0, const cVector3d &a_vertex1, const cVector3d &a_vertex2) |
This function computes the area of a triangle. More... | |
cVector3d | chai3d::cProjectPointOnPlane (const cVector3d &a_point, const cVector3d &a_planePoint, const cVector3d &a_planeNormal) |
This function computes the projection of a point onto a plane. More... | |
cVector3d | chai3d::cProjectPointOnPlane (const cVector3d &a_point, const cVector3d &a_planePoint0, const cVector3d &a_planePoint1, const cVector3d &a_planePoint2) |
This function computes the projection of a point onto a plane. More... | |
void | chai3d::cProjectPointOnPlane (const cVector3d &a_point, const cVector3d &a_planePoint0, const cVector3d &a_planePoint1, const cVector3d &a_planePoint2, double &a_r01, double &a_r02) |
This function computes the projection of a point onto a plane. More... | |
cVector3d | chai3d::cProjectPointOnLine (const cVector3d &a_point, const cVector3d &a_pointOnLine, const cVector3d &a_directionOfLine) |
This function computes the projection of a point onto a line. More... | |
cVector3d | chai3d::cProjectPointOnSegment (const cVector3d &a_point, const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB) |
This function computes the projection of a point onto a segment. More... | |
cVector3d | chai3d::cProjectPointOnDiskXY (const cVector3d &a_point, const double &a_height, const double &a_radius) |
This function computes the projection of a point onto a disk. More... | |
cVector3d | chai3d::cProjectPointOnTriangle (const cVector3d &a_point, const cVector3d &a_vertex0, const cVector3d &a_vertex1, const cVector3d &a_vertex2) |
This function computes the projection of a point onto a triangle. More... | |
cVector3d | chai3d::cProject (const cVector3d &a_vector0, const cVector3d &a_vector1) |
This function computes the projection of a vector V0 onto a vector V1. More... | |
double | chai3d::cDistanceToLine (const cVector3d &a_point, const cVector3d &a_linePoint1, const cVector3d &a_linePoint2) |
This function computes the distance between a point and a line. More... | |
cVector3d | chai3d::cComputeSurfaceNormal (const cVector3d &a_surfacePoint0, const cVector3d &a_surfacePoint1, const cVector3d &a_surfacePoint2) |
This function computes the surface normal of a plane. More... | |
bool | chai3d::cBoxContains (const cVector3d &a_point, const cVector3d &a_boxMin, const cVector3d &a_boxMax) |
This function checks if a point is contained in a box. More... | |
int | chai3d::cIntersectionSegmentPlane (const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const cVector3d &a_planePos, const cVector3d &a_planeNormal, cVector3d &a_collisionPoint, cVector3d &a_collisionNormal) |
This function computes the intersection between a segment and a plane. More... | |
int | chai3d::cIntersectionSegmentDisk (const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const cVector3d &a_diskPos, const cVector3d &a_diskNormal, const double &a_diskRadius, cVector3d &a_collisionPoint, cVector3d &a_collisionNormal) |
This function computes the intersection between a segment and a disk. More... | |
int | chai3d::cIntersectionSegmentSphere (const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const cVector3d &a_spherePos, const double &a_sphereRadius, cVector3d &a_collisionPoint0, cVector3d &a_collisionNormal0, cVector3d &a_collisionPoint1, cVector3d &a_collisionNormal1) |
This function computes the intersection between a segment and a sphere. More... | |
int | chai3d::cIntersectionSegmentEllipsoid (const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const cVector3d &a_pos, const double &a_radiusX, const double &a_radiusY, const double &a_radiusZ, cVector3d &a_collisionPoint0, cVector3d &a_collisionNormal0, cVector3d &a_collisionPoint1, cVector3d &a_collisionNormal1) |
This function computes the intersection between a segment and a sphere. More... | |
int | chai3d::cIntersectionSegmentToplessCylinder (const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const cVector3d &a_cylinderPointA, const cVector3d &a_cylinderPointB, const double &a_cylinderRadius, cVector3d &a_collisionPoint0, cVector3d &a_collisionNormal0, double &a_collisionPointRelPosAB0, cVector3d &a_collisionPoint1, cVector3d &a_collisionNormal1, double &a_collisionPointRelPosAB1) |
This function computes the intersection between a segment and a topless cylinder. More... | |
int | chai3d::cIntersectionSegmentCylinder (const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const double &a_baseRadius, const double &a_topRadius, const double &a_height, cVector3d &a_collisionPoint, cVector3d &a_collisionNormal) |
This function computes the nearest intersection point between a segment and a cylinder. More... | |
int | chai3d::cIntersectionSegmentBox (const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const cVector3d &a_boxMin, const cVector3d &a_boxMax, cVector3d &a_collisionPoint, cVector3d &a_collisionNormal) |
This function computes the nearest intersection point between a segment and a box. More... | |
int | chai3d::cIntersectionSegmentTorus (const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const double &a_innerRadius, const double &a_outerRadius, cVector3d &a_collisionPoint, cVector3d &a_collisionNormal) |
This function computes the nearest intersection point between a segment and a torus. More... | |
bool | chai3d::cIntersectionSegmentTriangle (const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, const cVector3d &a_triangleVertex0, const cVector3d &a_triangleVertex1, const cVector3d &a_triangleVertex2, const bool a_reportFrontSideCollision, const bool a_reportBackSideCollision, cVector3d &a_collisionPoint, cVector3d &a_collisionNormal, double &a_collisionPosVertex01, double &a_collisionPosVertex02) |
This function computes the intersection between a segment and a triangle. More... | |
cVector3d | chai3d::cVertexInterpolation (double a_isolevel, cVector3d a_p1, cVector3d a_p2, double a_valp1, double a_valp2) |
This function linearly interpolate the position where an isosurface cuts an edge between two vertices, each with their own scalar value. More... | |
int | chai3d::cPolygonize (cMarchingCubeGridCell a_grid, double a_isolevel, cMarchingCubeTriangle *a_triangles) |
This function calculates the triangular facets required to represent the isosurface through the cell. More... | |
bool | chai3d::cCheckBit (const unsigned int &a_value, const unsigned int &a_bitPosition) |
This function checks if a given bit is enabled. More... | |
unsigned int | chai3d::cSetBit (const unsigned int &a_data, const unsigned int &a_bitPosition, const bool a_value) |
This function sets the value of a specified bit of an unsigned integer. More... | |
bool | chai3d::cZero (const double &a_value) |
This function checks if a value is equal to or almost near zero. More... | |
template<class T > | |
T | chai3d::cAbs (const T &a_value) |
This function computes an absolute value. More... | |
template<class T > | |
double | chai3d::cSign (const T &a_value) |
This function computes the sign of a value. More... | |
template<class T > | |
T | chai3d::cMax (const T &a_value1, const T &a_value2) |
This function computes the maximum value between two values. More... | |
template<class T > | |
T | chai3d::cMin (const T &a_value1, const T &a_value2) |
This function computes the minimum value between two values. More... | |
template<class T > | |
T | chai3d::cMax3 (const T &a_value1, const T &a_value2, const T &a_value3) |
This function computes the maximum value between three values. More... | |
template<class T > | |
T | chai3d::cMin3 (const T &a_value1, const T &a_value2, const T &a_value3) |
This function computes the minimum value between three values. More... | |
template<class T > | |
void | chai3d::cSwap (T &a_value1, T &a_value2) |
This function swaps two elements. More... | |
template<class T > | |
T | chai3d::cLerp (const double &a_level, const T &a_value1, const T &a_value2) |
This function computes a linear interpolation between two values. More... | |
template<class T > | |
T | chai3d::cClamp (const T &a_value, const T &a_low, const T &a_high) |
This function clamps a value to a specified range. More... | |
template<class T > | |
T | chai3d::cClamp0 (const T &a_value) |
This function clamps a value to a value ranged between 0 and infinity. More... | |
double | chai3d::cClamp01 (const double &a_value) |
This function clamps a value to a value ranged between 0.0 and 1.0. More... | |
template<class T , class V > | |
bool | chai3d::cContains (const T &a_value, const V &a_low, const V &a_high) |
This function checks whether a value is within a specified range. More... | |
double | chai3d::cSqr (const double &a_value) |
This function computes the square of a scalar. More... | |
double | chai3d::cSqrt (const double &a_value) |
This function computes the square root of a scalar. More... | |
double | chai3d::cCbrt (const double &a_value) |
This function computes the cubic root of a scalar. More... | |
double | chai3d::cCosDeg (const double &a_angleDeg) |
Compute the cosine of an angle defined in degrees. More... | |
double | chai3d::cSinDeg (const double &a_angleDeg) |
This function computes the sine of an angle defined in degrees. More... | |
double | chai3d::cTanDeg (const double &a_angleDeg) |
This function computes the tangent of an angle defined in degrees. More... | |
double | chai3d::cCosRad (const double &a_angleRad) |
This function computes the cosine of an angle defined in radians. More... | |
double | chai3d::cSinRad (const double &a_angleRad) |
This function computes the sine of an angle defined in radians. More... | |
double | chai3d::cTanRad (const double &a_angleRad) |
This function computes the tangent of an angle defined in radians. More... | |
double | chai3d::cDegToRad (const double &a_angleDeg) |
This function converts an angle from degrees to radians. More... | |
double | chai3d::cRadToDeg (const double &a_angleRad) |
This function converts an angle from radians to degrees. More... | |
int | chai3d::cNumDigits (int a_value) |
This function computes the number of digits that compose a given integer. More... | |
cVector3d | chai3d::cAdd (const cVector3d &a_vector1, const cVector3d &a_vector2) |
This function computes the addition of two vectors. More... | |
cVector3d | chai3d::cAdd (const cVector3d &a_vector1, const cVector3d &a_vector2, const cVector3d &a_vector3) |
This function computes the addition of three vectors. More... | |
cVector3d | chai3d::cSub (const cVector3d &a_vector1, const cVector3d &a_vector2) |
This function computes the subtraction of two vectors. More... | |
cVector3d | chai3d::cNegate (const cVector3d &a_vector) |
This function computes the negated vector. More... | |
cVector3d | chai3d::cMul (const double &a_value, const cVector3d &a_vector) |
This function computes the multiplication of a vector by a scalar. More... | |
cVector3d | chai3d::cDiv (const double &a_value, const cVector3d &a_vector) |
This function computes the division of a vector by a scalar. More... | |
cVector3d | chai3d::cCross (const cVector3d &a_vector1, const cVector3d &a_vector2) |
This function computes the cross product between two vectors. More... | |
double | chai3d::cDot (const cVector3d &a_vector1, const cVector3d &a_vector2) |
This function computes the dot product between two vectors. More... | |
cVector3d | chai3d::cNormalize (const cVector3d &a_vector) |
This function computes the normalized vector. More... | |
double | chai3d::cDistance (const cVector3d &a_point1, const cVector3d &a_point2) |
This function computes the Euclidean distance between two points. More... | |
double | chai3d::cDistanceSq (const cVector3d &a_point1, const cVector3d &a_point2) |
This function computes the squared distance between two points. More... | |
bool | chai3d::cEqualPoints (const cVector3d &a_point1, const cVector3d &a_point2, const double a_epsilon=C_SMALL) |
This function determines whether two vectors are equal (i.e. represent the same point). More... | |
cMatrix3d | chai3d::cIdentity3d (void) |
This function return a 3x3 identity matrix. More... | |
cMatrix3d | chai3d::cAdd (const cMatrix3d &a_matrix1, const cMatrix3d &a_matrix2) |
This function computes the addition between two matrices. More... | |
cMatrix3d | chai3d::cSub (const cMatrix3d &a_matrix1, const cMatrix3d &a_matrix2) |
This function computes the subtraction between two matrices. More... | |
cMatrix3d | chai3d::cRotEulerRad (const double &a_angleRad1, const double &a_angleRad2, const double &a_angleRad3, const cEulerOrder a_eulerOrder, const bool a_useIntrinsicEulerModel=true) |
This function builds a rotation matrix from a set of Euler angles defined in radians. More... | |
cMatrix3d | chai3d::cRotEulerDeg (const double &a_angleDeg1, const double &a_angleDeg2, const double &a_angleDeg3, const cEulerOrder a_eulerOrder, const bool a_useIntrinsicEulerModel=true) |
This function builds a rotation matrix from a set of Euler angles defined in degrees. More... | |
cMatrix3d | chai3d::cRotAxisAngleRad (const double &a_axisX, const double &a_axisY, const double &a_axisZ, const double &a_angleRad) |
This function builds a rotation matrix from an axis-angle representation. More... | |
cMatrix3d | chai3d::cRotAxisAngleDeg (const double &a_axisX, const double &a_axisY, const double &a_axisZ, const double &a_angleDeg) |
This function builds a rotation matrix from an axis-angle representation. More... | |
cMatrix3d | chai3d::cMul (const cMatrix3d &a_matrix1, const cMatrix3d &a_matrix2) |
This function computes the multiplication of two matrices. More... | |
cVector3d | chai3d::cMul (const cMatrix3d &a_matrix, const cVector3d &a_vector) |
This function computes the multiplication of a matrix and a vector. More... | |
cMatrix3d | chai3d::cTranspose (const cMatrix3d &a_matrix) |
This function computes the transpose of a matrix. More... | |
cMatrix3d | chai3d::cInverse (const cMatrix3d &a_matrix) |
This function computes the inverse of a matrix. More... | |
double | chai3d::cAngle (const cVector3d &a_vector1, const cVector3d &a_vector2) |
This function computes the angle in radians between two vectors. More... | |
double | chai3d::cCosAngle (const cVector3d &a_vector1, const cVector3d &a_vector2) |
This function computes the cosine of the angle between two vectors. More... | |
int | chai3d::cSolveLinear (double a_coefficient[2], double a_solution[1]) |
This function computes the solution of a linear equation. More... | |
int | chai3d::cSolveQuadric (double a_coefficient[3], double a_solution[2]) |
This function computes the solution of a quadric equation. More... | |
int | chai3d::cSolveCubic (double a_coefficient[4], double a_solution[3]) |
This function computes the solution of a cubic equation. More... | |
int | chai3d::cSolveQuartic (double a_coefficient[5], double a_solution[4]) |
This function computes the solution of a quartic equation. More... | |
|
inline |
This function determines the position of a point along a Bezier curve at t [0:1].
a_controlPoints | Control points. (4 in total) |
a_t | Parameter t between 0 and 1. |
|
inline |
This function determines the position of a point along a Bezier patch at u [0:1] and v [0:1].
a_controlPoints | Control points. (16 in total) |
a_u | Parameter u between 0 and 1. |
a_v | Parameter v between 0 and 1. |
|
inline |
This function determines the derivative of a point along a Bezier curve at t [0:1].
a_controlPoints | Control points. (4 in total) |
a_t | Parameter t between 0 and 1. |
|
inline |
This function determines the derivative of a point on a Bezier patch along the u parametric direction.
a_controlPoints | Control points. (16 in total) |
a_u | Parameter u between 0 and 1. |
a_v | Parameter v between 0 and 1. |
|
inline |
This function determines the derivative of a point on a Bezier patch along the v parametric direction.
a_controlPoints | Control points. (16 in total) |
a_u | Parameter u between 0 and 1. |
a_v | Parameter v between 0 and 1. |
|
inline |
This function determines the surface normal at a point on a Bezier patch at u [0:1] and v [0:1].
a_controlPoints | Control points. (16 in total) |
a_u | Parameter u between 0 and 1. |
a_v | Parameter v between 0 and 1. |
|
inline |
This function computes the area of a triangle described by the position of its three vertices a_vertex0
, a_vertex1
, and a_vertex2
.
a_vertex0 | Vertex 0 of triangle. |
a_vertex1 | Vertex 1 of triangle. |
a_vertex2 | Vertex 2 of triangle. |
|
inline |
This function computes the projection of a point a_point
onto a plane. The plane is expressed by a point a_planePoint
and a surface normal a_planeNormal
.
a_point | Point to be projected on the plane. |
a_planePoint | Point on the plane. |
a_planeNormal | Surface normal of the plane. |
|
inline |
This function computes the projection of a point onto a plane. The plane is expressed by a set of three points passed by argument.
a_point | Point to be projected onto the plane. |
a_planePoint0 | Point 0 of plane. |
a_planePoint1 | Point 1 of plane. |
a_planePoint2 | Point 2 of plane. |
|
inline |
This function computes the projection of a point a_point
onto a plane described by three points a_planePoint0
, a_planePoint1
, and a_planePoint2
.
The function returns two parameters a_r01
and a_r01
which describe the position of the projected point onto the plane.
where:
a_point | Point to be projected onto plane. |
a_planePoint0 | Point 0 of plane. |
a_planePoint1 | Point 1 of plane. |
a_planePoint2 | Point 2 of plane. |
a_r01 | Returned relative position factor v01. |
a_r02 | Returned relative position factor v02. |
|
inline |
This function computes the projection of a point a_point
on a line. The line is expressed by a point a_pointOnLine
located on the line and a direction vector a_directionOfLine
.
a_point | Point to be projected onto the line. |
a_pointOnLine | Point located on the line. |
a_directionOfLine | Direction vector of the line. |
|
inline |
This function computes the projection of a point a_point
onto a segment. The segment is described by its two extremity points a_segmentPointA
and a_segmentPointB
.
a_point | Point to be projected. |
a_segmentPointA | Point A of segment. |
a_segmentPointB | Point B of segment. |
|
inline |
This function computes the projection of a point onto a disk lying in the XY plane.
The position of the disk along the z-axis is expressed by parameter a_height
.
The radius of the disk is expressed by parameter a_radius
.
a_point | Point to be projected. |
a_height | Position of the disk along the z-axis. |
a_radius | Radius of the disk. |
|
inline |
This function computes the projection of a point onto a triangle expressed by its three vertices.
a_point | Point to be projected. |
a_vertex0 | Triangle vertex 0. |
a_vertex1 | Triangle vertex 1. |
a_vertex2 | Triangle vertex 2. |
This function computes the projection of a vector V0 onto a vector V1, where V0 and V1 are passed by argument as a_vector0
and a_vector1
.
a_vector0 | Vector V0. |
a_vector1 | Vector V1. |
|
inline |
This function computes the distance between a point and a line. The line is described by two points a_linePoint1
and a_linePoint2
located along the line.
a_point | Point to be tested. |
a_linePoint1 | Point 1 on line. |
a_linePoint2 | Point 2 on line. |
|
inline |
This function computes the surface normal of a plane defined by three points passed by argument.
a_surfacePoint0 | Point 0 on surface. |
a_surfacePoint1 | Point 1 on surface. |
a_surfacePoint2 | Point 2 on surface. |
|
inline |
This function check if a point is contained in a box. The box is described by its minimum and maximum corners a_boxMin
and a_boxMax
.
If the point is located inside the box, then then function returns true, otherwise it returns false.
a_point | Test point. |
a_boxMin | Minimum coordinate of the box. |
a_boxMax | Maximum coordinate of the box. |
|
inline |
This function computes the intersection between a segment and a plane.
The segment is described by two points a_segmentPointA
and a_segmentPointB
.
The plane is described by a point a_planePos
and a surface normal a_planeNormal
.
The function returns the number of collision points that were detected (0 or 1).
If a collision occurs, the collision point and collision normal are returned by arguments a_collisionPoint
and a_collisionNormal
.
a_segmentPointA | First point of segment AB. |
a_segmentPointB | Second point of segment AB. |
a_planePos | Position of a point on the plane. |
a_planeNormal | Surface normal of the plane. |
a_collisionPoint | Returned intersection point (if detected). |
a_collisionNormal | Returned surface normal at intersection point (if detected). |
|
inline |
This function computes the intersection between a segment and a disk.
The segment is described by two points a_segmentPointA
and a_segmentPointB
.
The disk is described by a point a_diskPos
, a surface normal a_diskNormal
, and a radius a_diskRadius
.
The function returns the number of collision points that were detected (0 or 1).
If a collision occurs, the collision point and collision normal are returned by arguments a_collisionPoint
and a_collisionNormal
.
a_segmentPointA | First point of segment AB. |
a_segmentPointB | Second point of segment AB. |
a_diskPos | Position of the disk center. |
a_diskNormal | Surface normal of the disk. |
a_diskRadius | Radius of the disk. |
a_collisionPoint | Returned intersection point (if detected). |
a_collisionNormal | Returned surface normal at intersection point (if detected). |
|
inline |
This function computes the intersection between a segment and a sphere.
The segment is described by two points a_segmentPointA
and a_segmentPointB
.
The sphere is described by its position a_spherePos
and a radius a_sphereRadius
.
The function returns the number of collision points that were detected (0, 1, or 2).
If a collision occurs, the collision point(s) and collision normal(s) are returned by arguments a_collisionPoint0
, a_collisionNormal0
, a_collisionPoint1
, and a_collisionNormal1
.
If two intersection points are detected, collisionPoint0 is the nearest point to segmentPointA of segment AB.
If the segment begins inside the sphere, then all intersections are ignored.
a_segmentPointA | First point of segment AB. |
a_segmentPointB | Second point of segment AB. |
a_spherePos | Position of sphere center. |
a_sphereRadius | Radius of sphere. |
a_collisionPoint0 | Returned intersection point 0 (if detected). |
a_collisionNormal0 | Returned surface normal 0 at intersection point (if detected). |
a_collisionPoint1 | Returned intersection point 1 (if detected). |
a_collisionNormal1 | Returned surface normal 1 at intersection point (if detected). |
|
inline |
This function computes the intersection between a segment and a sphere.
The segment is described by two points a_segmentPointA
and a_segmentPointB
.
The sphere is described by its position a_spherePos
and a radius a_sphereRadius
.
The function returns the number of collision points that were detected (0, 1, or 2).
If a collision occurs, the collision point(s) and collision normal(s) are returned by arguments a_collisionPoint0
, a_collisionNormal0
, a_collisionPoint1
, and a_collisionNormal1
.
If two intersection points are detected, collisionPoint0 is the nearest point to segmentPointA of segment AB.
If the segment begins inside the sphere, then all intersections are ignored.
a_segmentPointA | First point of segment AB. |
a_segmentPointB | Second point of segment AB. |
a_pos | Position of ellipsoid center. |
a_radiusX | Ellipsoid radius along x axis. |
a_radiusY | Ellipsoid radius along y axis. |
a_radiusZ | Ellipsoid radius along z axis. |
a_collisionPoint0 | Returned intersection point 0 (if detected). |
a_collisionNormal0 | Returned surface normal 0 at intersection point (if detected). |
a_collisionPoint1 | Returned intersection point 1 (if detected). |
a_collisionNormal1 | Returned surface normal 1 at intersection point (if detected). |
|
inline |
This function computes the intersection between a segment and a topless cylinder.
The segment is described by two points a_segmentPointA
and a_segmentPointB
.
The cylinder is described by two extremity points a_cylinderPointA
and a_cylinderPointB
, and a radius a_cylinderRadius
.
The function returns the number of collision points that were detected (0, 1, or 2).
If a collision occurs, the collision point(s) and collision normal(s) are returned by arguments a_collisionPoint0
, a_collisionPoint1
,a_collisionNormal0
and a_collisionNormal1
.
If two intersection points occur, collisionPoint0 is the nearest point to segmentPointA of segment AB.
If the segment begins inside the cylinder, then all intersections are ignored.
a_segmentPointA | First point of segment AB. |
a_segmentPointB | Second point of segment AB. |
a_cylinderPointA | Extremity point A of cylinder. |
a_cylinderPointB | Extremity point B of cylinder. |
a_cylinderRadius | Radius of cylinder. |
a_collisionPoint0 | Returned intersection point 0 (if detected). |
a_collisionNormal0 | Returned surface normal 0 at intersection point (if detected). |
a_collisionPointRelPosAB0 | Returned relative position of collision point 0 projected on segment a_segmentPointA - a_segmentPointB |
a_collisionPoint1 | Returned intersection point 1 (if detected). |
a_collisionNormal1 | Returned surface normal 1 at intersection point (if detected). |
a_collisionPointRelPosAB1 | Returned relative position of collision point 1 projected on segment a_segmentPointA - a_segmentPointB |
|
inline |
This function computes the nearest intersection point between a segment and a cylinder.
The segment is described by two points a_segmentPointA
and a_segmentPointB
.
The cylinder is aligned along the z-axis and is described by its height a_height
, base radius a_baseRadius
, and a top radius a_topRadius
.
The function returns the number of collision points that were detected (0 or 1).
If a collision occurs, the collision point and collision normal are returned by arguments a_collisionPoint
and a_collisionNormal
.
If the segment begins inside the cylinder, then all intersections are ignored.
a_segmentPointA | First point of segment AB. |
a_segmentPointB | Second point of segment AB. |
a_baseRadius | Radius of cylinder a z = 0.0. |
a_topRadius | Radius of cylinder a z = a_height. |
a_height | Height of cylinder. |
a_collisionPoint | Returned intersection point (if detected). |
a_collisionNormal | Returned surface normal at intersection point (if detected). |
|
inline |
This function computes the nearest intersection point between a segment and a box.
The segment is described by two points a_segmentPointA
and a_segmentPointB
.
The box is aligned with all axes and is described by its minimum and maximum corners a_boxMin
and a_boxMax
.
The function returns the number of collision points that were detected (0 or 1).
If a collision occurs, the collision point and collision normal are returned by arguments a_collisionPoint
and a_collisionNormal
.
a_segmentPointA | First point of segment AB. |
a_segmentPointB | Second point of segment AB. |
a_boxMin | Minimum coordinate of box. |
a_boxMax | Maximum coordinate of box. |
a_collisionPoint | Returned intersection point (if detected). |
a_collisionNormal | Returned surface normal at intersection point (if detected). |
|
inline |
This function computes the nearest intersection point between a segment and a torus centered around the z-axis.
The segment is described by two points a_segmentPointA
and a_segmentPointB
.
The torus is described by its inner a_innerRadius
and outer radius a_outerRadius
.
The function returns the number of collision points that were detected (0 or 1).
If a collision occurs, the collision point and collision normal are returned by arguments a_collisionPoint
and a_collisionNormal
.
a_segmentPointA | First point of segment AB. |
a_segmentPointB | Second point of segment AB. |
a_innerRadius | Inner radius of torus. |
a_outerRadius | Outer radius of torus. |
a_collisionPoint | Returned intersection point (if detected). |
a_collisionNormal | Returned surface normal at intersection point (if detected). |
|
inline |
This function computes the intersection between a segment and a triangle defined by three vertices a_triangleVertex0
, a_triangleVertex1
, and a_triangleVertex2
.
The segment is described by two points a_segmentPointA
and a_segmentPointB
.
The function returns the number of collision points that were detected (0 or 1).
If a collision occurs, the collision point and collision normal are returned by arguments a_collisionPoint
and a_collisionNormal
.
a_segmentPointA | First point of segment AB. |
a_segmentPointB | Second point of segment AB. |
a_triangleVertex0 | Vertex 0 of triangle. |
a_triangleVertex1 | Vertex 1 of triangle. |
a_triangleVertex2 | Vertex 2 of triangle. |
a_reportFrontSideCollision | If true, then front side collisions are reported. |
a_reportBackSideCollision | If true, then back side collisions are reported. |
a_collisionPoint | Returned intersection point (if detected). |
a_collisionNormal | Returned surface normal at intersection point (if detected). |
a_collisionPosVertex01 | Returned relative position of collision point projected on segment a_triangleVertex0 -a_triangleVertex1 . |
a_collisionPosVertex02 | Returned relative position of collision point projected on segment a_triangleVertex0 -a_triangleVertex1 |
|
inline |
This function linearly interpolate the position where an isosurface cuts an edge between two vertices, each with their own scalar value.
a_isolevel | Iso value. |
a_p1 | Point 1. |
a_p2 | Point 2. |
a_valp1 | Value at point 1. |
a_valp2 | Value at point 2. |
|
inline |
Given a grid cell and an isolevel, this function calculates the triangular facets required to represent the isosurface through the cell. The function returns the number of triangular facets and at most 5 of them. 0 will be returned if the grid cell is either totally above of totally below the isolevel.
a_grid | Grid composed of 8 voxels |
a_isolevel | Isovalue. |
a_triangles | Returned triangles. |
|
inline |
This function checks if a given bit is enabled. The function takes by argument an unsigned integer a_value
and the position of the bit a_bitPosition
to be tested.
If the selected bit is enabled, the function returns true, otherwise false.
a_value | Unsigned int value. |
a_bitPosition | Bit position [0..31]. |
|
inline |
This function sets the value of a specified bit of an unsigned integer.
The function takes by argument an unsigned integer a_value
, the position of the bit to be tested a_bitPosition
, and its new value a_value
as a boolean.
The function returns the modified unsigned integer as a result.
a_data | Input unsigned integer data. |
a_bitPosition | Bit position [0..31] |
a_value | New state of bit (true = 1, false = 0). |
|
inline |
This function checks if a value passed by argument a_value is equal to or almost near zero.
a_value | Value to be checked. |
|
inline |
This function computes the absolute value of a value a_value
passed by argument.
a_value | Input value. |
|
inline |
This function computes the sign of a value passed by argument a_value
.
a_value | Value to be evaluated. |
|
inline |
This function returns the maximum value between two values a_value1
and a_value2
passed by argument.
a_value1 | First value. |
a_value2 | Second value. |
a_value1
and a_value2
.
|
inline |
This function returns the minimum value between two values a_value1
and a_value2
passed by argument.
a_value1 | First value. |
a_value2 | Second value. |
a_value1
and a_value2
.
|
inline |
This function returns the maximum value between three values a_value1
, a_value2
, and a_value3
passed by argument.
a_value1 | First value. |
a_value2 | Second value. |
a_value3 | Third value. |
a_value1
, a_value2
, and a_value3
.
|
inline |
This function returns the minimum value between three values a_value1
, a_value2
, and a_value3
passed by argument.
a_value1 | First value. |
a_value2 | Second value. |
a_value3 | Third value. |
a_value1
, a_value2
, and a_value3
.
|
inline |
This function swaps two elements a_value1
and a_value2
passed by argument.
a_value1 | First value. |
a_value2 | Second value. |
|
inline |
This function computes a linear interpolation between values a_value1
(when a_level
= 0.0) and a_value2
(when a_level
= 1.0).
a_level | Interpolation factor ranging from 0.0 to 1.0. |
a_value1 | First value. |
a_value2 | Second value. |
|
inline |
This function clamps an input value a_value
to a specified range.
The range is specified by a lower bound a_low
and upper bound a_high
.
a_value | Value to be clamped. |
a_low | Lower boundary value. |
a_high | Upper boundary value. |
|
inline |
This function clamps an input value a_value
to a value ranged between 0 and infinity.
a_value | Value to be clamped. |
|
inline |
This function clamps an input value a_value
to a value ranged between 0.0 and 1.0.
a_value | Value to be clamped. |
|
inline |
This function checks whether a value a_value
is within a range specified by arguments a_low
and a_high
.
a_value | Value to be tested. |
a_low | Lower boundary value. |
a_high | Upper boundary value. |
|
inline |
This function computes the square of a scalar a_value
passed by argument.
a_value | Input value. |
a_value
.
|
inline |
This function computes the square root of a scalar a_value
passed by argument.
a_value | Input value. |
a_value
.
|
inline |
This function computes the cubic root of a scalar a_value
passed by argument.
a_value | Input value. |
|
inline |
This function computes the cosine of an angle defined in degrees.
The angle a_angleDeg
is passed by argument.
a_angleDeg | Angle in degrees. |
a_angleDeg
.
|
inline |
This function computes the sine of an angle defined in degrees.
The angle a_angleDeg
is passed by argument.
a_angleDeg | Angle in degrees. |
a_angleDeg
.
|
inline |
This function computes the tangent of an angle defined in degrees.
The angle a_angleDeg
is passed by argument.
a_angleDeg | Angle in degrees. |
a_angleDeg
.
|
inline |
This function computes the cosine of an angle defined in radians.
The angle a_angleRad
is passed by argument.
a_angleRad | Angle in radians. |
a_angleRad
.
|
inline |
This function computes the sine of an angle defined in radians.
The angle a_angleRad
is passed by argument.
a_angleRad | Angle in radians. |
a_angleRad
.
|
inline |
This function computes the tangent of an angle defined in radians.
The angle a_angleRad
is passed by argument.
a_angleRad | Angle in radians. |
a_angleRad
.
|
inline |
This function converts an angle a_angleDeg
expressed in degrees to an angle expressed in radians.
a_angleDeg | Angle in degrees. |
|
inline |
This function converts an angle a_angleRad
expressed in radians to an angle expressed in degrees.
a_angleRad | Angle in radians. |
|
inline |
This function returns the number of digits that compose a given integer a_value
passed by argument.
a_value | Value to be evaluated. |
This function computes the addition of two vectors.
The vectors are passed by argument as a_vector1
and a_vector2
.
a_vector1 | First vector. |
a_vector2 | Second vector. |
|
inline |
This function computes the addition of three vectors.
The vectors are passed by argument as a_vector1
, a_vector2
, and a_vector3
.
a_vector1 | First vector. |
a_vector2 | Second vector. |
a_vector3 | Third vector. |
This function computes the subtraction of two vectors.
The vectors are passed by argument as a_vector1
and a_vector2
.
a_vector1 | First vector. |
a_vector2 | Second vector. |
|
inline |
This function computes the negated vector of a vector a_vector
passed by argument.
a_vector | Vector to be negated. |
|
inline |
This function computes the multiplication of a vector by a scalar.
The vector a_vector
and scalar a_scalar
are passed by argument.
a_value | Scalar. |
a_vector | Vector to be scaled. |
|
inline |
This function computes the division of a vector by a scalar.
The vector a_vector
and scalar a_scalar
are passed by argument.
a_value | Scalar. |
a_vector | Vector to be scaled. |
This function compute the cross product between two vectors.
Both vectors are passed by argument as a_vector1
and a_vector2
.
a_vector1 | Vector1. |
a_vector2 | Vector2. |
This function computes the dot product between two vectors.
Both vectors are passed by argument as a_vector1
and a_vector2
.
a_vector1 | Vector1. |
a_vector2 | Vector2. |
|
inline |
This function computes the normalized vector of a vector a_vector
passed by argument.
a_vector | Vector to be normalized. |
This function computes the distance between two points a_point1
and a_point2
passed by argument.
a_point1 | First point. |
a_point2 | Second point. |
This function computes the squared distance between two points a_point1
and a_point2
passed by argument.
a_point1 | First point. |
a_point2 | Second point. |
|
inline |
This function determine whether two vectors represent the same point.
Both points, a_point1
and a_point2
, are passed by argument.
A parameter a_epsilon
defines the distance tolerance between both points such that if the computed distance is smaller than a_epsilon
, then both points are considered to be equal.
The function returns true if both points are determined equal, or false otherwise.
a_point1 | First point. |
a_point2 | Second point. |
a_epsilon | Distance tolerance. Defaults value is set to C_SMALL. |
|
inline |
The function returns the identity matrix.
The function computes the addition between two matrices a_matrix1
and a_matrix2
that are passed by argument.
a_matrix1 | First matrix. |
a_matrix2 | Second matrix. |
This function computes the subtraction between two matrices a_matrix1
and a_matrix2
that are passed by argument.
a_matrix1 | First matrix. |
a_matrix2 | Second matrixs. |
|
inline |
This function creates a rotation matrix from a set of Euler angles defined in radians and co-moving axes of rotations.
The angles are defined in radians and passed by argument as a_angleRad1
, a_angleRad2
, and a_angleRad3
.
The order of the rotations are defined by argument a_eulerOrder
. See cEulerOrder for more information.
The argument a_useIntrinsicEulerModel
defines if the instrinsic (true) or extrinsic (false) model is used.
a_angleRad1 | Angle in radians of the first rotation in the sequence. |
a_angleRad2 | Angle in radians of the second rotation in the sequence. |
a_angleRad3 | Angle in radians of the third rotation in the sequence. |
a_eulerOrder | The order of the axes about which the rotations are to be applied |
a_useIntrinsicEulerModel | If true use intrinsic Euler model, if false use extrinsic Euler model. |
|
inline |
This function creates a rotation matrix from a set of Euler angles defined in degrees and co-moving axes of rotations.
The angles are defined in radian and passed by argument as a_angleDeg1
, a_angleDeg2
, and a_angleDeg3
.
The order of the rotations are defined by argument a_eulerOrder
. See cEulerOrder for more information.
The argument a_useIntrinsicEulerModel
defines if the instrinsic (true) or extrinsic (false) model is used.
a_angleDeg1 | Angle in degrees of the first rotation in the sequence. |
a_angleDeg2 | Angle in degrees of the second rotation in the sequence. |
a_angleDeg3 | Angle in degrees of the third rotation in the sequence. |
a_eulerOrder | The order of the axes about which the rotations are to be applied |
a_useIntrinsicEulerModel | If true use intrinsic Euler model, if false use extrinsic Euler model. |
|
inline |
This function creates a rotation matrix from an axis-angle representation.
The axis is defined by arguments a_axisX
, a_axisY
, and a_axisZ
. The rotation angle is defined in radians by argument a_angleRad
.
a_axisX | x component of axis. |
a_axisY | y component of axis. |
a_axisZ | z component of axis. |
a_angleRad | Angle of rotation in radians. |
|
inline |
This function creates a rotation matrix from an axis-angle representation.
The axis is defined by arguments a_axisX
, a_axisY
, and a_axisZ
. The rotation angle is defined in degrees by argument a_angleDeg
.
a_axisX | x component of axis. |
a_axisY | y component of axis. |
a_axisZ | z component of axis. |
a_angleDeg | Angle of roation in degrees. |
This function computes the multiplication of two matrices a_matrix1
and a_matrix2
passed by argument.
a_matrix1 | First matrix. |
a_matrix2 | Second matrix. |
This function computes the multiplication of a matrix a_matrix
and a vector a_vector
passed by argument.
|
inline |
This function computes the transpose of a matrix a_matrix
passed by argument.
a_matrix | Matrix to be transposed. |
a_matrix
.
|
inline |
This function computes the the inverse of a matrix a_matrix
passed by argument.
a_matrix | Matrix to be inversed. |
This function computes the angle in radians between two vectors a_vector1
and a_vector2
passed by argument.
a_vector1 | First vector. |
a_vector2 | Second vector. |
This function computes the cosine of the angle between two vectors a_vector1
and a_vector2
passed by argument.
a_vector1 | First vector. |
a_vector2 | Second vector. |
|
inline |
This function determines the solution of a linear equation.
It takes as parameters a pointer to the two coefficient of the linear equation (the c[1] is the coefficient of x and so on) and a pointer to the two element array in which the solution is to be placed. It outputs is a solution has been found.
a_coefficient | Input coefficient values. |
a_solution | Output roots found. |
|
inline |
This function determines the roots of a quadric equation
It takes as parameters a pointer to the three coefficient of the quadric equation (the c[2] is the coefficient of x2 and so on) and a pointer to the two element array in which the roots are to be placed. It outputs the number of roots found.
a_coefficient | Input coefficient values. |
a_solution | Output roots found. |
|
inline |
This function determines the roots of a cubic equation.
It takes as parameters a pointer to the four coefficient of the cubic equation (the c[3] is the coefficient of x3 and so on) and a pointer to the three element array in which the roots are to be placed. It outputs the number of roots found.
a_coefficient | Input coefficient values. |
a_solution | Output roots found. |
|
inline |
This function determines the roots of a quartic equation.
It takes as parameters a pointer to the five coefficient of the quartic equation (the c[4] is the coefficient of x^4 and so on) and a pointer to the four element array in which the roots are to be placed. It outputs the number of roots found.
a_coefficient | Input coefficient values. |
a_solution | Output roots found. |