#include <string.h>
#include "btAlignedObjectArray.h"
#include "btConvexHullComputer.h"
#include "btMinMax.h"
#include "btVector3.h"
#ifdef __GNUC__
#include <stdint.h>
#elif defined(_MSC_VER)
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#else
typedef int32_t int32_t;
typedef long long int32_t int64_t;
typedef uint32_t uint32_t;
typedef unsigned long long int32_t uint64_t;
#endif
#ifdef _MSC_VER
#pragma warning(disable:4458)
#endif
#if defined(DEBUG_CONVEX_HULL) || defined(SHOW_ITERATIONS)
#include <stdio.h>
#endif
namespace VHACD {
class btConvexHullInternal { … };
btConvexHullInternal::Int128 btConvexHullInternal::Int128::operator*(int64_t b) const
{ … }
btConvexHullInternal::Int128 btConvexHullInternal::Int128::mul(int64_t a, int64_t b)
{ … }
btConvexHullInternal::Int128 btConvexHullInternal::Int128::mul(uint64_t a, uint64_t b)
{ … }
int32_t btConvexHullInternal::Rational64::compare(const Rational64& b) const
{ … }
int32_t btConvexHullInternal::Rational128::compare(const Rational128& b) const
{ … }
int32_t btConvexHullInternal::Rational128::compare(int64_t b) const
{ … }
btConvexHullInternal::Edge* btConvexHullInternal::newEdgePair(Vertex* from, Vertex* to)
{ … }
bool btConvexHullInternal::mergeProjection(IntermediateHull& h0, IntermediateHull& h1, Vertex*& c0, Vertex*& c1)
{ … }
void btConvexHullInternal::computeInternal(int32_t start, int32_t end, IntermediateHull& result)
{ … }
#ifdef DEBUG_CONVEX_HULL
void btConvexHullInternal::IntermediateHull::print()
{
printf(" Hull\n");
for (Vertex* v = minXy; v;) {
printf(" ");
v->print();
if (v == maxXy) {
printf(" maxXy");
}
if (v == minYx) {
printf(" minYx");
}
if (v == maxYx) {
printf(" maxYx");
}
if (v->next->prev != v) {
printf(" Inconsistency");
}
printf("\n");
v = v->next;
if (v == minXy) {
break;
}
}
if (minXy) {
minXy->copy = (minXy->copy == -1) ? -2 : -1;
minXy->printGraph();
}
}
void btConvexHullInternal::Vertex::printGraph()
{
print();
printf("\nEdges\n");
Edge* e = edges;
if (e) {
do {
e->print();
printf("\n");
e = e->next;
} while (e != edges);
do {
Vertex* v = e->target;
if (v->copy != copy) {
v->copy = copy;
v->printGraph();
}
e = e->next;
} while (e != edges);
}
}
#endif
btConvexHullInternal::Orientation btConvexHullInternal::getOrientation(const Edge* prev, const Edge* next, const Point32& s, const Point32& t)
{ … }
btConvexHullInternal::Edge* btConvexHullInternal::findMaxAngle(bool ccw, const Vertex* start, const Point32& s, const Point64& rxs, const Point64& sxrxs, Rational64& minCot)
{ … }
void btConvexHullInternal::findEdgeForCoplanarFaces(Vertex* c0, Vertex* c1, Edge*& e0, Edge*& e1, Vertex* stop0, Vertex* stop1)
{ … }
void btConvexHullInternal::merge(IntermediateHull& h0, IntermediateHull& h1)
{ … }
static bool pointCmp(const btConvexHullInternal::Point32& p, const btConvexHullInternal::Point32& q)
{ … }
void btConvexHullInternal::compute(const void* coords, bool doubleCoords, int32_t stride, int32_t count)
{ … }
btVector3 btConvexHullInternal::toBtVector(const Point32& v)
{ … }
btVector3 btConvexHullInternal::getBtNormal(Face* face)
{ … }
btVector3 btConvexHullInternal::getCoordinates(const Vertex* v)
{ … }
btScalar btConvexHullInternal::shrink(btScalar amount, btScalar clampAmount)
{ … }
bool btConvexHullInternal::shiftFace(Face* face, btScalar amount, btAlignedObjectArray<Vertex*> stack)
{ … }
static int32_t getVertexCopy(btConvexHullInternal::Vertex* vertex, btAlignedObjectArray<btConvexHullInternal::Vertex*>& vertices)
{ … }
btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, int32_t stride, int32_t count, btScalar shrink, btScalar shrinkClamp)
{ … }
};