49 #define dDOTpq(a, b, p, q) ((a)[0] * (b)[0] + (a)[p] * (b)[q] + (a)[2 * (p)] * (b)[2 * (q)])
50 #define dInfinity FLT_MAX
61 #define dMULTIPLYOP1_331(A, op, B, C) \
63 (A)[0] op dDOT41((B), (C)); \
64 (A)[1] op dDOT41((B + 1), (C)); \
65 (A)[2] op dDOT41((B + 2), (C)); \
68 #define dMULTIPLYOP0_331(A, op, B, C) \
70 (A)[0] op dDOT((B), (C)); \
71 (A)[1] op dDOT((B + 4), (C)); \
72 (A)[2] op dDOT((B + 8), (C)); \
75 #define dMULTIPLY1_331(A, B, C) dMULTIPLYOP1_331(A, =, B, C)
76 #define dMULTIPLY0_331(A, B, C) dMULTIPLYOP0_331(A, =, B, C)
104 *alpha = (
q1 + uaub * q2) * d;
105 *
beta = (uaub *
q1 + q2) * d;
125 for (
int dir = 0; dir <= 1; dir++)
134 for (
int i = nq; i > 0; i--)
137 if (
sign * pq[dir] < h[dir])
150 btScalar* nextq = (i > 1) ? pq + 2 : q;
151 if ((
sign * pq[dir] < h[dir]) ^ (
sign * nextq[dir] < h[dir]))
154 pr[1 - dir] = pq[1 - dir] + (nextq[1 - dir] - pq[1 - dir]) /
155 (nextq[dir] - pq[dir]) * (
sign * h[dir] - pq[dir]);
156 pr[dir] =
sign * h[dir];
177 #define M__PI 3.14159265f
208 for (i = 0; i < (n - 1); i++)
210 q = p[i * 2] * p[i * 2 + 3] - p[i * 2 + 2] * p[i * 2 + 1];
212 cx += q * (p[i * 2] + p[i * 2 + 2]);
213 cy += q * (p[i * 2 + 1] + p[i * 2 + 3]);
215 q = p[n * 2 - 2] * p[1] - p[0] * p[n * 2 - 1];
224 cx =
a * (cx + q * (p[n * 2 - 2] + p[0]));
225 cy =
a * (cy + q * (p[n * 2 - 1] + p[1]));
230 for (i = 0; i < n; i++)
A[i] =
btAtan2(p[i * 2 + 1] - cy, p[i * 2] - cx);
234 for (i = 0; i < n; i++) avail[i] = 1;
238 for (j = 1; j < m; j++)
246 for (i = 0; i < n; i++)
259 #if defined(DEBUG) || defined(_DEBUG)
281 btScalar A[3],
B[3], R11, R12, R13, R21, R22, R23, R31, R32, R33,
282 Q11, Q12, Q13, Q21, Q22, Q23, Q31, Q32, Q33, s, s2,
l;
283 int i, j, invert_normal, code;
298 R11 =
dDOT44(R1 + 0, R2 + 0);
299 R12 =
dDOT44(R1 + 0, R2 + 1);
300 R13 =
dDOT44(R1 + 0, R2 + 2);
301 R21 =
dDOT44(R1 + 1, R2 + 0);
302 R22 =
dDOT44(R1 + 1, R2 + 1);
303 R23 =
dDOT44(R1 + 1, R2 + 2);
304 R31 =
dDOT44(R1 + 2, R2 + 0);
305 R32 =
dDOT44(R1 + 2, R2 + 1);
306 R33 =
dDOT44(R1 + 2, R2 + 2);
328 #define TST(expr1, expr2, norm, cc) \
329 s2 = btFabs(expr1) - (expr2); \
330 if (s2 > 0) return 0; \
335 invert_normal = ((expr1) < 0); \
344 TST(pp[0], (
A[0] +
B[0] * Q11 +
B[1] * Q12 +
B[2] * Q13), R1 + 0, 1);
345 TST(pp[1], (
A[1] +
B[0] * Q21 +
B[1] * Q22 +
B[2] * Q23), R1 + 1, 2);
346 TST(pp[2], (
A[2] +
B[0] * Q31 +
B[1] * Q32 +
B[2] * Q33), R1 + 2, 3);
349 TST(
dDOT41(R2 + 0, p), (
A[0] * Q11 +
A[1] * Q21 +
A[2] * Q31 +
B[0]), R2 + 0, 4);
350 TST(
dDOT41(R2 + 1, p), (
A[0] * Q12 +
A[1] * Q22 +
A[2] * Q32 +
B[1]), R2 + 1, 5);
351 TST(
dDOT41(R2 + 2, p), (
A[0] * Q13 +
A[1] * Q23 +
A[2] * Q33 +
B[2]), R2 + 2, 6);
356 #define TST(expr1, expr2, n1, n2, n3, cc) \
357 s2 = btFabs(expr1) - (expr2); \
358 if (s2 > SIMD_EPSILON) return 0; \
359 l = btSqrt((n1) * (n1) + (n2) * (n2) + (n3) * (n3)); \
360 if (l > SIMD_EPSILON) \
363 if (s2 * fudge_factor > s) \
367 normalC[0] = (n1) / l; \
368 normalC[1] = (n2) / l; \
369 normalC[2] = (n3) / l; \
370 invert_normal = ((expr1) < 0); \
390 TST(pp[2] * R21 - pp[1] * R31, (
A[1] * Q31 +
A[2] * Q21 +
B[1] * Q13 +
B[2] * Q12), 0, -R31, R21, 7);
391 TST(pp[2] * R22 - pp[1] * R32, (
A[1] * Q32 +
A[2] * Q22 +
B[0] * Q13 +
B[2] * Q11), 0, -R32, R22, 8);
392 TST(pp[2] * R23 - pp[1] * R33, (
A[1] * Q33 +
A[2] * Q23 +
B[0] * Q12 +
B[1] * Q11), 0, -R33, R23, 9);
395 TST(pp[0] * R31 - pp[2] * R11, (
A[0] * Q31 +
A[2] * Q11 +
B[1] * Q23 +
B[2] * Q22), R31, 0, -R11, 10);
396 TST(pp[0] * R32 - pp[2] * R12, (
A[0] * Q32 +
A[2] * Q12 +
B[0] * Q23 +
B[2] * Q21), R32, 0, -R12, 11);
397 TST(pp[0] * R33 - pp[2] * R13, (
A[0] * Q33 +
A[2] * Q13 +
B[0] * Q22 +
B[1] * Q21), R33, 0, -R13, 12);
400 TST(pp[1] * R11 - pp[0] * R21, (
A[0] * Q21 +
A[1] * Q11 +
B[1] * Q33 +
B[2] * Q32), -R21, R11, 0, 13);
401 TST(pp[1] * R12 - pp[0] * R22, (
A[0] * Q22 +
A[1] * Q12 +
B[0] * Q33 +
B[2] * Q31), -R22, R12, 0, 14);
402 TST(pp[1] * R13 - pp[0] * R23, (
A[0] * Q23 +
A[1] * Q13 +
B[0] * Q32 +
B[1] * Q31), -R23, R13, 0, 15);
436 for (i = 0; i < 3; i++) pa[i] = p1[i];
437 for (j = 0; j < 3; j++)
440 for (i = 0; i < 3; i++) pa[i] +=
sign *
A[j] * R1[i * 4 + j];
445 for (i = 0; i < 3; i++) pb[i] = p2[i];
446 for (j = 0; j < 3; j++)
449 for (i = 0; i < 3; i++) pb[i] +=
sign *
B[j] * R2[i * 4 + j];
454 for (i = 0; i < 3; i++) ua[i] = R1[((code)-7) / 3 + i * 4];
455 for (i = 0; i < 3; i++) ub[i] = R2[((code)-7) % 3 + i * 4];
458 for (i = 0; i < 3; i++) pa[i] += ua[i] * alpha;
459 for (i = 0; i < 3; i++) pb[i] += ub[i] *
beta;
466 #ifdef USE_CENTER_POINT
467 for (i = 0; i < 3; i++)
468 pointInWorld[i] = (pa[i] + pb[i]) *
btScalar(0.5);
484 const btScalar *Ra, *Rb, *pa, *pb, *Sa, *Sb;
563 for (i = 0; i < 3; i++)
center[i] = pb[i] - pa[i] + Sb[lanr] * Rb[i * 4 + lanr];
567 for (i = 0; i < 3; i++)
center[i] = pb[i] - pa[i] - Sb[lanr] * Rb[i * 4 + lanr];
571 int codeN, code1, code2;
594 btScalar c1, c2, m11, m12, m21, m22;
600 m11 =
dDOT44(Ra + code1, Rb + a1);
601 m12 =
dDOT44(Ra + code1, Rb + a2);
602 m21 =
dDOT44(Ra + code2, Rb + a1);
603 m22 =
dDOT44(Ra + code2, Rb + a2);
609 quad[0] = c1 - k1 - k3;
610 quad[1] = c2 - k2 - k4;
611 quad[2] = c1 - k1 + k3;
612 quad[3] = c2 - k2 + k4;
613 quad[4] = c1 + k1 + k3;
614 quad[5] = c2 + k2 + k4;
615 quad[6] = c1 + k1 - k3;
616 quad[7] = c2 + k2 - k4;
635 btScalar det1 = 1.f / (m11 * m22 - m12 * m21);
641 for (j = 0; j < n; j++)
643 btScalar k1 = m22 * (
ret[j * 2] - c1) - m12 * (
ret[j * 2 + 1] - c2);
644 btScalar k2 = -m21 * (
ret[j * 2] - c1) + m11 * (
ret[j * 2 + 1] - c2);
645 for (i = 0; i < 3; i++)
point[cnum * 3 + i] =
646 center[i] + k1 * Rb[i * 4 + a1] + k2 * Rb[i * 4 + a2];
647 dep[cnum] = Sa[codeN] -
dDOT(normal2,
point + cnum * 3);
650 ret[cnum * 2] =
ret[j * 2];
651 ret[cnum * 2 + 1] =
ret[j * 2 + 1];
655 if (cnum < 1)
return 0;
658 if (maxc > cnum) maxc = cnum;
659 if (maxc < 1) maxc = 1;
666 for (j = 0; j < cnum; j++)
669 for (i = 0; i < 3; i++)
670 pointInWorld[i] =
point[j * 3 + i] + pa[i];
677 for (j = 0; j < cnum; j++)
680 for (i = 0; i < 3; i++)
681 pointInWorld[i] =
point[j * 3 + i] + pa[i] -
normal[i] * dep[j];
693 for (i = 1; i < cnum; i++)
695 if (dep[i] > maxdepth)
705 for (j = 0; j < maxc; j++)
712 for (i = 0; i < 3; i++)
713 posInWorld[i] =
point[iret[j] * 3 + i] + pa[i];
716 output.addContactPoint(-
normal, posInWorld, -dep[iret[j]]);
736 dContactGeom* contact = 0;
741 for (
int j = 0; j < 3; j++)
743 R1[0 + 4 * j] = transformA.getBasis()[j].x();
744 R2[0 + 4 * j] = transformB.getBasis()[j].x();
746 R1[1 + 4 * j] = transformA.getBasis()[j].y();
747 R2[1 + 4 * j] = transformB.getBasis()[j].y();
749 R1[2 + 4 * j] = transformA.getBasis()[j].z();
750 R2[2 + 4 * j] = transformB.getBasis()[j].z();
760 2.f *
m_box1->getHalfExtentsWithMargin(),
761 transformB.getOrigin(),
763 2.f *
m_box2->getHalfExtentsWithMargin(),
764 normal, &depth, &return_code,
NSNotificationCenter * center
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint i1
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
ATTR_WARN_UNUSED_RESULT const BMLoop * l
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)
btBoxShape(const btVector3 &boxHalfExtents)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
SIMD_FORCE_INLINE btScalar btFabs(btScalar x)
SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y)
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
IconTextureDrawCall normal
ccl_global float * buffer
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_global KernelShaderEvalInput * input
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt=1)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
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.
ccl_device_inline float beta(float x, float y)