139#define SPLIT (OVER | UNDER)
140#define PAPERWIDTH (btScalar(0.001))
165 for (
int i = 0; i <
convex.vertices.size(); i++)
207 for (
int i = 0; i < count; i++)
281 for (
int i = 0; i < 3; i++)
283 if (a[i] != b[i])
return 0;
297 for (
int i = 0; i < 3; i++)
299 int i1 = (i + 1) % 3;
300 if (
t[i] == a &&
t[
i1] == b)
return 1;
307 return (
t[0] == v ||
t[1] == v ||
t[2] == v);
313 for (i = 0; i < 3; i++)
315 int i1 = (i + 1) % 3;
338 int &
neib(
int a,
int b);
345 for (i = 0; i < 3; i++)
347 int i1 = (i + 1) % 3;
348 int i2 = (i + 2) % 3;
349 if ((*
this)[i] == a && (*this)[
i1] == b)
return n[
i2];
350 if ((*
this)[i] == b && (*this)[
i1] == a)
return n[
i2];
358 for (i = 0; i < 3; i++)
360 int i1 = (i + 1) % 3;
361 int i2 = (i + 2) % 3;
385 for (i = 0; i < 3; i++)
387 int i1 = (i + 1) % 3;
388 int i2 = (i + 2) % 3;
417 tri->~btHullTriangle();
426 ta->n =
int3(
t0->n[0], n + 1, n + 2);
429 tb->n =
int3(
t0->n[1], n + 2, n + 0);
432 tc->n =
int3(
t0->n[2], n + 0, n + 1);
465 return int4(-1, -1, -1, -1);
470 basis[1].normalize();
475 basis[1].normalize();
483 return int4(-1, -1, -1, -1);
489 return int4(-1, -1, -1, -1);
520 if (p.
x == -1)
return 0;
526 t1->
n =
int3(3, 2, 0);
528 t2->
n =
int3(0, 1, 3);
588 if (
t->vmax >= 0)
break;
616 for (
int j = 0;
j < 3;
j++)
624 for (i = 0; i <
ts.size(); i++)
626 tris_out[i] =
static_cast<unsigned int>(
ts[i]);
637 if (!
ret)
return false;
648 if (
result.m_Indices.size())
693 for (
unsigned int i = 0; i <
ovcount; i++)
720 result.mNumIndices =
hr.mIndexCount;
722 result.m_Indices.resize(
static_cast<int>(
hr.mIndexCount));
728 const unsigned int *
source = &
hr.m_Indices[0];
731 for (
unsigned int i = 0; i <
hr.mFaceCount; i++)
742 memcpy(&
result.m_Indices[0], &
hr.m_Indices[0],
sizeof(
unsigned int) *
hr.mIndexCount);
751 result.mNumIndices =
hr.mIndexCount +
hr.mFaceCount;
752 result.m_Indices.resize(
static_cast<int>(
result.mNumIndices));
757 const unsigned int *
source = &
hr.m_Indices[0];
759 for (
unsigned int i = 0; i <
hr.mFaceCount; i++)
789 if (
result.m_OutputVertices.size())
791 result.mNumOutputVertices = 0;
792 result.m_OutputVertices.clear();
794 if (
result.m_Indices.size())
830 if (
svcount == 0)
return false;
834#define EPSILON btScalar(0.000001)
854 for (
unsigned int i = 0; i <
svcount; i++)
860 for (
int j = 0;
j < 3;
j++)
929 center[0] *=
recip[0];
930 center[1] *=
recip[1];
931 center[2] *=
recip[2];
937 for (
unsigned int i = 0; i <
svcount; i++)
1008 for (
unsigned int i = 0; i <
vcount; i++)
1011 for (
int j = 0;
j < 3;
j++)
#define btAlignedFree(ptr)
#define btAlignedAlloc(size, alignment)
ConvexH::HalfEdge HalfEdge
btVector3 ThreePlaneIntersection(const btPlane &p0, const btPlane &p1, const btPlane &p2)
btScalar DistanceBetweenLines(const btVector3 &ustart, const btVector3 &udir, const btVector3 &vstart, const btVector3 &vdir, btVector3 *upoint=NULL, btVector3 *vpoint=NULL)
int maxdirsterid(const T *p, int count, const T &dir, btAlignedObjectArray< int > &allow)
btVector3 PlaneLineIntersection(const btPlane &plane, const btVector3 &p0, const btVector3 &p1)
static void addPoint(unsigned int &vcount, btVector3 *p, btScalar x, btScalar y, btScalar z)
int operator==(const btPlane &a, const btPlane &b)
void ReleaseHull(PHullResult &result)
int hasvert(const int3 &t, int v)
btPlane PlaneFlip(const btPlane &plane)
btVector3 NormalOf(const btVector3 *vert, const int n)
int coplanar(const btPlane &a, const btPlane &b)
btVector3 PlaneProject(const btPlane &plane, const btVector3 &point)
int maxdirfiltered(const T *p, int count, const T &dir, btAlignedObjectArray< int > &allow)
btVector3 TriNormal(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2)
int SplitTest(ConvexH &convex, const btPlane &plane)
int hasedge(const int3 &t, int a, int b)
int above(btVector3 *vertices, const int3 &t, const btVector3 &p, btScalar epsilon)
btScalar planetestepsilon
int PlaneTest(const btPlane &p, const btVector3 &v)
btScalar GetDist(btScalar px, btScalar py, btScalar pz, const btScalar *p2)
int shareedge(const int3 &a, const int3 &b)
btVector3 orth(const btVector3 &v)
const T & btMax(const T &a, const T &b)
btScalar length(const btQuaternion &q)
Return the length of a quaternion.
#define SIMD_RADS_PER_DEG
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScalar btSin(btScalar x)
btScalar btFabs(btScalar x)
btScalar btCos(btScalar x)
btScalar btDot(const btVector3 &v1, const btVector3 &v2)
Return the dot product between two vectors.
btVector3 btCross(const btVector3 &v1, const btVector3 &v2)
Return the cross product of two vectors.
btAlignedObjectArray< HalfEdge > edges
btAlignedObjectArray< btPlane > facets
btAlignedObjectArray< btVector3 > vertices
btHullTriangle * extrudable(btScalar epsilon)
class btHullTriangle * allocateTriangle(int a, int b, int c)
bool ComputeHull(unsigned int vcount, const btVector3 *vertices, PHullResult &result, unsigned int vlimit)
HullError ReleaseResult(HullResult &result)
void BringOutYourDead(const btVector3 *verts, unsigned int vcount, btVector3 *overts, unsigned int &ocount, unsigned int *indices, unsigned indexcount)
HullError CreateConvexHull(const HullDesc &desc, HullResult &result)
void deAllocateTriangle(btHullTriangle *)
int calchull(btVector3 *verts, int verts_count, TUIntArray &tris_out, int &tris_count, int vlimit)
btAlignedObjectArray< int > m_vertexIndexMapping
void b2bfix(btHullTriangle *s, btHullTriangle *t)
void removeb2b(btHullTriangle *s, btHullTriangle *t)
btAlignedObjectArray< class btHullTriangle * > m_tris
void checkit(btHullTriangle *t)
void extrude(class btHullTriangle *t0, int v)
int calchullgen(btVector3 *verts, int verts_count, int vlimit)
int4 FindSimplex(btVector3 *verts, int verts_count, btAlignedObjectArray< int > &allow)
bool CleanupVertices(unsigned int svcount, const btVector3 *svertices, unsigned int stride, unsigned int &vcount, btVector3 *vertices, btScalar normalepsilon, btVector3 &scale)
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
int size() const
return the number of elements in the array
void resize(int newsize, const T &fillData=T())
void push_back(const T &_Val)
btHullTriangle(int a, int b, int c)
btVector3 can be used to represent 3D points and vectors.
const btScalar & getZ() const
Return the z value.
btScalar length() const
Return the length of the vector.
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
btVector3 normalized() const
Return a normalized version of this vector.
const btScalar & getY() const
Return the y value.
const btScalar & getX() const
Return the x value.
int3(int _x, int _y, int _z)
const int & operator[](int i) const