51#define dDOTpq(a,b,p,q) ((a)[0]*(b)[0] + (a)[p]*(b)[q] + (a)[2*(p)]*(b)[2*(q)])
52#define dInfinity FLT_MAX
64#define dMULTIPLYOP1_331(A,op,B,C) \
66 (A)[0] op dDOT41((B),(C)); \
67 (A)[1] op dDOT41((B+1),(C)); \
68 (A)[2] op dDOT41((B+2),(C)); \
71#define dMULTIPLYOP0_331(A,op,B,C) \
73 (A)[0] op dDOT((B),(C)); \
74 (A)[1] op dDOT((B+4),(C)); \
75 (A)[2] op dDOT((B+8),(C)); \
78#define dMULTIPLY1_331(A,B,C) dMULTIPLYOP1_331(A,=,B,C)
79#define dMULTIPLY0_331(A,B,C) dMULTIPLYOP0_331(A,=,B,C)
130 for (
int sign=-1; sign <= 1; sign += 2) {
135 for (
int i=
nq; i > 0; i--) {
174#define M__PI 3.14159265f
202 for (i=0; i<(n-1); i++) {
203 q = p[i*2]*p[i*2+3] - p[i*2+2]*p[i*2+1];
205 cx +=
q*(p[i*2]+p[i*2+2]);
206 cy +=
q*(p[i*2+1]+p[i*2+3]);
208 q = p[n*2-2]*p[1] - p[0]*p[n*2-1];
216 cx = a*(
cx +
q*(p[n*2-2]+p[0]));
217 cy = a*(
cy +
q*(p[n*2-1]+p[1]));
222 for (i=0; i<n; i++)
A[i] =
btAtan2(p[i*2+1]-
cy,p[i*2]-
cx);
226 for (i=0; i<n; i++)
avail[i] = 1;
230 for (
j=1;
j<
m;
j++) {
237 for (i=0; i<n; i++) {
247#if defined(DEBUG) || defined (_DEBUG)
271 btScalar A[3],
B[3],
R11,
R12,
R13,
R21,
R22,
R23,
R31,
R32,
R33,
272 Q11,
Q12,
Q13,
Q21,
Q22,
Q23,
Q31,
Q32,
Q33,
s,
s2,l;
306#define TST(expr1,expr2,norm,cc) \
307 s2 = btFabs(expr1) - (expr2); \
308 if (s2 > 0) return 0; \
312 invert_normal = ((expr1) < 0); \
333#define TST(expr1,expr2,n1,n2,n3,cc) \
334 s2 = btFabs(expr1) - (expr2); \
335 if (s2 > SIMD_EPSILON) return 0; \
336 l = btSqrt((n1)*(n1) + (n2)*(n2) + (n3)*(n3)); \
337 if (l > SIMD_EPSILON) { \
339 if (s2*fudge_factor > s) { \
342 normalC[0] = (n1)/l; normalC[1] = (n2)/l; normalC[2] = (n3)/l; \
343 invert_normal = ((expr1) < 0); \
392 normal[0] = -normal[0];
393 normal[1] = -normal[1];
394 normal[2] = -normal[2];
405 for (i=0; i<3; i++)
pa[i] =
p1[i];
406 for (
j=0;
j<3;
j++) {
408 for (i=0; i<3; i++)
pa[i] += sign *
A[
j] *
R1[i*4+
j];
413 for (i=0; i<3; i++)
pb[i] =
p2[i];
414 for (
j=0;
j<3;
j++) {
416 for (i=0; i<3; i++)
pb[i] += sign *
B[
j] *
R2[i*4+
j];
421 for (i=0; i<3; i++)
ua[i] =
R1[((code)-7)/3 + i*4];
422 for (i=0; i<3; i++)
ub[i] =
R2[((code)-7)%3 + i*4];
425 for (i=0; i<3; i++)
pa[i] +=
ua[i]*
alpha;
426 for (i=0; i<3; i++)
pb[i] +=
ub[i]*
beta;
434#ifdef USE_CENTER_POINT
528 if (code <= 3)
codeN = code-1;
else codeN = code-4;
591 for (
j=0;
j < n;
j++) {
594 for (i=0; i<3; i++) point[
cnum*3+i] =
603 if (
cnum < 1)
return 0;
640 for (i=1; i<
cnum; i++) {
641 if (
dep[i] > maxdepth) {
685 for (
int j=0;
j<3;
j++)
static btScalar dDOT14(const btScalar *a, const btScalar *b)
#define dMULTIPLY0_331(A, B, C)
void dLineClosestApproach(const btVector3 &pa, const btVector3 &ua, const btVector3 &pb, const btVector3 &ub, btScalar *alpha, btScalar *beta)
int dBoxBox2(const btVector3 &p1, const dMatrix3 R1, const btVector3 &side1, const btVector3 &p2, const dMatrix3 R2, const btVector3 &side2, btVector3 &normal, btScalar *depth, int *return_code, int maxc, dContactGeom *, int, btDiscreteCollisionDetectorInterface::Result &output)
static btScalar dDOT(const btScalar *a, const btScalar *b)
#define dMULTIPLY1_331(A, B, C)
static int intersectRectQuad2(btScalar h[2], btScalar p[8], btScalar ret[16])
#define dDOTpq(a, b, p, q)
void cullPoints2(int n, btScalar p[], int m, int i0, int iret[])
#define TST(expr1, expr2, norm, cc)
static btScalar dDOT41(const btScalar *a, const btScalar *b)
static btScalar dDOT44(const btScalar *a, const btScalar *b)
const T & btMax(const T &a, const T &b)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScalar btAtan2(btScalar x, btScalar y)
btScalar btFabs(btScalar x)
The btBoxShape is a box primitive around the origin, its sides axis aligned with length specified by ...
btVector3 getHalfExtentsWithMargin() const
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations.
btVector3 can be used to represent 3D points and vectors.
const btBoxShape * m_box1
const btBoxShape * m_box2
virtual void getClosestPoints(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw, bool swapResults=false)
btBoxBoxDetector(const btBoxShape *box1, const btBoxShape *box2)
ODE box-box collision detection is adapted to work with Bullet.