16 #ifndef GRAHAM_SCAN_2D_CONVEX_HULL_H
17 #define GRAHAM_SCAN_2D_CONVEX_HULL_H
42 if (
a.m_angle !=
b.m_angle)
43 return a.m_angle <
b.m_angle;
52 return a.m_orgIndex <
b.m_orgIndex;
63 if (originalPoints.
size() <= 1)
65 for (
int i = 0; i < originalPoints.
size(); i++)
70 for (
int i = 0; i < originalPoints.
size(); i++)
74 btScalar projL = originalPoints[i].dot(axis0);
75 btScalar projR = originalPoints[0].dot(axis0);
78 originalPoints.
swap(0, i);
83 originalPoints[0].m_angle = -1e30f;
84 for (
int i = 1; i < originalPoints.
size(); i++)
86 btVector3 ar = originalPoints[i] - originalPoints[0];
89 if (ar1 * ar1 + ar0 * ar0 < FLT_EPSILON)
91 originalPoints[i].m_angle = 0.0f;
104 for (i = 0; i < 2; i++)
108 for (; i != originalPoints.
size(); i++)
122 if (hull.
size() == 1)
SIMD_FORCE_INLINE bool isConvex() const
void GrahamScanConvexHull2D(btAlignedObjectArray< GrahamVector3 > &originalPoints, btAlignedObjectArray< GrahamVector3 > &hull, const btVector3 &normalAxis)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
SIMD_FORCE_INLINE btScalar btAtan2Fast(btScalar y, btScalar x)
SIMD_FORCE_INLINE void btPlaneSpace1(const T &n, T &p, T &q)
SIMD_FORCE_INLINE btScalar length2() const
Return the length of the vector squared.
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
SIMD_FORCE_INLINE btVector3 btCross(const btVector3 &v1, const btVector3 &v2)
Return the cross product of two vectors.
SIMD_FORCE_INLINE int size() const
return the number of elements in the array
void swap(int index0, int index1)
SIMD_FORCE_INLINE void pop_back()
SIMD_FORCE_INLINE void push_back(const T &_Val)
void quickSortInternal(const L &CompareFunc, int lo, int hi)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
GrahamVector3(const btVector3 &org, int orgIndex)
bool operator()(const GrahamVector3 &a, const GrahamVector3 &b) const
btAngleCompareFunc(const btVector3 &anchor)