Bullet Collision Detection & Physics Library: poly34.h Source File

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

poly34.h
Go to the documentation of this file.
1// poly34.h : solution of cubic and quartic equation
2// (c) Khashin S.I. http://math.ivanovo.ac.ru/dalgebra/Khashin/index.html
3// khash2 (at) gmail.com
4
5#ifndef POLY_34
6#define POLY_34
7#include "LinearMath/btScalar.h"
8// x - array of size 2
9// return 2: 2 real roots x[0], x[1]
10// return 0: pair of complex roots: x[0]i*x[1]
11int SolveP2(btScalar* x, btScalar a, btScalar b); // solve equation x^2 + a*x + b = 0
12
13// x - array of size 3
14// return 3: 3 real roots x[0], x[1], x[2]
15// return 1: 1 real root x[0] and pair of complex roots: x[1]i*x[2]
16int SolveP3(btScalar* x, btScalar a, btScalar b, btScalar c); // solve cubic equation x^3 + a*x^2 + b*x + c = 0
17
18// x - array of size 4
19// return 4: 4 real roots x[0], x[1], x[2], x[3], possible multiple roots
20// return 2: 2 real roots x[0], x[1] and complex x[2]i*x[3],
21// return 0: two pair of complex roots: x[0]i*x[1], x[2]i*x[3],
22int 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
23
24// x - array of size 5
25// return 5: 5 real roots x[0], x[1], x[2], x[3], x[4], possible multiple roots
26// return 3: 3 real roots x[0], x[1], x[2] and complex x[3]i*x[4],
27// return 1: 1 real root x[0] and two pair of complex roots: x[1]i*x[2], x[3]i*x[4],
28int 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
29
30//-----------------------------------------------------------------------------
31// And some additional functions for internal use.
32// Your may remove this definitions from here
33int SolveP4Bi(btScalar* x, btScalar b, btScalar d); // solve equation x^4 + b*x^2 + d = 0
34int SolveP4De(btScalar* x, btScalar b, btScalar c, btScalar d); // solve equation x^4 + b*x^2 + c*x + d = 0
35void CSqrt(btScalar x, btScalar y, btScalar& a, btScalar& b); // returns as a+i*s, sqrt(x+i*y)
36 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
37 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
38#endif
btScalar.h
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
SolveP5
int SolveP5(btScalar *x, btScalar a, btScalar b, btScalar c, btScalar d, btScalar e)
Definition: poly34.cpp:441
CSqrt
void CSqrt(btScalar x, btScalar y, btScalar &a, btScalar &b)
Definition: poly34.cpp:119
SolveP5_1
btScalar SolveP5_1(btScalar a, btScalar b, btScalar c, btScalar d, btScalar e)
Definition: poly34.cpp:341
SolveP4
int SolveP4(btScalar *x, btScalar a, btScalar b, btScalar c, btScalar d)
Definition: poly34.cpp:300
SolveP3
int SolveP3(btScalar *x, btScalar a, btScalar b, btScalar c)
Definition: poly34.cpp:71
SolveP4Bi
int SolveP4Bi(btScalar *x, btScalar b, btScalar d)
Definition: poly34.cpp:143
N4Step
btScalar N4Step(btScalar x, btScalar a, btScalar b, btScalar c, btScalar d)
Definition: poly34.cpp:287
SolveP2
int SolveP2(btScalar *x, btScalar a, btScalar b)
Definition: poly34.cpp:52
SolveP4De
int SolveP4De(btScalar *x, btScalar b, btScalar c, btScalar d)
Definition: poly34.cpp:208