39 template <
typename InputType,
typename ComputeType>
71 inline std::vector<int>
const&
GetHull()
const;
76 void Merge(
int j0,
int j1,
int j2,
int j3,
int& i0,
int& i1);
77 void GetTangent(
int j0,
int j1,
int j2,
int j3,
int& i0,
int& i1);
103 template <
typename InputType,
typename ComputeType>
115 template <
typename InputType,
typename ComputeType>
119 mEpsilon = std::max(epsilon, (InputType)0);
158 for (j = 0; j < 2; ++j)
165 mHull.resize(mNumPoints);
173 if (points[i0][0] < points[i1][0]) {
return true; }
174 if (points[i0][0] > points[i1][0]) {
return false; }
175 return points[i0][1] < points[i1][1];
180 auto newEnd = std::unique(
mHull.begin(),
mHull.end(),
183 return points[i0] == points[i1];
194 mHull.resize(i1 - i0 + 1);
198 template <
typename InputType,
typename ComputeType>
inline 204 template <
typename InputType,
typename ComputeType>
inline 210 template <
typename InputType,
typename ComputeType>
inline 216 template <
typename InputType,
typename ComputeType>
inline 222 template <
typename InputType,
typename ComputeType>
inline 228 template <
typename InputType,
typename ComputeType>
inline 234 template <
typename InputType,
typename ComputeType>
inline 240 template <
typename InputType,
typename ComputeType>
inline 246 template <
typename InputType,
typename ComputeType>
inline 249 int numVertices = i1 - i0 + 1;
253 int mid = (i0 + i1) / 2;
256 int j0 = i0, j1 = mid, j2 = mid + 1, j3 = i1;
261 Merge(j0, j1, j2, j3, i0, i1);
266 template <
typename InputType,
typename ComputeType>
inline 273 int size0 = j1 - j0 + 1;
274 int size1 = j3 - j2 + 1;
282 for (i = j0 + 1; i <= j1; ++i)
295 for (i = j2 + 1; i <= j3; ++i)
306 int iLL = imax0, iLR = imin1;
310 int iUL = imax0, iUR = imin1;
318 for (k = 0; k < size0; ++k)
320 mMerged[numMerged++] = mHull[i];
325 i = (i < j1 ? i + 1 : j0);
327 LogAssert(k < size0,
"Unexpected condition.");
330 for (k = 0; k < size1; ++k)
332 mMerged[numMerged++] = mHull[i];
337 i = (i < j3 ? i + 1 : j2);
339 LogAssert(k < size1,
"Unexpected condition.");
342 for (k = 0; k < numMerged; ++k)
352 template <
typename InputType,
typename ComputeType>
inline 360 int size0 = j1 - j0 + 1;
361 int size1 = j3 - j2 + 1;
362 int const imax = size0 + size1;
366 for (i = 0; i < imax; i++)
375 iLm1 = (i0 > j0 ? i0 - 1 : j1);
389 iRp1 = (i1 < j3 ? i1 + 1 : j2);
405 LogAssert(i < imax,
"Unexpected condition.");
GLfixed GLfixed GLint GLint order
std::vector< int > const & GetHull() const
OrderType ToLineExtended(Vector2< Real > const &P, Vector2< Real > const &Q0, Vector2< Real > const &Q1) const
PrimalQuery2< ComputeType > mQuery
void Set(int numVertices, Vector2< Real > const *vertices)
Vector2< InputType > const * mPoints
#define LogAssert(condition, message)
bool operator()(int numPoints, Vector2< InputType > const *points, InputType epsilon)
PrimalQuery2< ComputeType > const & GetQuery() const
Line2< InputType > const & GetLine() const
int GetNumUniquePoints() const
void Merge(int j0, int j1, int j2, int j3, int &i0, int &i1)
std::vector< Vector2< ComputeType > > mComputePoints
void GetTangent(int j0, int j1, int j2, int j3, int &i0, int &i1)
GLfixed GLfixed GLint GLint GLfixed points
InputType GetEpsilon() const
std::vector< int > mMerged
Vector2< InputType > const * GetPoints() const
Vector2< Real > direction[2]