Main Page Class List Class Members

FloatMath.h
Go to the documentation of this file.
1 #ifndef FLOAT_MATH_LIB_H
2
3 #define FLOAT_MATH_LIB_H
4
5
6 #include <float.h>
7 #include <stdint.h>
8
9 namespace FLOAT_MATH
10 {
11
12 enum FM_ClipState
13 {
14 FMCS_XMIN = (1<<0),
15 FMCS_XMAX = (1<<1),
16 FMCS_YMIN = (1<<2),
17 FMCS_YMAX = (1<<3),
18 FMCS_ZMIN = (1<<4),
19 FMCS_ZMAX = (1<<5),
20 };
21
22 enum FM_Axis
23 {
24 FM_XAXIS = (1<<0),
25 FM_YAXIS = (1<<1),
26 FM_ZAXIS = (1<<2)
27 };
28
29 enum LineSegmentType
30 {
31 LS_START,
32 LS_MIDDLE,
33 LS_END
34 };
35
36
37 const float FM_PI = 3.1415926535897932384626433832795028841971693993751f;
38 const float FM_DEG_TO_RAD = ((2.0f * FM_PI) / 360.0f);
39 const float FM_RAD_TO_DEG = (360.0f / (2.0f * FM_PI));
40
41 //***************** Float versions
42 //***
43 //*** vectors are assumed to be 3 floats or 3 doubles representing X, Y, Z
44 //*** quaternions are assumed to be 4 floats or 4 doubles representing X,Y,Z,W
45 //*** matrices are assumed to be 16 floats or 16 doubles representing a standard D3D or OpenGL style 4x4 matrix
46 //*** bounding volumes are expressed as two sets of 3 floats/double representing bmin(x,y,z) and bmax(x,y,z)
47 //*** Plane equations are assumed to be 4 floats or 4 doubles representing Ax,By,Cz,D
48
49 FM_Axis fm_getDominantAxis(const float normal[3]);
50 FM_Axis fm_getDominantAxis(const double normal[3]);
51
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]);
54
55 void fm_multiplyTransform(const float *pA,const float *pB,float *pM);
56 void fm_multiplyTransform(const double *pA,const double *pB,double *pM);
57
58 void fm_inverseTransform(const float matrix[16],float inverse_matrix[16]);
59 void fm_inverseTransform(const double matrix[16],double inverse_matrix[16]);
60
61 void fm_identity(float matrix[16]); // set 4x4 matrix to identity.
62 void fm_identity(double matrix[16]); // set 4x4 matrix to identity.
63
64 void fm_inverseRT(const float matrix[16], const float pos[3], float t[3]); // inverse rotate translate the point.
65 void fm_inverseRT(const double matrix[16],const double pos[3],double t[3]); // inverse rotate translate the point.
66
67 void fm_transform(const float matrix[16], const float pos[3], float t[3]); // rotate and translate this point.
68 void fm_transform(const double matrix[16],const double pos[3],double t[3]); // rotate and translate this point.
69
70 float fm_getDeterminant(const float matrix[16]);
71 double fm_getDeterminant(const double matrix[16]);
72
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]);
75
76 void fm_rotate(const float matrix[16],const float pos[3],float t[3]); // only rotate the point by a 4x4 matrix, don't translate.
77 void fm_rotate(const double matri[16],const double pos[3],double t[3]); // only rotate the point by a 4x4 matrix, don't translate.
78
79 void fm_eulerToMatrix(float ax,float ay,float az,float matrix[16]); // convert euler (in radians) to a dest 4x4 matrix (translation set to zero)
80 void fm_eulerToMatrix(double ax,double ay,double az,double matrix[16]); // convert euler (in radians) to a dest 4x4 matrix (translation set to zero)
81
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]);
84
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]);
87
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]);
90
91 void fm_eulerToQuat(float x,float y,float z,float quat[4]); // convert euler angles to quaternion.
92 void fm_eulerToQuat(double x,double y,double z,double quat[4]); // convert euler angles to quaternion.
93
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);
96
97 void fm_eulerToQuat(const float euler[3],float quat[4]); // convert euler angles to quaternion. Angles must be radians not degrees!
98 void fm_eulerToQuat(const double euler[3],double quat[4]); // convert euler angles to quaternion.
99
100 void fm_scale(float x,float y,float z,float matrix[16]); // apply scale to the matrix.
101 void fm_scale(double x,double y,double z,double matrix[16]); // apply scale to the matrix.
102
103 void fm_eulerToQuatDX(float x,float y,float z,float quat[4]); // convert euler angles to quaternion using the fucked up DirectX method
104 void fm_eulerToQuatDX(double x,double y,double z,double quat[4]); // convert euler angles to quaternion using the fucked up DirectX method
105
106 void fm_eulerToMatrixDX(float x,float y,float z,float matrix[16]); // convert euler angles to quaternion using the fucked up DirectX method.
107 void fm_eulerToMatrixDX(double x,double y,double z,double matrix[16]); // convert euler angles to quaternion using the fucked up DirectX method.
108
109 void fm_quatToMatrix(const float quat[4],float matrix[16]); // convert quaterinion rotation to matrix, translation set to zero.
110 void fm_quatToMatrix(const double quat[4],double matrix[16]); // convert quaterinion rotation to matrix, translation set to zero.
111
112 void fm_quatRotate(const float quat[4],const float v[3],float r[3]); // rotate a vector directly by a quaternion.
113 void fm_quatRotate(const double quat[4],const double v[3],double r[3]); // rotate a vector directly by a quaternion.
114
115 void fm_getTranslation(const float matrix[16],float t[3]);
116 void fm_getTranslation(const double matrix[16],double t[3]);
117
118 void fm_setTranslation(const float *translation,float matrix[16]);
119 void fm_setTranslation(const double *translation,double matrix[16]);
120
121 void fm_multiplyQuat(const float *qa,const float *qb,float *quat);
122 void fm_multiplyQuat(const double *qa,const double *qb,double *quat);
123
124 void fm_matrixToQuat(const float matrix[16],float quat[4]); // convert the 3x3 portion of a 4x4 matrix into a quaterion as x,y,z,w
125 void fm_matrixToQuat(const double matrix[16],double quat[4]); // convert the 3x3 portion of a 4x4 matrix into a quaterion as x,y,z,w
126
127 float fm_sphereVolume(float radius); // return's the volume of a sphere of this radius (4/3 PI * R cubed )
128 double fm_sphereVolume(double radius); // return's the volume of a sphere of this radius (4/3 PI * R cubed )
129
130 float fm_cylinderVolume(float radius,float h);
131 double fm_cylinderVolume(double radius,double h);
132
133 float fm_capsuleVolume(float radius,float h);
134 double fm_capsuleVolume(double radius,double h);
135
136 float fm_distance(const float p1[3],const float p2[3]);
137 double fm_distance(const double p1[3],const double p2[3]);
138
139 float fm_distanceSquared(const float p1[3],const float p2[3]);
140 double fm_distanceSquared(const double p1[3],const double p2[3]);
141
142 float fm_distanceSquaredXZ(const float p1[3],const float p2[3]);
143 double fm_distanceSquaredXZ(const double p1[3],const double p2[3]);
144
145 float fm_computePlane(const float p1[3],const float p2[3],const float p3[3],float *n); // return D
146 double fm_computePlane(const double p1[3],const double p2[3],const double p3[3],double *n); // return D
147
148 float fm_distToPlane(const float plane[4],const float pos[3]); // computes the distance of this point from the plane.
149 double fm_distToPlane(const double plane[4],const double pos[3]); // computes the distance of this point from the plane.
150
151 float fm_dot(const float p1[3],const float p2[3]);
152 double fm_dot(const double p1[3],const double p2[3]);
153
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]);
156
157 void fm_computeNormalVector(float n[3],const float p1[3],const float p2[3]); // as P2-P1 normalized.
158 void fm_computeNormalVector(double n[3],const double p1[3],const double p2[3]); // as P2-P1 normalized.
159
160 bool fm_computeWindingOrder(const float p1[3],const float p2[3],const float p3[3]); // returns true if the triangle is clockwise.
161 bool fm_computeWindingOrder(const double p1[3],const double p2[3],const double p3[3]); // returns true if the triangle is clockwise.
162
163 float fm_normalize(float n[3]); // normalize this vector and return the distance
164 double fm_normalize(double n[3]); // normalize this vector and return the distance
165
166 float fm_normalizeQuat(float n[4]); // normalize this quat
167 double fm_normalizeQuat(double n[4]); // normalize this quat
168
169 void fm_matrixMultiply(const float A[16],const float B[16],float dest[16]);
170 void fm_matrixMultiply(const double A[16],const double B[16],double dest[16]);
171
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]);
174
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]);
177
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);
180
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]);
183
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]);
186
187 bool fm_insideAABB(const float obmin[3],const float obmax[3],const float tbmin[3],const float tbmax[3]); // test if bounding box tbmin/tmbax is fully inside obmin/obmax
188 bool fm_insideAABB(const double obmin[3],const double obmax[3],const double tbmin[3],const double tbmax[3]); // test if bounding box tbmin/tmbax is fully inside obmin/obmax
189
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]);
192
193 uint32_t fm_clipTestPointXZ(const float bmin[3],const float bmax[3],const float pos[3]); // only tests X and Z, not Y
194 uint32_t fm_clipTestPointXZ(const double bmin[3],const double bmax[3],const double pos[3]); // only tests X and Z, not Y
195
196
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);
199
200
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);
203
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);
206
207
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]);
210
211 void fm_initMinMax(float bmin[3],float bmax[3]);
212 void fm_initMinMax(double bmin[3],double bmax[3]);
213
214 void fm_minmax(const float p[3],float bmin[3],float bmax[3]); // accumulate to a min-max value
215 void fm_minmax(const double p[3],double bmin[3],double bmax[3]); // accumulate to a min-max value
216
217 // Computes the diagonal length of the bounding box and then inflates the bounding box on all sides
218 // by the ratio provided.
219 void fm_inflateMinMax(float bmin[3], float bmax[3], float ratio);
220 void fm_inflateMinMax(double bmin[3], double bmax[3], double ratio);
221
222 float fm_solveX(const float plane[4],float y,float z); // solve for X given this plane equation and the other two components.
223 double fm_solveX(const double plane[4],double y,double z); // solve for X given this plane equation and the other two components.
224
225 float fm_solveY(const float plane[4],float x,float z); // solve for Y given this plane equation and the other two components.
226 double fm_solveY(const double plane[4],double x,double z); // solve for Y given this plane equation and the other two components.
227
228 float fm_solveZ(const float plane[4],float x,float y); // solve for Z given this plane equation and the other two components.
229 double fm_solveZ(const double plane[4],double x,double y); // solve for Z given this plane equation and the other two components.
230
231 bool fm_computeBestFitPlane(uint32_t vcount, // number of input data points
232 const float *points, // starting address of points array.
233 uint32_t vstride, // stride between input points.
234 const float *weights, // *optional point weighting values.
235 uint32_t wstride, // weight stride for each vertex.
236 float plane[4]);
237
238 bool fm_computeBestFitPlane(uint32_t vcount, // number of input data points
239 const double *points, // starting address of points array.
240 uint32_t vstride, // stride between input points.
241 const double *weights, // *optional point weighting values.
242 uint32_t wstride, // weight stride for each vertex.
243 double plane[4]);
244
245 bool fm_computeCentroid(uint32_t vcount, // number of input data points
246 const float *points, // starting address of points array.
247 uint32_t vstride, // stride between input points.
248 float *center);
249
250 bool fm_computeCentroid(uint32_t vcount, // number of input data points
251 const double *points, // starting address of points array.
252 uint32_t vstride, // stride between input points.
253 double *center);
254
255
256 float fm_computeBestFitAABB(uint32_t vcount,const float *points,uint32_t pstride,float bmin[3],float bmax[3]); // returns the diagonal distance
257 double fm_computeBestFitAABB(uint32_t vcount,const double *points,uint32_t pstride,double bmin[3],double bmax[3]); // returns the diagonal distance
258
259 float fm_computeBestFitSphere(uint32_t vcount,const float *points,uint32_t pstride,float center[3]);
260 double fm_computeBestFitSphere(uint32_t vcount,const double *points,uint32_t pstride,double center[3]);
261
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]);
264
265 bool fm_intersectRayAABB(const float bmin[3],const float bmax[3],const float pos[3],const float dir[3],float intersect[3]);
266 bool fm_intersectLineSegmentAABB(const float bmin[3],const float bmax[3],const float p1[3],const float p2[3],float intersect[3]);
267
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]);
270
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);
273
274 bool fm_raySphereIntersect(const float center[3],float radius,const float pos[3],const float dir[3],float distance,float intersect[3]);
275 bool fm_raySphereIntersect(const double center[3],double radius,const double pos[3],const double dir[3],double distance,double intersect[3]);
276
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);
279
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]);
282
283
284 // computes the rotation quaternion to go from unit-vector v0 to unit-vector v1
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]);
287
288 float fm_distancePointLineSegment(const float Point[3],const float LineStart[3],const float LineEnd[3],float intersection[3],LineSegmentType &type,float epsilon);
289 double fm_distancePointLineSegment(const double Point[3],const double LineStart[3],const double LineEnd[3],double intersection[3],LineSegmentType &type,double epsilon);
290
291
292 bool fm_colinear(const double p1[3],const double p2[3],const double p3[3],double epsilon=0.999); // true if these three points in a row are co-linear
293 bool fm_colinear(const float p1[3],const float p2[3],const float p3[3],float epsilon=0.999f);
294
295 bool fm_colinear(const float a1[3],const float a2[3],const float b1[3],const float b2[3],float epsilon=0.999f); // true if these two line segments are co-linear.
296 bool fm_colinear(const double a1[3],const double a2[3],const double b1[3],const double b2[3],double epsilon=0.999); // true if these two line segments are co-linear.
297
298 enum IntersectResult
299 {
300 IR_DONT_INTERSECT,
301 IR_DO_INTERSECT,
302 IR_COINCIDENT,
303 IR_PARALLEL,
304 };
305
306 IntersectResult fm_intersectLineSegments2d(const float a1[3], const float a2[3], const float b1[3], const float b2[3], float intersectionPoint[3]);
307 IntersectResult fm_intersectLineSegments2d(const double a1[3],const double a2[3],const double b1[3],const double b2[3],double intersectionPoint[3]);
308
309 IntersectResult fm_intersectLineSegments2dTime(const float a1[3], const float a2[3], const float b1[3], const float b2[3],float &t1,float &t2);
310 IntersectResult fm_intersectLineSegments2dTime(const double a1[3],const double a2[3],const double b1[3],const double b2[3],double &t1,double &t2);
311
312 // Plane-Triangle splitting
313
314 enum PlaneTriResult
315 {
316 PTR_ON_PLANE,
317 PTR_FRONT,
318 PTR_BACK,
319 PTR_SPLIT,
320 };
321
322 PlaneTriResult fm_planeTriIntersection(const float plane[4], // the plane equation in Ax+By+Cz+D format
323 const float *triangle, // the source triangle.
324 uint32_t tstride, // stride in bytes of the input and output *vertices*
325 float epsilon, // the co-planer epsilon value.
326 float *front, // the triangle in front of the
327 uint32_t &fcount, // number of vertices in the 'front' triangle
328 float *back, // the triangle in back of the plane
329 uint32_t &bcount); // the number of vertices in the 'back' triangle.
330
331
332 PlaneTriResult fm_planeTriIntersection(const double plane[4], // the plane equation in Ax+By+Cz+D format
333 const double *triangle, // the source triangle.
334 uint32_t tstride, // stride in bytes of the input and output *vertices*
335 double epsilon, // the co-planer epsilon value.
336 double *front, // the triangle in front of the
337 uint32_t &fcount, // number of vertices in the 'front' triangle
338 double *back, // the triangle in back of the plane
339 uint32_t &bcount); // the number of vertices in the 'back' triangle.
340
341
342 void fm_intersectPointPlane(const float p1[3],const float p2[3],float *split,const float plane[4]);
343 void fm_intersectPointPlane(const double p1[3],const double p2[3],double *split,const double plane[4]);
344
345 PlaneTriResult fm_getSidePlane(const float p[3],const float plane[4],float epsilon);
346 PlaneTriResult fm_getSidePlane(const double p[3],const double plane[4],double epsilon);
347
348
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);
351
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);
354
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]);
357
358
359 //** Note, if the returned capsule height is less than zero, then you must represent it is a sphere of size radius.
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);
362
363
364 void fm_planeToMatrix(const float plane[4],float matrix[16]); // convert a plane equation to a 4x4 rotation matrix. Reference vector is 0,1,0
365 void fm_planeToQuat(const float plane[4],float quat[4],float pos[3]); // convert a plane equation to a quaternion and translation
366
367 void fm_planeToMatrix(const double plane[4],double matrix[16]); // convert a plane equation to a 4x4 rotation matrix
368 void fm_planeToQuat(const double plane[4],double quat[4],double pos[3]); // convert a plane equation to a quaternion and translation
369
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]; };
372
373
374 void fm_eulerMatrix(float ax,float ay,float az,float matrix[16]); // convert euler (in radians) to a dest 4x4 matrix (translation set to zero)
375 void fm_eulerMatrix(double ax,double ay,double az,double matrix[16]); // convert euler (in radians) to a dest 4x4 matrix (translation set to zero)
376
377
378 float fm_computeMeshVolume(const float *vertices,uint32_t tcount,const uint32_t *indices);
379 double fm_computeMeshVolume(const double *vertices,uint32_t tcount,const uint32_t *indices);
380
381
382 #define FM_DEFAULT_GRANULARITY 0.001f // 1 millimeter is the default granularity
383
384 class fm_VertexIndex
385 {
386 public:
387 virtual uint32_t getIndex(const float pos[3],bool &newPos) = 0; // get welded index for this float vector[3]
388 virtual uint32_t getIndex(const double pos[3],bool &newPos) = 0; // get welded index for this double vector[3]
389 virtual const float * getVerticesFloat(void) const = 0;
390 virtual const double * getVerticesDouble(void) const = 0;
391 virtual const float * getVertexFloat(uint32_t index) const = 0;
392 virtual const double * getVertexDouble(uint32_t index) const = 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;
396 };
397
398 fm_VertexIndex * fm_createVertexIndex(double granularity,bool snapToGrid); // create an indexed vertex system for doubles
399 fm_VertexIndex * fm_createVertexIndex(float granularity,bool snapToGrid); // create an indexed vertext system for floats
400 void fm_releaseVertexIndex(fm_VertexIndex *vindex);
401
402
403 class fm_Triangulate
404 {
405 public:
406 virtual const double * triangulate3d(uint32_t pcount,
407 const double *points,
408 uint32_t vstride,
409 uint32_t &tcount,
410 bool consolidate,
411 double epsilon) = 0;
412
413 virtual const float * triangulate3d(uint32_t pcount,
414 const float *points,
415 uint32_t vstride,
416 uint32_t &tcount,
417 bool consolidate,
418 float epsilon) = 0;
419 };
420
421 fm_Triangulate * fm_createTriangulate(void);
422 void fm_releaseTriangulate(fm_Triangulate *t);
423
424
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);
427
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);
432
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);
435
436 uint32_t fm_consolidatePolygon(uint32_t pcount,const float *points,uint32_t pstride,float *dest,float epsilon=0.999999f); // collapses co-linear edges.
437 uint32_t fm_consolidatePolygon(uint32_t pcount,const double *points,uint32_t pstride,double *dest,double epsilon=0.999999); // collapses co-linear edges.
438
439
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);
442
443 void fm_nearestPointInTriangle(const float *pos,const float *p1,const float *p2,const float *p3,float *nearest);
444 void fm_nearestPointInTriangle(const double *pos,const double *p1,const double *p2,const double *p3,double *nearest);
445
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);
448
449 void fm_subtract(const float *A,const float *B,float *diff); // compute A-B and store the result in 'diff'
450 void fm_subtract(const double *A,const double *B,double *diff); // compute A-B and store the result in 'diff'
451
452 void fm_multiply(float *A,float scaler);
453 void fm_multiply(double *A,double scaler);
454
455 void fm_add(const float *A,const float *B,float *sum);
456 void fm_add(const double *A,const double *B,double *sum);
457
458 void fm_copy3(const float *source,float *dest);
459 void fm_copy3(const double *source,double *dest);
460
461 // re-indexes an indexed triangle mesh but drops unused vertices. The output_indices can be the same pointer as the input indices.
462 // the output_vertices can point to the input vertices if you desire. The output_vertices buffer should be at least the same size
463 // is the input buffer. The routine returns the new vertex count after re-indexing.
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);
466
467 bool fm_isMeshCoplanar(uint32_t tcount,const uint32_t *indices,const float *vertices,bool doubleSided); // returns true if this collection of indexed triangles are co-planar!
468 bool fm_isMeshCoplanar(uint32_t tcount,const uint32_t *indices,const double *vertices,bool doubleSided); // returns true if this collection of indexed triangles are co-planar!
469
470 bool fm_samePlane(const float p1[4],const float p2[4],float normalEpsilon=0.01f,float dEpsilon=0.001f,bool doubleSided=false); // returns true if these two plane equations are identical within an epsilon
471 bool fm_samePlane(const double p1[4],const double p2[4],double normalEpsilon=0.01,double dEpsilon=0.001,bool doubleSided=false);
472
473 void fm_OBBtoAABB(const float obmin[3],const float obmax[3],const float matrix[16],float abmin[3],float abmax[3]);
474
475 // a utility class that will tessellate a mesh.
476 class fm_Tesselate
477 {
478 public:
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;
480 };
481
482 fm_Tesselate * fm_createTesselate(void);
483 void fm_releaseTesselate(fm_Tesselate *t);
484
485 void fm_computeMeanNormals(uint32_t vcount, // the number of vertices
486 const float *vertices, // the base address of the vertex position data.
487 uint32_t vstride, // the stride between position data.
488 float *normals, // the base address of the destination for mean vector normals
489 uint32_t nstride, // the stride between normals
490 uint32_t tcount, // the number of triangles
491 const uint32_t *indices); // the triangle indices
492
493 void fm_computeMeanNormals(uint32_t vcount, // the number of vertices
494 const double *vertices, // the base address of the vertex position data.
495 uint32_t vstride, // the stride between position data.
496 double *normals, // the base address of the destination for mean vector normals
497 uint32_t nstride, // the stride between normals
498 uint32_t tcount, // the number of triangles
499 const uint32_t *indices); // the triangle indices
500
501
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);
504
505 }; // end of namespace
506
507 #endif
FLOAT_MATH::fm_computeArea
float fm_computeArea(const float p1[3], const float p2[3], const float p3[3])
FLOAT_MATH::fm_getDeterminant
float fm_getDeterminant(const float matrix[16])
FLOAT_MATH::fm_Tesselate
Definition: FloatMath.h:476
FLOAT_MATH::IntersectResult
IntersectResult
Definition: FloatMath.h:298
FLOAT_MATH::IR_COINCIDENT
Definition: FloatMath.h:302
FLOAT_MATH::fm_cross
void fm_cross(float cross[3], const float a[3], const float b[3])
FLOAT_MATH::fm_computeBestFitAABB
float fm_computeBestFitAABB(uint32_t vcount, const float *points, uint32_t pstride, float bmin[3], float bmax[3])
FLOAT_MATH::fm_solveZ
float fm_solveZ(const float plane[4], float x, float y)
FLOAT_MATH::fm_computePlane
float fm_computePlane(const float p1[3], const float p2[3], const float p3[3], float *n)
FLOAT_MATH::fm_computeBestFitCapsule
void fm_computeBestFitCapsule(uint32_t vcount, const float *points, uint32_t pstride, float &radius, float &height, float matrix[16], bool bruteForce=true)
FLOAT_MATH::fm_VertexIndex::getVertexDouble
virtual const double * getVertexDouble(uint32_t index) const =0
FLOAT_MATH::fm_quatToMatrix
void fm_quatToMatrix(const float quat[4], float matrix[16])
FLOAT_MATH::fm_minmax
void fm_minmax(const float p[3], float bmin[3], float bmax[3])
FLOAT_MATH::fm_initMinMax
void fm_initMinMax(const float p[3], float bmin[3], float bmax[3])
FLOAT_MATH::fm_Triangulate
Definition: FloatMath.h:403
Nv::Blast::VecMath::normal
NV_INLINE float normal(const float a[3], float r[3])
Definition: NvBlastMath.h:93
FLOAT_MATH::fm_distance
float fm_distance(const float p1[3], const float p2[3])
FLOAT_MATH::fm_intersectAABB
bool fm_intersectAABB(const float bmin1[3], const float bmax1[3], const float bmin2[3], const float bmax2[3])
x
SIMD_FORCE_INLINE const btScalar & x() const
Return the x value.
Definition: btVector3.h:275
FLOAT_MATH::fm_areaTriangle
float fm_areaTriangle(const float *p1, const float *p2, const float *p3)
FLOAT_MATH::fm_copyUniqueVertices
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)
FLOAT_MATH::fm_planeTriIntersection
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)
FLOAT_MATH::FMCS_YMIN
Definition: FloatMath.h:16
FLOAT_MATH::PlaneTriResult
PlaneTriResult
Definition: FloatMath.h:314
FLOAT_MATH::FM_YAXIS
Definition: FloatMath.h:25
FLOAT_MATH::fm_eulerToMatrixDX
void fm_eulerToMatrixDX(float x, float y, float z, float matrix[16])
FLOAT_MATH::fm_clipTestPoint
uint32_t fm_clipTestPoint(const float bmin[3], const float bmax[3], const float pos[3])
FLOAT_MATH::fm_scale
void fm_scale(float x, float y, float z, float matrix[16])
FLOAT_MATH::fm_intersectLineSegments2d
IntersectResult fm_intersectLineSegments2d(const float a1[3], const float a2[3], const float b1[3], const float b2[3], float intersectionPoint[3])
FLOAT_MATH::PTR_ON_PLANE
Definition: FloatMath.h:316
FLOAT_MATH::fm_intersectLineSegmentAABB
bool fm_intersectLineSegmentAABB(const float bmin[3], const float bmax[3], const float p1[3], const float p2[3], float intersect[3])
FLOAT_MATH::fm_lerp
void fm_lerp(const float p1[3], const float p2[3], float dest[3], float lerpValue)
FLOAT_MATH::LineSegmentType
LineSegmentType
Definition: FloatMath.h:29
FLOAT_MATH::fm_computeBestFitOBB
void fm_computeBestFitOBB(uint32_t vcount, const float *points, uint32_t pstride, float *sides, float matrix[16], bool bruteForce=true)
FLOAT_MATH::fm_lineIntersectsTriangle
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])
FLOAT_MATH::fm_eulerMatrix
void fm_eulerMatrix(float ax, float ay, float az, float matrix[16])
FLOAT_MATH::fm_multiply
void fm_multiply(float *A, float scaler)
FLOAT_MATH::fm_setTranslation
void fm_setTranslation(const float *translation, float matrix[16])
FLOAT_MATH::fm_computeWindingOrder
bool fm_computeWindingOrder(const float p1[3], const float p2[3], const float p3[3])
FLOAT_MATH::fm_inverseRT
void fm_inverseRT(const float matrix[16], const float pos[3], float t[3])
FLOAT_MATH::fm_computeBestFitPlane
bool fm_computeBestFitPlane(uint32_t vcount, const float *points, uint32_t vstride, const float *weights, uint32_t wstride, float plane[4])
FLOAT_MATH::LS_MIDDLE
Definition: FloatMath.h:32
FLOAT_MATH::fm_sphereVolume
float fm_sphereVolume(float radius)
FLOAT_MATH::fm_OBBtoAABB
void fm_OBBtoAABB(const float obmin[3], const float obmax[3], const float matrix[16], float abmin[3], float abmax[3])
FLOAT_MATH::fm_distToPlane
float fm_distToPlane(const float plane[4], const float pos[3])
FLOAT_MATH::fm_quatToEuler
void fm_quatToEuler(const float quat[4], float &ax, float &ay, float &az)
FLOAT_MATH::fm_transform
void fm_transform(const float matrix[16], const float pos[3], float t[3])
FLOAT_MATH::FMCS_ZMAX
Definition: FloatMath.h:19
FLOAT_MATH::fm_intersectPointPlane
void fm_intersectPointPlane(const float p1[3], const float p2[3], float *split, const float plane[4])
FLOAT_MATH::PTR_BACK
Definition: FloatMath.h:318
FLOAT_MATH::fm_dot
float fm_dot(const float p1[3], const float p2[3])
FLOAT_MATH::fm_VertexIndex::isDouble
virtual bool isDouble(void) const =0
FLOAT_MATH::FMCS_XMAX
Definition: FloatMath.h:15
FLOAT_MATH::fm_clipTestAABB
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)
FLOAT_MATH::fm_pointInsidePolygon2d
bool fm_pointInsidePolygon2d(uint32_t pcount, const float *points, uint32_t pstride, const float *point, uint32_t xindex=0, uint32_t yindex=1)
FLOAT_MATH::fm_rayIntersectsTriangle
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)
FLOAT_MATH::fm_catmullRom
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)
FLOAT_MATH::fm_computeCentroid
bool fm_computeCentroid(uint32_t vcount, const float *points, uint32_t vstride, float *center)
FLOAT_MATH
Definition: FloatMath.h:9
FLOAT_MATH::fm_intersectLineSegments2dTime
IntersectResult fm_intersectLineSegments2dTime(const float a1[3], const float a2[3], const float b1[3], const float b2[3], float &t1, float &t2)
FLOAT_MATH::fm_getTranslation
void fm_getTranslation(const float matrix[16], float t[3])
FLOAT_MATH::fm_composeTransform
void fm_composeTransform(const float position[3], const float quat[4], const float scale[3], float matrix[16])
FLOAT_MATH::fm_transformAABB
void fm_transformAABB(const float bmin[3], const float bmax[3], const float matrix[16], float tbmin[3], float tbmax[3])
FLOAT_MATH::fm_VertexIndex::getVertexFloat
virtual const float * getVertexFloat(uint32_t index) const =0
FLOAT_MATH::fm_VertexIndex::getIndex
virtual uint32_t getIndex(const float pos[3], bool &newPos)=0
FLOAT_MATH::fm_insideAABB
bool fm_insideAABB(const float pos[3], const float bmin[3], const float bmax[3])
FLOAT_MATH::fm_consolidatePolygon
uint32_t fm_consolidatePolygon(uint32_t pcount, const float *points, uint32_t pstride, float *dest, float epsilon=0.999999f)
FLOAT_MATH::fm_computeSplitPlane
bool fm_computeSplitPlane(uint32_t vcount, const double *vertices, uint32_t tcount, const uint32_t *indices, double *plane)
FLOAT_MATH::fm_planeToMatrix
void fm_planeToMatrix(const float plane[4], float matrix[16])
FLOAT_MATH::fm_cylinderVolume
float fm_cylinderVolume(float radius, float h)
FLOAT_MATH::fm_planeToQuat
void fm_planeToQuat(const float plane[4], float quat[4], float pos[3])
FLOAT_MATH::IR_PARALLEL
Definition: FloatMath.h:303
FLOAT_MATH::fm_getPoint
const float * fm_getPoint(const float *points, uint32_t pstride, uint32_t index)
y
SIMD_FORCE_INLINE const btScalar & y() const
Return the y value.
Definition: btVector3.h:277
FLOAT_MATH::fm_solveX
float fm_solveX(const float plane[4], float y, float z)
FLOAT_MATH::PTR_FRONT
Definition: FloatMath.h:317
FLOAT_MATH::fm_releaseTriangulate
void fm_releaseTriangulate(fm_Triangulate *t)
FLOAT_MATH::fm_clipTestPointXZ
uint32_t fm_clipTestPointXZ(const float bmin[3], const float bmax[3], const float pos[3])
FLOAT_MATH::fm_add
void fm_add(const float *A, const float *B, float *sum)
FLOAT_MATH::fm_createVertexIndex
fm_VertexIndex * fm_createVertexIndex(double granularity, bool snapToGrid)
FLOAT_MATH::fm_releaseVertexIndex
void fm_releaseVertexIndex(fm_VertexIndex *vindex)
FLOAT_MATH::fm_insideTriangle
bool fm_insideTriangle(float Ax, float Ay, float Bx, float By, float Cx, float Cy, float Px, float Py)
FLOAT_MATH::fm_colinear
bool fm_colinear(const double p1[3], const double p2[3], const double p3[3], double epsilon=0.999)
FLOAT_MATH::fm_createTriangulate
fm_Triangulate * fm_createTriangulate(void)
FLOAT_MATH::fm_rotationArc
void fm_rotationArc(const float v0[3], const float v1[3], float quat[4])
FLOAT_MATH::fm_multiplyQuat
void fm_multiplyQuat(const float *qa, const float *qb, float *quat)
FLOAT_MATH::fm_getAABBCenter
void fm_getAABBCenter(const float bmin[3], const float bmax[3], float center[3])
FLOAT_MATH::FM_Axis
FM_Axis
Definition: FloatMath.h:22
FLOAT_MATH::fm_eulerToQuatDX
void fm_eulerToQuatDX(float x, float y, float z, float quat[4])
FLOAT_MATH::fm_computeNormalVector
void fm_computeNormalVector(float n[3], const float p1[3], const float p2[3])
FLOAT_MATH::fm_createTesselate
fm_Tesselate * fm_createTesselate(void)
FLOAT_MATH::fm_computeMeshVolume
float fm_computeMeshVolume(const float *vertices, uint32_t tcount, const uint32_t *indices)
FLOAT_MATH::fm_insideTriangleXZ
bool fm_insideTriangleXZ(const float test[3], const float p1[3], const float p2[3], const float p3[3])
FLOAT_MATH::fm_lineTestAABB
bool fm_lineTestAABB(const float p1[3], const float p2[3], const float bmin[3], const float bmax[3], float &time)
FLOAT_MATH::fm_VertexIndex::getVerticesFloat
virtual const float * getVerticesFloat(void) const =0
FLOAT_MATH::FMCS_XMIN
Definition: FloatMath.h:14
FLOAT_MATH::fm_VertexIndex::getVcount
virtual uint32_t getVcount(void) const =0
FLOAT_MATH::fm_copy3
void fm_copy3(const float *source, float *dest)
FLOAT_MATH::fm_computeBestFitABB
void fm_computeBestFitABB(uint32_t vcount, const float *points, uint32_t pstride, float *sides, float pos[3])
FLOAT_MATH::fm_VertexIndex
Definition: FloatMath.h:384
FLOAT_MATH::fm_normalizeQuat
float fm_normalizeQuat(float n[4])
FLOAT_MATH::IR_DO_INTERSECT
Definition: FloatMath.h:301
FLOAT_MATH::fm_distanceSquaredXZ
float fm_distanceSquaredXZ(const float p1[3], const float p2[3])
FLOAT_MATH::fm_raySphereIntersect
bool fm_raySphereIntersect(const float center[3], float radius, const float pos[3], const float dir[3], float distance, float intersect[3])
FLOAT_MATH::fm_samePlane
bool fm_samePlane(const float p1[4], const float p2[4], float normalEpsilon=0.01f, float dEpsilon=0.001f, bool doubleSided=false)
FLOAT_MATH::fm_matrixToQuat
void fm_matrixToQuat(const float matrix[16], float quat[4])
FLOAT_MATH::FM_ZAXIS
Definition: FloatMath.h:26
FLOAT_MATH::fm_getSidePlane
PlaneTriResult fm_getSidePlane(const float p[3], const float plane[4], float epsilon)
distance
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_MATH::fm_solveY
float fm_solveY(const float plane[4], float x, float z)
FLOAT_MATH::fm_areaPolygon2d
float fm_areaPolygon2d(uint32_t pcount, const float *points, uint32_t pstride)
FLOAT_MATH::fm_intersectRayAABB
bool fm_intersectRayAABB(const float bmin[3], const float bmax[3], const float pos[3], const float dir[3], float intersect[3])
FLOAT_MATH::IR_DONT_INTERSECT
Definition: FloatMath.h:300
z
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition: btVector3.h:279
FLOAT_MATH::fm_nearestPointInTriangle
void fm_nearestPointInTriangle(const float *pos, const float *p1, const float *p2, const float *p3, float *nearest)
FLOAT_MATH::fm_distanceSquared
float fm_distanceSquared(const float p1[3], const float p2[3])
FLOAT_MATH::fm_getSubMatrix
void fm_getSubMatrix(int32_t ki, int32_t kj, float pDst[16], const float matrix[16])
FLOAT_MATH::fm_computeMeanNormals
void fm_computeMeanNormals(uint32_t vcount, const float *vertices, uint32_t vstride, float *normals, uint32_t nstride, uint32_t tcount, const uint32_t *indices)
FLOAT_MATH::fm_quatRotate
void fm_quatRotate(const float quat[4], const float v[3], float r[3])
FLOAT_MATH::FM_ClipState
FM_ClipState
Definition: FloatMath.h:12
FLOAT_MATH::fm_normalize
float fm_normalize(float n[3])
FLOAT_MATH::fm_doubleToFloat3
void fm_doubleToFloat3(const double p[3], float t[3])
Definition: FloatMath.h:370
FLOAT_MATH::LS_END
Definition: FloatMath.h:33
FLOAT_MATH::fm_floatToDouble3
void fm_floatToDouble3(const float p[3], double t[3])
Definition: FloatMath.h:371
FLOAT_MATH::fm_capsuleVolume
float fm_capsuleVolume(float radius, float h)
FLOAT_MATH::fm_matrixMultiply
void fm_matrixMultiply(const float A[16], const float B[16], float dest[16])
FLOAT_MATH::fm_VertexIndex::saveAsObj
virtual bool saveAsObj(const char *fname, uint32_t tcount, uint32_t *indices)=0
FLOAT_MATH::fm_eulerToQuat
void fm_eulerToQuat(float x, float y, float z, float quat[4])
FLOAT_MATH::fm_isMeshCoplanar
bool fm_isMeshCoplanar(uint32_t tcount, const uint32_t *indices, const float *vertices, bool doubleSided)
FLOAT_MATH::FM_XAXIS
Definition: FloatMath.h:24
FLOAT_MATH::fm_getAABB
void fm_getAABB(uint32_t vcount, const float *points, uint32_t pstride, float bmin[3], float bmax[3])
FLOAT_MATH::fm_inverseTransform
void fm_inverseTransform(const float matrix[16], float inverse_matrix[16])
FLOAT_MATH::fm_VertexIndex::getVerticesDouble
virtual const double * getVerticesDouble(void) const =0
FLOAT_MATH::FM_PI
const float FM_PI
Definition: FloatMath.h:37
FLOAT_MATH::fm_lineTestAABBXZ
bool fm_lineTestAABBXZ(const float p1[3], const float p2[3], const float bmin[3], const float bmax[3], float &time)
FLOAT_MATH::FMCS_ZMIN
Definition: FloatMath.h:18
FLOAT_MATH::fm_inflateMinMax
void fm_inflateMinMax(float bmin[3], float bmax[3], float ratio)
FLOAT_MATH::fm_releaseTesselate
void fm_releaseTesselate(fm_Tesselate *t)
FLOAT_MATH::FMCS_YMAX
Definition: FloatMath.h:17
FLOAT_MATH::fm_multiplyTransform
void fm_multiplyTransform(const float *pA, const float *pB, float *pM)
FLOAT_MATH::fm_subtract
void fm_subtract(const float *A, const float *B, float *diff)
FLOAT_MATH::FM_DEG_TO_RAD
const float FM_DEG_TO_RAD
Definition: FloatMath.h:38
FLOAT_MATH::FM_RAD_TO_DEG
const float FM_RAD_TO_DEG
Definition: FloatMath.h:39
FLOAT_MATH::fm_decomposeTransform
void fm_decomposeTransform(const float local_transform[16], float trans[3], float rot[4], float scale[3])
FLOAT_MATH::LS_START
Definition: FloatMath.h:31
FLOAT_MATH::PTR_SPLIT
Definition: FloatMath.h:319
FLOAT_MATH::fm_isValidTriangle
bool fm_isValidTriangle(const float *p1, const float *p2, const float *p3, float epsilon=0.00001f)
FLOAT_MATH::fm_eulerToMatrix
void fm_eulerToMatrix(float ax, float ay, float az, float matrix[16])
FLOAT_MATH::fm_computeBestFitSphere
float fm_computeBestFitSphere(uint32_t vcount, const float *points, uint32_t pstride, float center[3])
FLOAT_MATH::fm_getDominantAxis
FM_Axis fm_getDominantAxis(const float normal[3])
cross
SIMD_FORCE_INLINE btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
Definition: btVector3.h:193
FLOAT_MATH::fm_rotate
void fm_rotate(const float matrix[16], const float pos[3], float t[3])
FLOAT_MATH::fm_identity
void fm_identity(float matrix[16])
FLOAT_MATH::fm_lineSphereIntersect
bool fm_lineSphereIntersect(const float center[3], float radius, const float p1[3], const float p2[3], float intersect[3])
FLOAT_MATH::fm_distancePointLineSegment
float fm_distancePointLineSegment(const float Point[3], const float LineStart[3], const float LineEnd[3], float intersection[3], LineSegmentType &type, float epsilon)