1 #ifndef FLOAT_MATH_LIB_H 3 #define FLOAT_MATH_LIB_H 37 const float FM_PI = 3.1415926535897932384626433832795028841971693993751f;
52 void fm_decomposeTransform(
const float local_transform[16],
float trans[3],
float rot[4],
float scale[3]);
53 void fm_decomposeTransform(
const double local_transform[16],
double trans[3],
double rot[4],
double scale[3]);
64 void fm_inverseRT(
const float matrix[16],
const float pos[3],
float t[3]);
65 void fm_inverseRT(
const double matrix[16],
const double pos[3],
double t[3]);
67 void fm_transform(
const float matrix[16],
const float pos[3],
float t[3]);
68 void fm_transform(
const double matrix[16],
const double pos[3],
double t[3]);
73 void fm_getSubMatrix(int32_t ki,int32_t kj,
float pDst[16],
const float matrix[16]);
74 void fm_getSubMatrix(int32_t ki,int32_t kj,
double pDst[16],
const float matrix[16]);
76 void fm_rotate(
const float matrix[16],
const float pos[3],
float t[3]);
77 void fm_rotate(
const double matri[16],
const double pos[3],
double t[3]);
82 void fm_getAABB(uint32_t vcount,
const float *points,uint32_t pstride,
float bmin[3],
float bmax[3]);
83 void fm_getAABB(uint32_t vcount,
const double *points,uint32_t pstride,
double bmin[3],
double bmax[3]);
85 void fm_getAABBCenter(
const float bmin[3],
const float bmax[3],
float center[3]);
86 void fm_getAABBCenter(
const double bmin[3],
const double bmax[3],
double center[3]);
88 void fm_transformAABB(
const float bmin[3],
const float bmax[3],
const float matrix[16],
float tbmin[3],
float tbmax[3]);
89 void fm_transformAABB(
const double bmin[3],
const double bmax[3],
const double matrix[16],
double tbmin[3],
double tbmax[3]);
94 void fm_quatToEuler(
const float quat[4],
float &ax,
float &ay,
float &az);
95 void fm_quatToEuler(
const double quat[4],
double &ax,
double &ay,
double &az);
100 void fm_scale(
float x,
float y,
float z,
float matrix[16]);
101 void fm_scale(
double x,
double y,
double z,
double matrix[16]);
112 void fm_quatRotate(
const float quat[4],
const float v[3],
float r[3]);
113 void fm_quatRotate(
const double quat[4],
const double v[3],
double r[3]);
136 float fm_distance(
const float p1[3],
const float p2[3]);
137 double fm_distance(
const double p1[3],
const double p2[3]);
145 float fm_computePlane(
const float p1[3],
const float p2[3],
const float p3[3],
float *n);
146 double fm_computePlane(
const double p1[3],
const double p2[3],
const double p3[3],
double *n);
151 float fm_dot(
const float p1[3],
const float p2[3]);
152 double fm_dot(
const double p1[3],
const double p2[3]);
154 void fm_cross(
float cross[3],
const float a[3],
const float b[3]);
155 void fm_cross(
double cross[3],
const double a[3],
const double b[3]);
172 void fm_composeTransform(
const float position[3],
const float quat[4],
const float scale[3],
float matrix[16]);
173 void fm_composeTransform(
const double position[3],
const double quat[4],
const double scale[3],
double matrix[16]);
175 float fm_computeArea(
const float p1[3],
const float p2[3],
const float p3[3]);
176 double fm_computeArea(
const double p1[3],
const double p2[3],
const double p3[3]);
178 void fm_lerp(
const float p1[3],
const float p2[3],
float dest[3],
float lerpValue);
179 void fm_lerp(
const double p1[3],
const double p2[3],
double dest[3],
double lerpValue);
181 bool fm_insideTriangleXZ(
const float test[3],
const float p1[3],
const float p2[3],
const float p3[3]);
182 bool fm_insideTriangleXZ(
const double test[3],
const double p1[3],
const double p2[3],
const double p3[3]);
184 bool fm_insideAABB(
const float pos[3],
const float bmin[3],
const float bmax[3]);
185 bool fm_insideAABB(
const double pos[3],
const double bmin[3],
const double bmax[3]);
187 bool fm_insideAABB(
const float obmin[3],
const float obmax[3],
const float tbmin[3],
const float tbmax[3]);
188 bool fm_insideAABB(
const double obmin[3],
const double obmax[3],
const double tbmin[3],
const double tbmax[3]);
190 uint32_t
fm_clipTestPoint(
const float bmin[3],
const float bmax[3],
const float pos[3]);
191 uint32_t
fm_clipTestPoint(
const double bmin[3],
const double bmax[3],
const double pos[3]);
193 uint32_t
fm_clipTestPointXZ(
const float bmin[3],
const float bmax[3],
const float pos[3]);
194 uint32_t
fm_clipTestPointXZ(
const double bmin[3],
const double bmax[3],
const double pos[3]);
197 uint32_t
fm_clipTestAABB(
const float bmin[3],
const float bmax[3],
const float p1[3],
const float p2[3],
const float p3[3],uint32_t &andCode);
198 uint32_t
fm_clipTestAABB(
const double bmin[3],
const double bmax[3],
const double p1[3],
const double p2[3],
const double p3[3],uint32_t &andCode);
201 bool fm_lineTestAABBXZ(
const float p1[3],
const float p2[3],
const float bmin[3],
const float bmax[3],
float &time);
202 bool fm_lineTestAABBXZ(
const double p1[3],
const double p2[3],
const double bmin[3],
const double bmax[3],
double &time);
204 bool fm_lineTestAABB(
const float p1[3],
const float p2[3],
const float bmin[3],
const float bmax[3],
float &time);
205 bool fm_lineTestAABB(
const double p1[3],
const double p2[3],
const double bmin[3],
const double bmax[3],
double &time);
208 void fm_initMinMax(
const float p[3],
float bmin[3],
float bmax[3]);
209 void fm_initMinMax(
const double p[3],
double bmin[3],
double bmax[3]);
214 void fm_minmax(
const float p[3],
float bmin[3],
float bmax[3]);
215 void fm_minmax(
const double p[3],
double bmin[3],
double bmax[3]);
222 float fm_solveX(
const float plane[4],
float y,
float z);
223 double fm_solveX(
const double plane[4],
double y,
double z);
225 float fm_solveY(
const float plane[4],
float x,
float z);
226 double fm_solveY(
const double plane[4],
double x,
double z);
228 float fm_solveZ(
const float plane[4],
float x,
float y);
229 double fm_solveZ(
const double plane[4],
double x,
double y);
234 const float *weights,
239 const double *points,
241 const double *weights,
251 const double *points,
256 float fm_computeBestFitAABB(uint32_t vcount,
const float *points,uint32_t pstride,
float bmin[3],
float bmax[3]);
257 double fm_computeBestFitAABB(uint32_t vcount,
const double *points,uint32_t pstride,
double bmin[3],
double bmax[3]);
262 bool fm_lineSphereIntersect(
const float center[3],
float radius,
const float p1[3],
const float p2[3],
float intersect[3]);
263 bool fm_lineSphereIntersect(
const double center[3],
double radius,
const double p1[3],
const double p2[3],
double intersect[3]);
265 bool fm_intersectRayAABB(
const float bmin[3],
const float bmax[3],
const float pos[3],
const float dir[3],
float intersect[3]);
268 bool fm_lineIntersectsTriangle(
const float rayStart[3],
const float rayEnd[3],
const float p1[3],
const float p2[3],
const float p3[3],
float sect[3]);
269 bool fm_lineIntersectsTriangle(
const double rayStart[3],
const double rayEnd[3],
const double p1[3],
const double p2[3],
const double p3[3],
double sect[3]);
271 bool fm_rayIntersectsTriangle(
const float origin[3],
const float dir[3],
const float v0[3],
const float v1[3],
const float v2[3],
float &t);
272 bool fm_rayIntersectsTriangle(
const double origin[3],
const double dir[3],
const double v0[3],
const double v1[3],
const double v2[3],
double &t);
275 bool fm_raySphereIntersect(
const double center[3],
double radius,
const double pos[3],
const double dir[3],
double distance,
double intersect[3]);
277 void fm_catmullRom(
float out_vector[3],
const float p1[3],
const float p2[3],
const float p3[3],
const float *p4,
const float s);
278 void fm_catmullRom(
double out_vector[3],
const double p1[3],
const double p2[3],
const double p3[3],
const double *p4,
const double s);
280 bool fm_intersectAABB(
const float bmin1[3],
const float bmax1[3],
const float bmin2[3],
const float bmax2[3]);
281 bool fm_intersectAABB(
const double bmin1[3],
const double bmax1[3],
const double bmin2[3],
const double bmax2[3]);
285 void fm_rotationArc(
const float v0[3],
const float v1[3],
float quat[4]);
286 void fm_rotationArc(
const double v0[3],
const double v1[3],
double quat[4]);
292 bool fm_colinear(
const double p1[3],
const double p2[3],
const double p3[3],
double epsilon=0.999);
293 bool fm_colinear(
const float p1[3],
const float p2[3],
const float p3[3],
float epsilon=0.999f);
295 bool fm_colinear(
const float a1[3],
const float a2[3],
const float b1[3],
const float b2[3],
float epsilon=0.999f);
296 bool fm_colinear(
const double a1[3],
const double a2[3],
const double b1[3],
const double b2[3],
double epsilon=0.999);
323 const float *triangle,
333 const double *triangle,
349 void fm_computeBestFitOBB(uint32_t vcount,
const float *points,uint32_t pstride,
float *sides,
float matrix[16],
bool bruteForce=
true);
350 void fm_computeBestFitOBB(uint32_t vcount,
const double *points,uint32_t pstride,
double *sides,
double matrix[16],
bool bruteForce=
true);
352 void fm_computeBestFitOBB(uint32_t vcount,
const float *points,uint32_t pstride,
float *sides,
float pos[3],
float quat[4],
bool bruteForce=
true);
353 void fm_computeBestFitOBB(uint32_t vcount,
const double *points,uint32_t pstride,
double *sides,
double pos[3],
double quat[4],
bool bruteForce=
true);
355 void fm_computeBestFitABB(uint32_t vcount,
const float *points,uint32_t pstride,
float *sides,
float pos[3]);
356 void fm_computeBestFitABB(uint32_t vcount,
const double *points,uint32_t pstride,
double *sides,
double pos[3]);
360 void fm_computeBestFitCapsule(uint32_t vcount,
const float *points,uint32_t pstride,
float &radius,
float &height,
float matrix[16],
bool bruteForce=
true);
361 void fm_computeBestFitCapsule(uint32_t vcount,
const double *points,uint32_t pstride,
float &radius,
float &height,
double matrix[16],
bool bruteForce=
true);
365 void fm_planeToQuat(
const float plane[4],
float quat[4],
float pos[3]);
368 void fm_planeToQuat(
const double plane[4],
double quat[4],
double pos[3]);
370 inline void fm_doubleToFloat3(
const double p[3],
float t[3]) { t[0] = (float) p[0]; t[1] = (float)p[1]; t[2] = (float)p[2]; };
371 inline void fm_floatToDouble3(
const float p[3],
double t[3]) { t[0] = (double)p[0]; t[1] = (double)p[1]; t[2] = (double)p[2]; };
375 void fm_eulerMatrix(
double ax,
double ay,
double az,
double matrix[16]);
382 #define FM_DEFAULT_GRANULARITY 0.001f // 1 millimeter is the default granularity 387 virtual uint32_t
getIndex(
const float pos[3],
bool &newPos) = 0;
388 virtual uint32_t
getIndex(
const double pos[3],
bool &newPos) = 0;
393 virtual uint32_t
getVcount(
void)
const = 0;
394 virtual bool isDouble(
void)
const = 0;
395 virtual bool saveAsObj(
const char *fname,uint32_t tcount,uint32_t *indices) = 0;
406 virtual const double * triangulate3d(uint32_t pcount,
407 const double *points,
413 virtual const float * triangulate3d(uint32_t pcount,
425 const float *
fm_getPoint(
const float *points,uint32_t pstride,uint32_t index);
426 const double *
fm_getPoint(
const double *points,uint32_t pstride,uint32_t index);
428 bool fm_insideTriangle(
float Ax,
float Ay,
float Bx,
float By,
float Cx,
float Cy,
float Px,
float Py);
429 bool fm_insideTriangle(
double Ax,
double Ay,
double Bx,
double By,
double Cx,
double Cy,
double Px,
double Py);
430 float fm_areaPolygon2d(uint32_t pcount,
const float *points,uint32_t pstride);
431 double fm_areaPolygon2d(uint32_t pcount,
const double *points,uint32_t pstride);
433 bool fm_pointInsidePolygon2d(uint32_t pcount,
const float *points,uint32_t pstride,
const float *point,uint32_t xindex=0,uint32_t yindex=1);
434 bool fm_pointInsidePolygon2d(uint32_t pcount,
const double *points,uint32_t pstride,
const double *point,uint32_t xindex=0,uint32_t yindex=1);
436 uint32_t
fm_consolidatePolygon(uint32_t pcount,
const float *points,uint32_t pstride,
float *dest,
float epsilon=0.999999f);
437 uint32_t
fm_consolidatePolygon(uint32_t pcount,
const double *points,uint32_t pstride,
double *dest,
double epsilon=0.999999);
440 bool fm_computeSplitPlane(uint32_t vcount,
const double *vertices,uint32_t tcount,
const uint32_t *indices,
double *plane);
441 bool fm_computeSplitPlane(uint32_t vcount,
const float *vertices,uint32_t tcount,
const uint32_t *indices,
float *plane);
446 float fm_areaTriangle(
const float *p1,
const float *p2,
const float *p3);
447 double fm_areaTriangle(
const double *p1,
const double *p2,
const double *p3);
449 void fm_subtract(
const float *A,
const float *B,
float *diff);
450 void fm_subtract(
const double *A,
const double *B,
double *diff);
455 void fm_add(
const float *A,
const float *B,
float *sum);
456 void fm_add(
const double *A,
const double *B,
double *sum);
458 void fm_copy3(
const float *source,
float *dest);
459 void fm_copy3(
const double *source,
double *dest);
464 uint32_t
fm_copyUniqueVertices(uint32_t vcount,
const float *input_vertices,
float *output_vertices,uint32_t tcount,
const uint32_t *input_indices,uint32_t *output_indices);
465 uint32_t
fm_copyUniqueVertices(uint32_t vcount,
const double *input_vertices,
double *output_vertices,uint32_t tcount,
const uint32_t *input_indices,uint32_t *output_indices);
467 bool fm_isMeshCoplanar(uint32_t tcount,
const uint32_t *indices,
const float *vertices,
bool doubleSided);
468 bool fm_isMeshCoplanar(uint32_t tcount,
const uint32_t *indices,
const double *vertices,
bool doubleSided);
470 bool fm_samePlane(
const float p1[4],
const float p2[4],
float normalEpsilon=0.01f,
float dEpsilon=0.001f,
bool doubleSided=
false);
471 bool fm_samePlane(
const double p1[4],
const double p2[4],
double normalEpsilon=0.01,
double dEpsilon=0.001,
bool doubleSided=
false);
473 void fm_OBBtoAABB(
const float obmin[3],
const float obmax[3],
const float matrix[16],
float abmin[3],
float abmax[3]);
479 virtual const uint32_t * tesselate(
fm_VertexIndex *vindex,uint32_t tcount,
const uint32_t *indices,
float longEdge,uint32_t maxDepth,uint32_t &outcount) = 0;
486 const float *vertices,
491 const uint32_t *indices);
494 const double *vertices,
499 const uint32_t *indices);
502 bool fm_isValidTriangle(
const float *p1,
const float *p2,
const float *p3,
float epsilon=0.00001f);
503 bool fm_isValidTriangle(
const double *p1,
const double *p2,
const double *p3,
double epsilon=0.00001f);
float fm_computeArea(const float p1[3], const float p2[3], const float p3[3])
float fm_getDeterminant(const float matrix[16])
Definition: FloatMath.h:476
IntersectResult
Definition: FloatMath.h:298
Definition: FloatMath.h:302
void fm_cross(float cross[3], const float a[3], const float b[3])
float fm_computeBestFitAABB(uint32_t vcount, const float *points, uint32_t pstride, float bmin[3], float bmax[3])
float fm_solveZ(const float plane[4], float x, float y)
float fm_computePlane(const float p1[3], const float p2[3], const float p3[3], float *n)
void fm_computeBestFitCapsule(uint32_t vcount, const float *points, uint32_t pstride, float &radius, float &height, float matrix[16], bool bruteForce=true)
virtual const double * getVertexDouble(uint32_t index) const =0
void fm_quatToMatrix(const float quat[4], float matrix[16])
void fm_minmax(const float p[3], float bmin[3], float bmax[3])
void fm_initMinMax(const float p[3], float bmin[3], float bmax[3])
Definition: FloatMath.h:403
NV_INLINE float normal(const float a[3], float r[3])
Definition: NvBlastMath.h:93
float fm_distance(const float p1[3], const float p2[3])
bool fm_intersectAABB(const float bmin1[3], const float bmax1[3], const float bmin2[3], const float bmax2[3])
SIMD_FORCE_INLINE const btScalar & x() const
Return the x value.
Definition: btVector3.h:275
float fm_areaTriangle(const float *p1, const float *p2, const float *p3)
uint32_t fm_copyUniqueVertices(uint32_t vcount, const float *input_vertices, float *output_vertices, uint32_t tcount, const uint32_t *input_indices, uint32_t *output_indices)
PlaneTriResult fm_planeTriIntersection(const float plane[4], const float *triangle, uint32_t tstride, float epsilon, float *front, uint32_t &fcount, float *back, uint32_t &bcount)
Definition: FloatMath.h:16
PlaneTriResult
Definition: FloatMath.h:314
Definition: FloatMath.h:25
void fm_eulerToMatrixDX(float x, float y, float z, float matrix[16])
uint32_t fm_clipTestPoint(const float bmin[3], const float bmax[3], const float pos[3])
void fm_scale(float x, float y, float z, float matrix[16])
IntersectResult fm_intersectLineSegments2d(const float a1[3], const float a2[3], const float b1[3], const float b2[3], float intersectionPoint[3])
Definition: FloatMath.h:316
bool fm_intersectLineSegmentAABB(const float bmin[3], const float bmax[3], const float p1[3], const float p2[3], float intersect[3])
void fm_lerp(const float p1[3], const float p2[3], float dest[3], float lerpValue)
LineSegmentType
Definition: FloatMath.h:29
void fm_computeBestFitOBB(uint32_t vcount, const float *points, uint32_t pstride, float *sides, float matrix[16], bool bruteForce=true)
bool fm_lineIntersectsTriangle(const float rayStart[3], const float rayEnd[3], const float p1[3], const float p2[3], const float p3[3], float sect[3])
void fm_eulerMatrix(float ax, float ay, float az, float matrix[16])
void fm_multiply(float *A, float scaler)
void fm_setTranslation(const float *translation, float matrix[16])
bool fm_computeWindingOrder(const float p1[3], const float p2[3], const float p3[3])
void fm_inverseRT(const float matrix[16], const float pos[3], float t[3])
bool fm_computeBestFitPlane(uint32_t vcount, const float *points, uint32_t vstride, const float *weights, uint32_t wstride, float plane[4])
Definition: FloatMath.h:32
float fm_sphereVolume(float radius)
void fm_OBBtoAABB(const float obmin[3], const float obmax[3], const float matrix[16], float abmin[3], float abmax[3])
float fm_distToPlane(const float plane[4], const float pos[3])
void fm_quatToEuler(const float quat[4], float &ax, float &ay, float &az)
void fm_transform(const float matrix[16], const float pos[3], float t[3])
Definition: FloatMath.h:19
void fm_intersectPointPlane(const float p1[3], const float p2[3], float *split, const float plane[4])
Definition: FloatMath.h:318
float fm_dot(const float p1[3], const float p2[3])
virtual bool isDouble(void) const =0
Definition: FloatMath.h:15
uint32_t fm_clipTestAABB(const float bmin[3], const float bmax[3], const float p1[3], const float p2[3], const float p3[3], uint32_t &andCode)
bool fm_pointInsidePolygon2d(uint32_t pcount, const float *points, uint32_t pstride, const float *point, uint32_t xindex=0, uint32_t yindex=1)
bool fm_rayIntersectsTriangle(const float origin[3], const float dir[3], const float v0[3], const float v1[3], const float v2[3], float &t)
void fm_catmullRom(float out_vector[3], const float p1[3], const float p2[3], const float p3[3], const float *p4, const float s)
bool fm_computeCentroid(uint32_t vcount, const float *points, uint32_t vstride, float *center)
Definition: FloatMath.h:9
IntersectResult fm_intersectLineSegments2dTime(const float a1[3], const float a2[3], const float b1[3], const float b2[3], float &t1, float &t2)
void fm_getTranslation(const float matrix[16], float t[3])
void fm_composeTransform(const float position[3], const float quat[4], const float scale[3], float matrix[16])
void fm_transformAABB(const float bmin[3], const float bmax[3], const float matrix[16], float tbmin[3], float tbmax[3])
virtual const float * getVertexFloat(uint32_t index) const =0
virtual uint32_t getIndex(const float pos[3], bool &newPos)=0
bool fm_insideAABB(const float pos[3], const float bmin[3], const float bmax[3])
uint32_t fm_consolidatePolygon(uint32_t pcount, const float *points, uint32_t pstride, float *dest, float epsilon=0.999999f)
bool fm_computeSplitPlane(uint32_t vcount, const double *vertices, uint32_t tcount, const uint32_t *indices, double *plane)
void fm_planeToMatrix(const float plane[4], float matrix[16])
float fm_cylinderVolume(float radius, float h)
void fm_planeToQuat(const float plane[4], float quat[4], float pos[3])
Definition: FloatMath.h:303
const float * fm_getPoint(const float *points, uint32_t pstride, uint32_t index)
SIMD_FORCE_INLINE const btScalar & y() const
Return the y value.
Definition: btVector3.h:277
float fm_solveX(const float plane[4], float y, float z)
Definition: FloatMath.h:317
void fm_releaseTriangulate(fm_Triangulate *t)
uint32_t fm_clipTestPointXZ(const float bmin[3], const float bmax[3], const float pos[3])
void fm_add(const float *A, const float *B, float *sum)
fm_VertexIndex * fm_createVertexIndex(double granularity, bool snapToGrid)
void fm_releaseVertexIndex(fm_VertexIndex *vindex)
bool fm_insideTriangle(float Ax, float Ay, float Bx, float By, float Cx, float Cy, float Px, float Py)
bool fm_colinear(const double p1[3], const double p2[3], const double p3[3], double epsilon=0.999)
fm_Triangulate * fm_createTriangulate(void)
void fm_rotationArc(const float v0[3], const float v1[3], float quat[4])
void fm_multiplyQuat(const float *qa, const float *qb, float *quat)
void fm_getAABBCenter(const float bmin[3], const float bmax[3], float center[3])
FM_Axis
Definition: FloatMath.h:22
void fm_eulerToQuatDX(float x, float y, float z, float quat[4])
void fm_computeNormalVector(float n[3], const float p1[3], const float p2[3])
fm_Tesselate * fm_createTesselate(void)
float fm_computeMeshVolume(const float *vertices, uint32_t tcount, const uint32_t *indices)
bool fm_insideTriangleXZ(const float test[3], const float p1[3], const float p2[3], const float p3[3])
bool fm_lineTestAABB(const float p1[3], const float p2[3], const float bmin[3], const float bmax[3], float &time)
virtual const float * getVerticesFloat(void) const =0
Definition: FloatMath.h:14
virtual uint32_t getVcount(void) const =0
void fm_copy3(const float *source, float *dest)
void fm_computeBestFitABB(uint32_t vcount, const float *points, uint32_t pstride, float *sides, float pos[3])
Definition: FloatMath.h:384
float fm_normalizeQuat(float n[4])
Definition: FloatMath.h:301
float fm_distanceSquaredXZ(const float p1[3], const float p2[3])
bool fm_raySphereIntersect(const float center[3], float radius, const float pos[3], const float dir[3], float distance, float intersect[3])
bool fm_samePlane(const float p1[4], const float p2[4], float normalEpsilon=0.01f, float dEpsilon=0.001f, bool doubleSided=false)
void fm_matrixToQuat(const float matrix[16], float quat[4])
Definition: FloatMath.h:26
PlaneTriResult fm_getSidePlane(const float p[3], const float plane[4], float epsilon)
SIMD_FORCE_INLINE btScalar distance(const btVector3 &v) const
Return the distance between the ends of this and another vector This is symantically treating the vec...
Definition: btVector3.h:475
float fm_solveY(const float plane[4], float x, float z)
float fm_areaPolygon2d(uint32_t pcount, const float *points, uint32_t pstride)
bool fm_intersectRayAABB(const float bmin[3], const float bmax[3], const float pos[3], const float dir[3], float intersect[3])
Definition: FloatMath.h:300
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition: btVector3.h:279
void fm_nearestPointInTriangle(const float *pos, const float *p1, const float *p2, const float *p3, float *nearest)
float fm_distanceSquared(const float p1[3], const float p2[3])
void fm_getSubMatrix(int32_t ki, int32_t kj, float pDst[16], const float matrix[16])
void fm_computeMeanNormals(uint32_t vcount, const float *vertices, uint32_t vstride, float *normals, uint32_t nstride, uint32_t tcount, const uint32_t *indices)
void fm_quatRotate(const float quat[4], const float v[3], float r[3])
FM_ClipState
Definition: FloatMath.h:12
float fm_normalize(float n[3])
void fm_doubleToFloat3(const double p[3], float t[3])
Definition: FloatMath.h:370
Definition: FloatMath.h:33
void fm_floatToDouble3(const float p[3], double t[3])
Definition: FloatMath.h:371
float fm_capsuleVolume(float radius, float h)
void fm_matrixMultiply(const float A[16], const float B[16], float dest[16])
virtual bool saveAsObj(const char *fname, uint32_t tcount, uint32_t *indices)=0
void fm_eulerToQuat(float x, float y, float z, float quat[4])
bool fm_isMeshCoplanar(uint32_t tcount, const uint32_t *indices, const float *vertices, bool doubleSided)
Definition: FloatMath.h:24
void fm_getAABB(uint32_t vcount, const float *points, uint32_t pstride, float bmin[3], float bmax[3])
void fm_inverseTransform(const float matrix[16], float inverse_matrix[16])
virtual const double * getVerticesDouble(void) const =0
const float FM_PI
Definition: FloatMath.h:37
bool fm_lineTestAABBXZ(const float p1[3], const float p2[3], const float bmin[3], const float bmax[3], float &time)
Definition: FloatMath.h:18
void fm_inflateMinMax(float bmin[3], float bmax[3], float ratio)
void fm_releaseTesselate(fm_Tesselate *t)
Definition: FloatMath.h:17
void fm_multiplyTransform(const float *pA, const float *pB, float *pM)
void fm_subtract(const float *A, const float *B, float *diff)
const float FM_DEG_TO_RAD
Definition: FloatMath.h:38
const float FM_RAD_TO_DEG
Definition: FloatMath.h:39
void fm_decomposeTransform(const float local_transform[16], float trans[3], float rot[4], float scale[3])
Definition: FloatMath.h:31
Definition: FloatMath.h:319
bool fm_isValidTriangle(const float *p1, const float *p2, const float *p3, float epsilon=0.00001f)
void fm_eulerToMatrix(float ax, float ay, float az, float matrix[16])
float fm_computeBestFitSphere(uint32_t vcount, const float *points, uint32_t pstride, float center[3])
FM_Axis fm_getDominantAxis(const float normal[3])
SIMD_FORCE_INLINE btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
Definition: btVector3.h:193
void fm_rotate(const float matrix[16], const float pos[3], float t[3])
void fm_identity(float matrix[16])
bool fm_lineSphereIntersect(const float center[3], float radius, const float p1[3], const float p2[3], float intersect[3])
float fm_distancePointLineSegment(const float Point[3], const float LineStart[3], const float LineEnd[3], float intersection[3], LineSegmentType &type, float epsilon)