bt -> b3 and BT -> B3 rename for content and filenames
This commit is contained in:
@@ -14,8 +14,8 @@ subject to the following restrictions:
|
||||
|
||||
|
||||
|
||||
#ifndef BT_AABB_UTIL2
|
||||
#define BT_AABB_UTIL2
|
||||
#ifndef B3_AABB_UTIL2
|
||||
#define B3_AABB_UTIL2
|
||||
|
||||
#include "Bullet3Common/b3Transform.h"
|
||||
#include "Bullet3Common/b3Vector3.h"
|
||||
@@ -63,19 +63,19 @@ SIMD_FORCE_INLINE bool TestTriangleAgainstAabb2(const b3Vector3 *vertices,
|
||||
const b3Vector3 &p2 = vertices[1];
|
||||
const b3Vector3 &p3 = vertices[2];
|
||||
|
||||
if (btMin(btMin(p1[0], p2[0]), p3[0]) > aabbMax[0]) return false;
|
||||
if (btMax(btMax(p1[0], p2[0]), p3[0]) < aabbMin[0]) return false;
|
||||
if (b3Min(b3Min(p1[0], p2[0]), p3[0]) > aabbMax[0]) return false;
|
||||
if (b3Max(b3Max(p1[0], p2[0]), p3[0]) < aabbMin[0]) return false;
|
||||
|
||||
if (btMin(btMin(p1[2], p2[2]), p3[2]) > aabbMax[2]) return false;
|
||||
if (btMax(btMax(p1[2], p2[2]), p3[2]) < aabbMin[2]) return false;
|
||||
if (b3Min(b3Min(p1[2], p2[2]), p3[2]) > aabbMax[2]) return false;
|
||||
if (b3Max(b3Max(p1[2], p2[2]), p3[2]) < aabbMin[2]) return false;
|
||||
|
||||
if (btMin(btMin(p1[1], p2[1]), p3[1]) > aabbMax[1]) return false;
|
||||
if (btMax(btMax(p1[1], p2[1]), p3[1]) < aabbMin[1]) return false;
|
||||
if (b3Min(b3Min(p1[1], p2[1]), p3[1]) > aabbMax[1]) return false;
|
||||
if (b3Max(b3Max(p1[1], p2[1]), p3[1]) < aabbMin[1]) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
SIMD_FORCE_INLINE int btOutcode(const b3Vector3& p,const b3Vector3& halfExtent)
|
||||
SIMD_FORCE_INLINE int b3Outcode(const b3Vector3& p,const b3Vector3& halfExtent)
|
||||
{
|
||||
return (p.getX() < -halfExtent.getX() ? 0x01 : 0x0) |
|
||||
(p.getX() > halfExtent.getX() ? 0x08 : 0x0) |
|
||||
@@ -87,7 +87,7 @@ SIMD_FORCE_INLINE int btOutcode(const b3Vector3& p,const b3Vector3& halfExtent)
|
||||
|
||||
|
||||
|
||||
SIMD_FORCE_INLINE bool btRayAabb2(const b3Vector3& rayFrom,
|
||||
SIMD_FORCE_INLINE bool b3RayAabb2(const b3Vector3& rayFrom,
|
||||
const b3Vector3& rayInvDirection,
|
||||
const unsigned int raySign[3],
|
||||
const b3Vector3 bounds[2],
|
||||
@@ -122,7 +122,7 @@ SIMD_FORCE_INLINE bool btRayAabb2(const b3Vector3& rayFrom,
|
||||
return ( (tmin < lambda_max) && (tmax > lambda_min) );
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE bool btRayAabb(const b3Vector3& rayFrom,
|
||||
SIMD_FORCE_INLINE bool b3RayAabb(const b3Vector3& rayFrom,
|
||||
const b3Vector3& rayTo,
|
||||
const b3Vector3& aabbMin,
|
||||
const b3Vector3& aabbMax,
|
||||
@@ -132,8 +132,8 @@ SIMD_FORCE_INLINE bool btRayAabb(const b3Vector3& rayFrom,
|
||||
b3Vector3 aabbCenter = (aabbMax+aabbMin)* b3Scalar(0.5);
|
||||
b3Vector3 source = rayFrom - aabbCenter;
|
||||
b3Vector3 target = rayTo - aabbCenter;
|
||||
int sourceOutcode = btOutcode(source,aabbHalfExtent);
|
||||
int targetOutcode = btOutcode(target,aabbHalfExtent);
|
||||
int sourceOutcode = b3Outcode(source,aabbHalfExtent);
|
||||
int targetOutcode = b3Outcode(target,aabbHalfExtent);
|
||||
if ((sourceOutcode & targetOutcode) == 0x0)
|
||||
{
|
||||
b3Scalar lambda_enter = b3Scalar(0.0);
|
||||
@@ -161,7 +161,7 @@ SIMD_FORCE_INLINE bool btRayAabb(const b3Vector3& rayFrom,
|
||||
else if (targetOutcode & bit)
|
||||
{
|
||||
b3Scalar lambda = (-source[i] - aabbHalfExtent[i]*normSign) / r[i];
|
||||
btSetMin(lambda_exit, lambda);
|
||||
b3SetMin(lambda_exit, lambda);
|
||||
}
|
||||
bit<<=1;
|
||||
}
|
||||
@@ -179,7 +179,7 @@ SIMD_FORCE_INLINE bool btRayAabb(const b3Vector3& rayFrom,
|
||||
|
||||
|
||||
|
||||
SIMD_FORCE_INLINE void btTransformAabb(const b3Vector3& halfExtents, b3Scalar margin,const b3Transform& t,b3Vector3& aabbMinOut,b3Vector3& aabbMaxOut)
|
||||
SIMD_FORCE_INLINE void b3TransformAabb(const b3Vector3& halfExtents, b3Scalar margin,const b3Transform& t,b3Vector3& aabbMinOut,b3Vector3& aabbMaxOut)
|
||||
{
|
||||
b3Vector3 halfExtentsWithMargin = halfExtents+b3Vector3(margin,margin,margin);
|
||||
b3Matrix3x3 abs_b = t.getBasis().absolute();
|
||||
@@ -190,11 +190,11 @@ SIMD_FORCE_INLINE void btTransformAabb(const b3Vector3& halfExtents, b3Scalar ma
|
||||
}
|
||||
|
||||
|
||||
SIMD_FORCE_INLINE void btTransformAabb(const b3Vector3& localAabbMin,const b3Vector3& localAabbMax, b3Scalar margin,const b3Transform& trans,b3Vector3& aabbMinOut,b3Vector3& aabbMaxOut)
|
||||
SIMD_FORCE_INLINE void b3TransformAabb(const b3Vector3& localAabbMin,const b3Vector3& localAabbMax, b3Scalar margin,const b3Transform& trans,b3Vector3& aabbMinOut,b3Vector3& aabbMaxOut)
|
||||
{
|
||||
btAssert(localAabbMin.getX() <= localAabbMax.getX());
|
||||
btAssert(localAabbMin.getY() <= localAabbMax.getY());
|
||||
btAssert(localAabbMin.getZ() <= localAabbMax.getZ());
|
||||
b3Assert(localAabbMin.getX() <= localAabbMax.getX());
|
||||
b3Assert(localAabbMin.getY() <= localAabbMax.getY());
|
||||
b3Assert(localAabbMin.getZ() <= localAabbMax.getZ());
|
||||
b3Vector3 localHalfExtents = b3Scalar(0.5)*(localAabbMax-localAabbMin);
|
||||
localHalfExtents+=b3Vector3(margin,margin,margin);
|
||||
|
||||
@@ -211,7 +211,7 @@ SIMD_FORCE_INLINE void btTransformAabb(const b3Vector3& localAabbMin,const b3Vec
|
||||
//This block replaces the block below and uses no branches, and replaces the 8 bit return with a 32 bit return for improved performance (~3x on XBox 360)
|
||||
SIMD_FORCE_INLINE unsigned testQuantizedAabbAgainstQuantizedAabb(const unsigned short int* aabbMin1,const unsigned short int* aabbMax1,const unsigned short int* aabbMin2,const unsigned short int* aabbMax2)
|
||||
{
|
||||
return static_cast<unsigned int>(btSelect((unsigned)((aabbMin1[0] <= aabbMax2[0]) & (aabbMax1[0] >= aabbMin2[0])
|
||||
return static_cast<unsigned int>(b3Select((unsigned)((aabbMin1[0] <= aabbMax2[0]) & (aabbMax1[0] >= aabbMin2[0])
|
||||
& (aabbMin1[2] <= aabbMax2[2]) & (aabbMax1[2] >= aabbMin2[2])
|
||||
& (aabbMin1[1] <= aabbMax2[1]) & (aabbMax1[1] >= aabbMin2[1])),
|
||||
1, 0));
|
||||
@@ -227,6 +227,6 @@ SIMD_FORCE_INLINE void btTransformAabb(const b3Vector3& localAabbMin,const b3Vec
|
||||
}
|
||||
#endif //USE_BANCHLESS
|
||||
|
||||
#endif //BT_AABB_UTIL2
|
||||
#endif //B3_AABB_UTIL2
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ subject to the following restrictions:
|
||||
|
||||
// Convex hull implementation based on Preparata and Hong
|
||||
// Ole Kniemeyer, MAXON Computer GmbH
|
||||
class btConvexHullInternal
|
||||
class b3ConvexHullInternal
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -495,7 +495,7 @@ class btConvexHullInternal
|
||||
}
|
||||
for (Face* f = src->firstNearbyFace; f; f = f->nextWithSameNearbyVertex)
|
||||
{
|
||||
btAssert(f->nearbyVertex == src);
|
||||
b3Assert(f->nearbyVertex == src);
|
||||
f->nearbyVertex = this;
|
||||
}
|
||||
src->firstNearbyFace = NULL;
|
||||
@@ -525,7 +525,7 @@ class btConvexHullInternal
|
||||
|
||||
void link(Edge* n)
|
||||
{
|
||||
btAssert(reverse->target == n->reverse->target);
|
||||
b3Assert(reverse->target == n->reverse->target);
|
||||
next = n;
|
||||
n->prev = this;
|
||||
}
|
||||
@@ -673,12 +673,12 @@ class btConvexHullInternal
|
||||
|
||||
PoolArray(int size): size(size), next(NULL)
|
||||
{
|
||||
array = (T*) btAlignedAlloc(sizeof(T) * size, 16);
|
||||
array = (T*) b3AlignedAlloc(sizeof(T) * size, 16);
|
||||
}
|
||||
|
||||
~PoolArray()
|
||||
{
|
||||
btAlignedFree(array);
|
||||
b3AlignedFree(array);
|
||||
}
|
||||
|
||||
T* init()
|
||||
@@ -712,7 +712,7 @@ class btConvexHullInternal
|
||||
PoolArray<T>* p = arrays;
|
||||
arrays = p->next;
|
||||
p->~PoolArray<T>();
|
||||
btAlignedFree(p);
|
||||
b3AlignedFree(p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -739,7 +739,7 @@ class btConvexHullInternal
|
||||
}
|
||||
else
|
||||
{
|
||||
p = new(btAlignedAlloc(sizeof(PoolArray<T>), 16)) PoolArray<T>(arraySize);
|
||||
p = new(b3AlignedAlloc(sizeof(PoolArray<T>), 16)) PoolArray<T>(arraySize);
|
||||
p->next = arrays;
|
||||
arrays = p;
|
||||
}
|
||||
@@ -781,7 +781,7 @@ class btConvexHullInternal
|
||||
Edge* n = edge->next;
|
||||
Edge* r = edge->reverse;
|
||||
|
||||
btAssert(edge->target && r->target);
|
||||
b3Assert(edge->target && r->target);
|
||||
|
||||
if (n != edge)
|
||||
{
|
||||
@@ -835,7 +835,7 @@ class btConvexHullInternal
|
||||
};
|
||||
|
||||
|
||||
btConvexHullInternal::Int128 btConvexHullInternal::Int128::operator*(int64_t b) const
|
||||
b3ConvexHullInternal::Int128 b3ConvexHullInternal::Int128::operator*(int64_t b) const
|
||||
{
|
||||
bool negative = (int64_t) high < 0;
|
||||
Int128 a = negative ? -*this : *this;
|
||||
@@ -849,7 +849,7 @@ btConvexHullInternal::Int128 btConvexHullInternal::Int128::operator*(int64_t b)
|
||||
return negative ? -result : result;
|
||||
}
|
||||
|
||||
btConvexHullInternal::Int128 btConvexHullInternal::Int128::mul(int64_t a, int64_t b)
|
||||
b3ConvexHullInternal::Int128 b3ConvexHullInternal::Int128::mul(int64_t a, int64_t b)
|
||||
{
|
||||
Int128 result;
|
||||
|
||||
@@ -876,7 +876,7 @@ btConvexHullInternal::Int128 btConvexHullInternal::Int128::mul(int64_t a, int64_
|
||||
#endif
|
||||
}
|
||||
|
||||
btConvexHullInternal::Int128 btConvexHullInternal::Int128::mul(uint64_t a, uint64_t b)
|
||||
b3ConvexHullInternal::Int128 b3ConvexHullInternal::Int128::mul(uint64_t a, uint64_t b)
|
||||
{
|
||||
Int128 result;
|
||||
|
||||
@@ -893,7 +893,7 @@ btConvexHullInternal::Int128 btConvexHullInternal::Int128::mul(uint64_t a, uint6
|
||||
return result;
|
||||
}
|
||||
|
||||
int btConvexHullInternal::Rational64::compare(const Rational64& b) const
|
||||
int b3ConvexHullInternal::Rational64::compare(const Rational64& b) const
|
||||
{
|
||||
if (sign != b.sign)
|
||||
{
|
||||
@@ -937,7 +937,7 @@ int btConvexHullInternal::Rational64::compare(const Rational64& b) const
|
||||
#endif
|
||||
}
|
||||
|
||||
int btConvexHullInternal::Rational128::compare(const Rational128& b) const
|
||||
int b3ConvexHullInternal::Rational128::compare(const Rational128& b) const
|
||||
{
|
||||
if (sign != b.sign)
|
||||
{
|
||||
@@ -964,7 +964,7 @@ int btConvexHullInternal::Rational128::compare(const Rational128& b) const
|
||||
return nbdLow.ucmp(dbnLow) * sign;
|
||||
}
|
||||
|
||||
int btConvexHullInternal::Rational128::compare(int64_t b) const
|
||||
int b3ConvexHullInternal::Rational128::compare(int64_t b) const
|
||||
{
|
||||
if (isInt64)
|
||||
{
|
||||
@@ -995,9 +995,9 @@ int btConvexHullInternal::Rational128::compare(int64_t b) const
|
||||
}
|
||||
|
||||
|
||||
btConvexHullInternal::Edge* btConvexHullInternal::newEdgePair(Vertex* from, Vertex* to)
|
||||
b3ConvexHullInternal::Edge* b3ConvexHullInternal::newEdgePair(Vertex* from, Vertex* to)
|
||||
{
|
||||
btAssert(from && to);
|
||||
b3Assert(from && to);
|
||||
Edge* e = edgePool.newObject();
|
||||
Edge* r = edgePool.newObject();
|
||||
e->reverse = r;
|
||||
@@ -1016,22 +1016,22 @@ btConvexHullInternal::Edge* btConvexHullInternal::newEdgePair(Vertex* from, Vert
|
||||
return e;
|
||||
}
|
||||
|
||||
bool btConvexHullInternal::mergeProjection(IntermediateHull& h0, IntermediateHull& h1, Vertex*& c0, Vertex*& c1)
|
||||
bool b3ConvexHullInternal::mergeProjection(IntermediateHull& h0, IntermediateHull& h1, Vertex*& c0, Vertex*& c1)
|
||||
{
|
||||
Vertex* v0 = h0.maxYx;
|
||||
Vertex* v1 = h1.minYx;
|
||||
if ((v0->point.x == v1->point.x) && (v0->point.y == v1->point.y))
|
||||
{
|
||||
btAssert(v0->point.z < v1->point.z);
|
||||
b3Assert(v0->point.z < v1->point.z);
|
||||
Vertex* v1p = v1->prev;
|
||||
if (v1p == v1)
|
||||
{
|
||||
c0 = v0;
|
||||
if (v1->edges)
|
||||
{
|
||||
btAssert(v1->edges->next == v1->edges);
|
||||
b3Assert(v1->edges->next == v1->edges);
|
||||
v1 = v1->edges->target;
|
||||
btAssert(v1->edges->next == v1->edges);
|
||||
b3Assert(v1->edges->next == v1->edges);
|
||||
}
|
||||
c1 = v1;
|
||||
return false;
|
||||
@@ -1201,7 +1201,7 @@ bool btConvexHullInternal::mergeProjection(IntermediateHull& h0, IntermediateHul
|
||||
return true;
|
||||
}
|
||||
|
||||
void btConvexHullInternal::computeInternal(int start, int end, IntermediateHull& result)
|
||||
void b3ConvexHullInternal::computeInternal(int start, int end, IntermediateHull& result)
|
||||
{
|
||||
int n = end - start;
|
||||
switch (n)
|
||||
@@ -1229,7 +1229,7 @@ void btConvexHullInternal::computeInternal(int start, int end, IntermediateHull&
|
||||
w = v;
|
||||
v = t;
|
||||
}
|
||||
btAssert(v->point.z < w->point.z);
|
||||
b3Assert(v->point.z < w->point.z);
|
||||
v->next = v;
|
||||
v->prev = v;
|
||||
result.minXy = v;
|
||||
@@ -1318,7 +1318,7 @@ void btConvexHullInternal::computeInternal(int start, int end, IntermediateHull&
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CONVEX_HULL
|
||||
void btConvexHullInternal::IntermediateHull::print()
|
||||
void b3ConvexHullInternal::IntermediateHull::print()
|
||||
{
|
||||
printf(" Hull\n");
|
||||
for (Vertex* v = minXy; v; )
|
||||
@@ -1355,7 +1355,7 @@ void btConvexHullInternal::IntermediateHull::print()
|
||||
}
|
||||
}
|
||||
|
||||
void btConvexHullInternal::Vertex::printGraph()
|
||||
void b3ConvexHullInternal::Vertex::printGraph()
|
||||
{
|
||||
print();
|
||||
printf("\nEdges\n");
|
||||
@@ -1382,18 +1382,18 @@ void btConvexHullInternal::Vertex::printGraph()
|
||||
}
|
||||
#endif
|
||||
|
||||
btConvexHullInternal::Orientation btConvexHullInternal::getOrientation(const Edge* prev, const Edge* next, const Point32& s, const Point32& t)
|
||||
b3ConvexHullInternal::Orientation b3ConvexHullInternal::getOrientation(const Edge* prev, const Edge* next, const Point32& s, const Point32& t)
|
||||
{
|
||||
btAssert(prev->reverse->target == next->reverse->target);
|
||||
b3Assert(prev->reverse->target == next->reverse->target);
|
||||
if (prev->next == next)
|
||||
{
|
||||
if (prev->prev == next)
|
||||
{
|
||||
Point64 n = t.cross(s);
|
||||
Point64 m = (*prev->target - *next->reverse->target).cross(*next->target - *next->reverse->target);
|
||||
btAssert(!m.isZero());
|
||||
b3Assert(!m.isZero());
|
||||
int64_t dot = n.dot(m);
|
||||
btAssert(dot != 0);
|
||||
b3Assert(dot != 0);
|
||||
return (dot > 0) ? COUNTER_CLOCKWISE : CLOCKWISE;
|
||||
}
|
||||
return COUNTER_CLOCKWISE;
|
||||
@@ -1408,7 +1408,7 @@ btConvexHullInternal::Orientation btConvexHullInternal::getOrientation(const Edg
|
||||
}
|
||||
}
|
||||
|
||||
btConvexHullInternal::Edge* btConvexHullInternal::findMaxAngle(bool ccw, const Vertex* start, const Point32& s, const Point64& rxs, const Point64& sxrxs, Rational64& minCot)
|
||||
b3ConvexHullInternal::Edge* b3ConvexHullInternal::findMaxAngle(bool ccw, const Vertex* start, const Point32& s, const Point64& rxs, const Point64& sxrxs, Rational64& minCot)
|
||||
{
|
||||
Edge* minEdge = NULL;
|
||||
|
||||
@@ -1425,12 +1425,12 @@ btConvexHullInternal::Edge* btConvexHullInternal::findMaxAngle(bool ccw, const V
|
||||
Point32 t = *e->target - *start;
|
||||
Rational64 cot(t.dot(sxrxs), t.dot(rxs));
|
||||
#ifdef DEBUG_CONVEX_HULL
|
||||
printf(" Angle is %f (%d) for ", (float) btAtan(cot.toScalar()), (int) cot.isNaN());
|
||||
printf(" Angle is %f (%d) for ", (float) b3Atan(cot.toScalar()), (int) cot.isNaN());
|
||||
e->print();
|
||||
#endif
|
||||
if (cot.isNaN())
|
||||
{
|
||||
btAssert(ccw ? (t.dot(s) < 0) : (t.dot(s) > 0));
|
||||
b3Assert(ccw ? (t.dot(s) < 0) : (t.dot(s) > 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1460,7 +1460,7 @@ btConvexHullInternal::Edge* btConvexHullInternal::findMaxAngle(bool ccw, const V
|
||||
return minEdge;
|
||||
}
|
||||
|
||||
void btConvexHullInternal::findEdgeForCoplanarFaces(Vertex* c0, Vertex* c1, Edge*& e0, Edge*& e1, Vertex* stop0, Vertex* stop1)
|
||||
void b3ConvexHullInternal::findEdgeForCoplanarFaces(Vertex* c0, Vertex* c1, Edge*& e0, Edge*& e1, Vertex* stop0, Vertex* stop1)
|
||||
{
|
||||
Edge* start0 = e0;
|
||||
Edge* start1 = e1;
|
||||
@@ -1469,9 +1469,9 @@ void btConvexHullInternal::findEdgeForCoplanarFaces(Vertex* c0, Vertex* c1, Edge
|
||||
Point32 s = c1->point - c0->point;
|
||||
Point64 normal = ((start0 ? start0 : start1)->target->point - c0->point).cross(s);
|
||||
int64_t dist = c0->point.dot(normal);
|
||||
btAssert(!start1 || (start1->target->point.dot(normal) == dist));
|
||||
b3Assert(!start1 || (start1->target->point.dot(normal) == dist));
|
||||
Point64 perp = s.cross(normal);
|
||||
btAssert(!perp.isZero());
|
||||
b3Assert(!perp.isZero());
|
||||
|
||||
#ifdef DEBUG_CONVEX_HULL
|
||||
printf(" Advancing %d %d (%p %p, %d %d)\n", c0->point.index, c1->point.index, start0, start1, start0 ? start0->target->point.index : -1, start1 ? start1->target->point.index : -1);
|
||||
@@ -1487,7 +1487,7 @@ void btConvexHullInternal::findEdgeForCoplanarFaces(Vertex* c0, Vertex* c1, Edge
|
||||
{
|
||||
break;
|
||||
}
|
||||
btAssert(e->target->point.dot(normal) == dist);
|
||||
b3Assert(e->target->point.dot(normal) == dist);
|
||||
if (e->copy == mergeStamp)
|
||||
{
|
||||
break;
|
||||
@@ -1513,7 +1513,7 @@ void btConvexHullInternal::findEdgeForCoplanarFaces(Vertex* c0, Vertex* c1, Edge
|
||||
{
|
||||
break;
|
||||
}
|
||||
btAssert(e->target->point.dot(normal) == dist);
|
||||
b3Assert(e->target->point.dot(normal) == dist);
|
||||
if (e->copy == mergeStamp)
|
||||
{
|
||||
break;
|
||||
@@ -1578,7 +1578,7 @@ void btConvexHullInternal::findEdgeForCoplanarFaces(Vertex* c0, Vertex* c1, Edge
|
||||
}
|
||||
else
|
||||
{
|
||||
btAssert((e1 == start1) && (d1.dot(normal) < 0));
|
||||
b3Assert((e1 == start1) && (d1.dot(normal) < 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1630,7 +1630,7 @@ void btConvexHullInternal::findEdgeForCoplanarFaces(Vertex* c0, Vertex* c1, Edge
|
||||
}
|
||||
else
|
||||
{
|
||||
btAssert((e0 == start0) && (d0.dot(normal) < 0));
|
||||
b3Assert((e0 == start0) && (d0.dot(normal) < 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1644,7 +1644,7 @@ void btConvexHullInternal::findEdgeForCoplanarFaces(Vertex* c0, Vertex* c1, Edge
|
||||
}
|
||||
|
||||
|
||||
void btConvexHullInternal::merge(IntermediateHull& h0, IntermediateHull& h1)
|
||||
void b3ConvexHullInternal::merge(IntermediateHull& h0, IntermediateHull& h1)
|
||||
{
|
||||
if (!h1.maxXy)
|
||||
{
|
||||
@@ -1675,7 +1675,7 @@ void btConvexHullInternal::merge(IntermediateHull& h0, IntermediateHull& h1)
|
||||
Point32 s = *c1 - *c0;
|
||||
Point64 normal = Point32(0, 0, -1).cross(s);
|
||||
Point64 t = s.cross(normal);
|
||||
btAssert(!t.isZero());
|
||||
b3Assert(!t.isZero());
|
||||
|
||||
Edge* e = c0->edges;
|
||||
Edge* start0 = NULL;
|
||||
@@ -1684,7 +1684,7 @@ void btConvexHullInternal::merge(IntermediateHull& h0, IntermediateHull& h1)
|
||||
do
|
||||
{
|
||||
int64_t dot = (*e->target - *c0).dot(normal);
|
||||
btAssert(dot <= 0);
|
||||
b3Assert(dot <= 0);
|
||||
if ((dot == 0) && ((*e->target - *c0).dot(t) > 0))
|
||||
{
|
||||
if (!start0 || (getOrientation(start0, e, s, Point32(0, 0, -1)) == CLOCKWISE))
|
||||
@@ -1703,7 +1703,7 @@ void btConvexHullInternal::merge(IntermediateHull& h0, IntermediateHull& h1)
|
||||
do
|
||||
{
|
||||
int64_t dot = (*e->target - *c1).dot(normal);
|
||||
btAssert(dot <= 0);
|
||||
b3Assert(dot <= 0);
|
||||
if ((dot == 0) && ((*e->target - *c1).dot(t) > 0))
|
||||
{
|
||||
if (!start1 || (getOrientation(start1, e, s, Point32(0, 0, -1)) == COUNTER_CLOCKWISE))
|
||||
@@ -1932,12 +1932,12 @@ void btConvexHullInternal::merge(IntermediateHull& h0, IntermediateHull& h1)
|
||||
}
|
||||
|
||||
|
||||
static bool pointCmp(const btConvexHullInternal::Point32& p, const btConvexHullInternal::Point32& q)
|
||||
static bool pointCmp(const b3ConvexHullInternal::Point32& p, const b3ConvexHullInternal::Point32& q)
|
||||
{
|
||||
return (p.y < q.y) || ((p.y == q.y) && ((p.x < q.x) || ((p.x == q.x) && (p.z < q.z))));
|
||||
}
|
||||
|
||||
void btConvexHullInternal::compute(const void* coords, bool doubleCoords, int stride, int count)
|
||||
void b3ConvexHullInternal::compute(const void* coords, bool doubleCoords, int stride, int count)
|
||||
{
|
||||
b3Vector3 min(b3Scalar(1e30), b3Scalar(1e30), b3Scalar(1e30)), max(b3Scalar(-1e30), b3Scalar(-1e30), b3Scalar(-1e30));
|
||||
const char* ptr = (const char*) coords;
|
||||
@@ -2058,7 +2058,7 @@ void btConvexHullInternal::compute(const void* coords, bool doubleCoords, int st
|
||||
#endif
|
||||
}
|
||||
|
||||
b3Vector3 btConvexHullInternal::toBtVector(const Point32& v)
|
||||
b3Vector3 b3ConvexHullInternal::toBtVector(const Point32& v)
|
||||
{
|
||||
b3Vector3 p;
|
||||
p[medAxis] = b3Scalar(v.x);
|
||||
@@ -2067,12 +2067,12 @@ b3Vector3 btConvexHullInternal::toBtVector(const Point32& v)
|
||||
return p * scaling;
|
||||
}
|
||||
|
||||
b3Vector3 btConvexHullInternal::getBtNormal(Face* face)
|
||||
b3Vector3 b3ConvexHullInternal::getBtNormal(Face* face)
|
||||
{
|
||||
return toBtVector(face->dir0).cross(toBtVector(face->dir1)).normalized();
|
||||
}
|
||||
|
||||
b3Vector3 btConvexHullInternal::getCoordinates(const Vertex* v)
|
||||
b3Vector3 b3ConvexHullInternal::getCoordinates(const Vertex* v)
|
||||
{
|
||||
b3Vector3 p;
|
||||
p[medAxis] = v->xvalue();
|
||||
@@ -2081,7 +2081,7 @@ b3Vector3 btConvexHullInternal::getCoordinates(const Vertex* v)
|
||||
return p * scaling + center;
|
||||
}
|
||||
|
||||
b3Scalar btConvexHullInternal::shrink(b3Scalar amount, b3Scalar clampAmount)
|
||||
b3Scalar b3ConvexHullInternal::shrink(b3Scalar amount, b3Scalar clampAmount)
|
||||
{
|
||||
if (!vertexList)
|
||||
{
|
||||
@@ -2127,7 +2127,7 @@ b3Scalar btConvexHullInternal::shrink(b3Scalar amount, b3Scalar clampAmount)
|
||||
if (a && b)
|
||||
{
|
||||
int64_t vol = (v->point - ref).dot((a->point - ref).cross(b->point - ref));
|
||||
btAssert(vol >= 0);
|
||||
b3Assert(vol >= 0);
|
||||
Point32 c = v->point + a->point + b->point + ref;
|
||||
hullCenterX += vol * c.x;
|
||||
hullCenterY += vol * c.y;
|
||||
@@ -2135,7 +2135,7 @@ b3Scalar btConvexHullInternal::shrink(b3Scalar amount, b3Scalar clampAmount)
|
||||
volume += vol;
|
||||
}
|
||||
|
||||
btAssert(f->copy != stamp);
|
||||
b3Assert(f->copy != stamp);
|
||||
f->copy = stamp;
|
||||
f->face = face;
|
||||
|
||||
@@ -2182,13 +2182,13 @@ b3Scalar btConvexHullInternal::shrink(b3Scalar amount, b3Scalar clampAmount)
|
||||
return 0;
|
||||
}
|
||||
|
||||
amount = btMin(amount, minDist * clampAmount);
|
||||
amount = b3Min(amount, minDist * clampAmount);
|
||||
}
|
||||
|
||||
unsigned int seed = 243703;
|
||||
for (int i = 0; i < faceCount; i++, seed = 1664525 * seed + 1013904223)
|
||||
{
|
||||
btSwap(faces[i], faces[seed % faceCount]);
|
||||
b3Swap(faces[i], faces[seed % faceCount]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < faceCount; i++)
|
||||
@@ -2202,7 +2202,7 @@ b3Scalar btConvexHullInternal::shrink(b3Scalar amount, b3Scalar clampAmount)
|
||||
return amount;
|
||||
}
|
||||
|
||||
bool btConvexHullInternal::shiftFace(Face* face, b3Scalar amount, b3AlignedObjectArray<Vertex*> stack)
|
||||
bool b3ConvexHullInternal::shiftFace(Face* face, b3Scalar amount, b3AlignedObjectArray<Vertex*> stack)
|
||||
{
|
||||
b3Vector3 origShift = getBtNormal(face) * -amount;
|
||||
if (scaling[0] != 0)
|
||||
@@ -2230,7 +2230,7 @@ bool btConvexHullInternal::shiftFace(Face* face, b3Scalar amount, b3AlignedObjec
|
||||
int64_t origDot = face->origin.dot(normal);
|
||||
Point32 shiftedOrigin = face->origin + shift;
|
||||
int64_t shiftedDot = shiftedOrigin.dot(normal);
|
||||
btAssert(shiftedDot <= origDot);
|
||||
b3Assert(shiftedDot <= origDot);
|
||||
if (shiftedDot >= origDot)
|
||||
{
|
||||
return false;
|
||||
@@ -2258,7 +2258,7 @@ bool btConvexHullInternal::shiftFace(Face* face, b3Scalar amount, b3AlignedObjec
|
||||
n++;
|
||||
#endif
|
||||
Rational128 dot = e->target->dot(normal);
|
||||
btAssert(dot.compare(origDot) <= 0);
|
||||
b3Assert(dot.compare(origDot) <= 0);
|
||||
#ifdef DEBUG_CONVEX_HULL
|
||||
printf("Moving downwards, edge is ");
|
||||
e->print();
|
||||
@@ -2294,7 +2294,7 @@ bool btConvexHullInternal::shiftFace(Face* face, b3Scalar amount, b3AlignedObjec
|
||||
n++;
|
||||
#endif
|
||||
Rational128 dot = e->target->dot(normal);
|
||||
btAssert(dot.compare(origDot) <= 0);
|
||||
b3Assert(dot.compare(origDot) <= 0);
|
||||
#ifdef DEBUG_CONVEX_HULL
|
||||
printf("Moving upwards, edge is ");
|
||||
e->print();
|
||||
@@ -2426,7 +2426,7 @@ bool btConvexHullInternal::shiftFace(Face* face, b3Scalar amount, b3AlignedObjec
|
||||
n++;
|
||||
#endif
|
||||
e = e->reverse->prev;
|
||||
btAssert(e != intersection->reverse);
|
||||
b3Assert(e != intersection->reverse);
|
||||
cmp = e->target->dot(normal).compare(shiftedDot);
|
||||
#ifdef DEBUG_CONVEX_HULL
|
||||
printf("Testing edge ");
|
||||
@@ -2470,7 +2470,7 @@ bool btConvexHullInternal::shiftFace(Face* face, b3Scalar amount, b3AlignedObjec
|
||||
int64_t r0 = (intersection->face->origin - shiftedOrigin).dot(n0);
|
||||
int64_t r1 = (intersection->reverse->face->origin - shiftedOrigin).dot(n1);
|
||||
Int128 det = Int128::mul(m00, m11) - Int128::mul(m01, m10);
|
||||
btAssert(det.getSign() != 0);
|
||||
b3Assert(det.getSign() != 0);
|
||||
Vertex* v = vertexPool.newObject();
|
||||
v->point.index = -1;
|
||||
v->copy = -1;
|
||||
@@ -2568,7 +2568,7 @@ bool btConvexHullInternal::shiftFace(Face* face, b3Scalar amount, b3AlignedObjec
|
||||
stack.push_back(NULL);
|
||||
}
|
||||
|
||||
btAssert(stack.size() > 0);
|
||||
b3Assert(stack.size() > 0);
|
||||
vertexList = stack[0];
|
||||
|
||||
#ifdef DEBUG_CONVEX_HULL
|
||||
@@ -2623,7 +2623,7 @@ bool btConvexHullInternal::shiftFace(Face* face, b3Scalar amount, b3AlignedObjec
|
||||
}
|
||||
|
||||
|
||||
static int getVertexCopy(btConvexHullInternal::Vertex* vertex, b3AlignedObjectArray<btConvexHullInternal::Vertex*>& vertices)
|
||||
static int getVertexCopy(b3ConvexHullInternal::Vertex* vertex, b3AlignedObjectArray<b3ConvexHullInternal::Vertex*>& vertices)
|
||||
{
|
||||
int index = vertex->copy;
|
||||
if (index < 0)
|
||||
@@ -2648,7 +2648,7 @@ b3Scalar b3ConvexHullComputer::compute(const void* coords, bool doubleCoords, in
|
||||
return 0;
|
||||
}
|
||||
|
||||
btConvexHullInternal hull;
|
||||
b3ConvexHullInternal hull;
|
||||
hull.compute(coords, doubleCoords, stride, count);
|
||||
|
||||
b3Scalar shift = 0;
|
||||
@@ -2664,19 +2664,19 @@ b3Scalar b3ConvexHullComputer::compute(const void* coords, bool doubleCoords, in
|
||||
edges.resize(0);
|
||||
faces.resize(0);
|
||||
|
||||
b3AlignedObjectArray<btConvexHullInternal::Vertex*> oldVertices;
|
||||
b3AlignedObjectArray<b3ConvexHullInternal::Vertex*> oldVertices;
|
||||
getVertexCopy(hull.vertexList, oldVertices);
|
||||
int copied = 0;
|
||||
while (copied < oldVertices.size())
|
||||
{
|
||||
btConvexHullInternal::Vertex* v = oldVertices[copied];
|
||||
b3ConvexHullInternal::Vertex* v = oldVertices[copied];
|
||||
vertices.push_back(hull.getCoordinates(v));
|
||||
btConvexHullInternal::Edge* firstEdge = v->edges;
|
||||
b3ConvexHullInternal::Edge* firstEdge = v->edges;
|
||||
if (firstEdge)
|
||||
{
|
||||
int firstCopy = -1;
|
||||
int prevCopy = -1;
|
||||
btConvexHullInternal::Edge* e = firstEdge;
|
||||
b3ConvexHullInternal::Edge* e = firstEdge;
|
||||
do
|
||||
{
|
||||
if (e->copy < 0)
|
||||
@@ -2714,11 +2714,11 @@ b3Scalar b3ConvexHullComputer::compute(const void* coords, bool doubleCoords, in
|
||||
|
||||
for (int i = 0; i < copied; i++)
|
||||
{
|
||||
btConvexHullInternal::Vertex* v = oldVertices[i];
|
||||
btConvexHullInternal::Edge* firstEdge = v->edges;
|
||||
b3ConvexHullInternal::Vertex* v = oldVertices[i];
|
||||
b3ConvexHullInternal::Edge* firstEdge = v->edges;
|
||||
if (firstEdge)
|
||||
{
|
||||
btConvexHullInternal::Edge* e = firstEdge;
|
||||
b3ConvexHullInternal::Edge* e = firstEdge;
|
||||
do
|
||||
{
|
||||
if (e->copy >= 0)
|
||||
@@ -2727,7 +2727,7 @@ b3Scalar b3ConvexHullComputer::compute(const void* coords, bool doubleCoords, in
|
||||
printf("Vertex *%d has edge to *%d\n", i, edges[e->copy].getTargetVertex());
|
||||
#endif
|
||||
faces.push_back(e->copy);
|
||||
btConvexHullInternal::Edge* f = e;
|
||||
b3ConvexHullInternal::Edge* f = e;
|
||||
do
|
||||
{
|
||||
#ifdef DEBUG_CONVEX_HULL
|
||||
|
||||
@@ -12,8 +12,8 @@ subject to the following restrictions:
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef BT_CONVEX_HULL_COMPUTER_H
|
||||
#define BT_CONVEX_HULL_COMPUTER_H
|
||||
#ifndef B3_CONVEX_HULL_COMPUTER_H
|
||||
#define B3_CONVEX_HULL_COMPUTER_H
|
||||
|
||||
#include "Bullet3Common/b3Vector3.h"
|
||||
#include "Bullet3Common/b3AlignedObjectArray.h"
|
||||
@@ -99,5 +99,5 @@ class b3ConvexHullComputer
|
||||
};
|
||||
|
||||
|
||||
#endif //BT_CONVEX_HULL_COMPUTER_H
|
||||
#endif //B3_CONVEX_HULL_COMPUTER_H
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ subject to the following restrictions:
|
||||
*/
|
||||
extern "C"
|
||||
{
|
||||
void btBulletMathProbe ();
|
||||
void b3BulletMathProbe ();
|
||||
|
||||
void btBulletMathProbe () {}
|
||||
void b3BulletMathProbe () {}
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ void b3GeometryUtil::getVerticesFromPlaneEquations(const b3AlignedObjectArray<b3
|
||||
|
||||
|
||||
b3Scalar quotient = (N1.dot(n2n3));
|
||||
if (btFabs(quotient) > b3Scalar(0.000001))
|
||||
if (b3Fabs(quotient) > b3Scalar(0.000001))
|
||||
{
|
||||
quotient = b3Scalar(-1.) / quotient;
|
||||
n2n3 *= N1[3];
|
||||
|
||||
@@ -13,8 +13,8 @@ subject to the following restrictions:
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BT_GEOMETRY_UTIL_H
|
||||
#define BT_GEOMETRY_UTIL_H
|
||||
#ifndef B3_GEOMETRY_UTIL_H
|
||||
#define B3_GEOMETRY_UTIL_H
|
||||
|
||||
#include "Bullet3Common/b3Vector3.h"
|
||||
#include "Bullet3Common/b3AlignedObjectArray.h"
|
||||
@@ -38,5 +38,5 @@ class b3GeometryUtil
|
||||
};
|
||||
|
||||
|
||||
#endif //BT_GEOMETRY_UTIL_H
|
||||
#endif //B3_GEOMETRY_UTIL_H
|
||||
|
||||
|
||||
@@ -33,9 +33,9 @@ struct GrahamVector3 : public b3Vector3
|
||||
};
|
||||
|
||||
|
||||
struct btAngleCompareFunc {
|
||||
struct b3AngleCompareFunc {
|
||||
b3Vector3 m_anchor;
|
||||
btAngleCompareFunc(const b3Vector3& anchor)
|
||||
b3AngleCompareFunc(const b3Vector3& anchor)
|
||||
: m_anchor(anchor)
|
||||
{
|
||||
}
|
||||
@@ -59,7 +59,7 @@ struct btAngleCompareFunc {
|
||||
inline void GrahamScanConvexHull2D(b3AlignedObjectArray<GrahamVector3>& originalPoints, b3AlignedObjectArray<GrahamVector3>& hull, const b3Vector3& normalAxis)
|
||||
{
|
||||
b3Vector3 axis0,axis1;
|
||||
btPlaneSpace1(normalAxis,axis0,axis1);
|
||||
b3PlaneSpace1(normalAxis,axis0,axis1);
|
||||
|
||||
|
||||
if (originalPoints.size()<=1)
|
||||
@@ -87,11 +87,11 @@ inline void GrahamScanConvexHull2D(b3AlignedObjectArray<GrahamVector3>& original
|
||||
{
|
||||
b3Vector3 xvec = axis0;
|
||||
b3Vector3 ar = originalPoints[i]-originalPoints[0];
|
||||
originalPoints[i].m_angle = btCross(xvec, ar).dot(normalAxis) / ar.length();
|
||||
originalPoints[i].m_angle = b3Cross(xvec, ar).dot(normalAxis) / ar.length();
|
||||
}
|
||||
|
||||
//step 2: sort all points, based on 'angle' with this anchor
|
||||
btAngleCompareFunc comp(originalPoints[0]);
|
||||
b3AngleCompareFunc comp(originalPoints[0]);
|
||||
originalPoints.quickSortInternal(comp,1,originalPoints.size()-1);
|
||||
|
||||
int i;
|
||||
@@ -105,7 +105,7 @@ inline void GrahamScanConvexHull2D(b3AlignedObjectArray<GrahamVector3>& original
|
||||
while (!isConvex&& hull.size()>1) {
|
||||
b3Vector3& a = hull[hull.size()-2];
|
||||
b3Vector3& b = hull[hull.size()-1];
|
||||
isConvex = btCross(a-b,a-originalPoints[i]).dot(normalAxis)> 0;
|
||||
isConvex = b3Cross(a-b,a-originalPoints[i]).dot(normalAxis)> 0;
|
||||
if (!isConvex)
|
||||
hull.pop_back();
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user