float->btScalar

This commit is contained in:
Xuchen Han
2020-02-07 13:23:17 -08:00
parent b9c0456d85
commit c4eb4ad66c
2 changed files with 11 additions and 11 deletions

View File

@@ -565,7 +565,7 @@ static SIMD_FORCE_INLINE bool continuousCollisionDetection(const btSoftBody::Fac
btScalar a3 = c.dot(e);
btScalar eps = SAFE_EPSILON;
int num_roots = 0;
float roots[3];
btScalar roots[3];
if (std::abs(a3) < eps)
{
// cubic term is zero

View File

@@ -4,35 +4,35 @@
#ifndef POLY_34
#define POLY_34
#define SIMD_FORCE_INLINE inline __attribute__ ((always_inline))
#include "LinearMath/btScalar.h"
// x - array of size 2
// return 2: 2 real roots x[0], x[1]
// return 0: pair of complex roots: x[0]i*x[1]
int SolveP2(float* x, float a, float b); // solve equation x^2 + a*x + b = 0
int SolveP2(btScalar* x, btScalar a, btScalar b); // solve equation x^2 + a*x + b = 0
// x - array of size 3
// return 3: 3 real roots x[0], x[1], x[2]
// return 1: 1 real root x[0] and pair of complex roots: x[1]i*x[2]
int SolveP3(float* x, float a, float b, float c); // solve cubic equation x^3 + a*x^2 + b*x + c = 0
int SolveP3(btScalar* x, btScalar a, btScalar b, btScalar c); // solve cubic equation x^3 + a*x^2 + b*x + c = 0
// x - array of size 4
// return 4: 4 real roots x[0], x[1], x[2], x[3], possible multiple roots
// return 2: 2 real roots x[0], x[1] and complex x[2]i*x[3],
// return 0: two pair of complex roots: x[0]i*x[1], x[2]i*x[3],
int SolveP4(float* x, float a, float b, float c, float d); // solve equation x^4 + a*x^3 + b*x^2 + c*x + d = 0 by Dekart-Euler method
int SolveP4(btScalar* x, btScalar a, btScalar b, btScalar c, btScalar d); // solve equation x^4 + a*x^3 + b*x^2 + c*x + d = 0 by Dekart-Euler method
// x - array of size 5
// return 5: 5 real roots x[0], x[1], x[2], x[3], x[4], possible multiple roots
// return 3: 3 real roots x[0], x[1], x[2] and complex x[3]i*x[4],
// return 1: 1 real root x[0] and two pair of complex roots: x[1]i*x[2], x[3]i*x[4],
int SolveP5(float* x, float a, float b, float c, float d, float e); // solve equation x^5 + a*x^4 + b*x^3 + c*x^2 + d*x + e = 0
int SolveP5(btScalar* x, btScalar a, btScalar b, btScalar c, btScalar d, btScalar e); // solve equation x^5 + a*x^4 + b*x^3 + c*x^2 + d*x + e = 0
//-----------------------------------------------------------------------------
// And some additional functions for internal use.
// Your may remove this definitions from here
int SolveP4Bi(float* x, float b, float d); // solve equation x^4 + b*x^2 + d = 0
int SolveP4De(float* x, float b, float c, float d); // solve equation x^4 + b*x^2 + c*x + d = 0
void CSqrt(float x, float y, float& a, float& b); // returns as a+i*s, sqrt(x+i*y)
float N4Step(float x, float a, float b, float c, float d); // one Newton step for x^4 + a*x^3 + b*x^2 + c*x + d
float SolveP5_1(float a, float b, float c, float d, float e); // return real root of x^5 + a*x^4 + b*x^3 + c*x^2 + d*x + e = 0
int SolveP4Bi(btScalar* x, btScalar b, btScalar d); // solve equation x^4 + b*x^2 + d = 0
int SolveP4De(btScalar* x, btScalar b, btScalar c, btScalar d); // solve equation x^4 + b*x^2 + c*x + d = 0
void CSqrt(btScalar x, btScalar y, btScalar& a, btScalar& b); // returns as a+i*s, sqrt(x+i*y)
btScalar N4Step(btScalar x, btScalar a, btScalar b, btScalar c, btScalar d); // one Newton step for x^4 + a*x^3 + b*x^2 + c*x + d
btScalar SolveP5_1(btScalar a, btScalar b, btScalar c, btScalar d, btScalar e); // return real root of x^5 + a*x^4 + b*x^3 + c*x^2 + d*x + e = 0
#endif