25 template <
typename InputType,
typename ComputeType>
34 inline std::array<int, 3>
const&
GetSupport()
const;
61 template <
typename InputType,
typename ComputeType>
65 if (numPoints >= 1 && points)
68 std::function<Circle2<ComputeType>(
int)> update[4];
74 std::vector<int> permuted(numPoints);
75 for (
int i = 0; i < numPoints; ++i)
79 std::sort(permuted.begin(), permuted.end(),
80 [
points](
int i0,
int i1) {
return points[i0] < points[i1]; });
81 auto end = std::unique(permuted.begin(), permuted.end(),
82 [
points](
int i0,
int i1) {
return points[i0] == points[i1]; });
83 permuted.erase(end, permuted.end());
84 numPoints =
static_cast<int>(permuted.size());
87 std::shuffle(permuted.begin(), permuted.end(),
88 std::default_random_engine());
93 for (
int i = 0; i < numPoints; ++i)
95 for (
int j = 0; j < 2; ++j)
115 for (
int i = 1 % numPoints,
n = 0; i !=
n; i = (i + 1) % numPoints)
131 for (
int j = 0; j < 2; ++j)
133 minimal.
center[j] =
static_cast<InputType
>(ctMinimal.
center[j]);
135 minimal.
radius =
static_cast<InputType
>(ctMinimal.
radius);
146 LogError(
"Input must contain points.");
148 minimal.
radius = std::numeric_limits<InputType>::max();
153 template <
typename InputType,
typename ComputeType>
inline 159 template <
typename InputType,
typename ComputeType>
inline 160 std::array<int, 3>
const&
166 template <
typename InputType,
typename ComputeType>
175 template <
typename InputType,
typename ComputeType>
181 minimal.
radius = (ComputeType)0;
185 template <
typename InputType,
typename ComputeType>
193 minimal.
center = ((ComputeType)0.5)*(P0 + P1);
194 minimal.
radius = ((ComputeType)0.25)*
Dot(diff, diff);
198 template <
typename InputType,
typename ComputeType>
233 A(0, 0) =
Dot(E0, E0);
234 A(0, 1) =
Dot(E0, E1);
236 A(1, 1) =
Dot(E1, E1);
238 ComputeType
const half = (ComputeType)0.5;
245 ComputeType
x2 = (ComputeType)1 - X[0] - X[1];
246 minimal.
center = X[0] * P0 + X[1] * P1 + x2 *P2;
253 minimal.
radius = (ComputeType)std::numeric_limits<InputType>::max();
259 template <
typename InputType,
typename ComputeType>
269 template <
typename InputType,
typename ComputeType>
274 int const numType2 = 2;
275 int const type2[numType2][2] =
282 int const numType3 = 1;
285 ComputeType minRSqr = (ComputeType)std::numeric_limits<InputType>::max();
286 int iCircle = 0, iMinRSqr = -1;
290 for (
int j = 0; j < numType2; ++j, ++iCircle)
294 if (circle[iCircle].radius < minRSqr)
299 minRSqr = circle[iCircle].
radius;
309 if (circle[iCircle].radius < minRSqr)
311 minRSqr = circle[iCircle].
radius;
337 return circle[iMinRSqr];
340 template <
typename InputType,
typename ComputeType>
345 int const numType2 = 3;
346 int const type2[numType2][3] =
354 int const numType3 = 3;
355 int const type3[numType3][3] =
363 ComputeType minRSqr = (ComputeType)std::numeric_limits<InputType>::max();
364 int iCircle = 0, iMinRSqr = -1;
368 for (
int j = 0; j < numType2; ++j, ++iCircle)
372 if (circle[iCircle].radius < minRSqr)
379 minRSqr = circle[iCircle].
radius;
386 for (
int j = 0; j < numType3; ++j, ++iCircle)
391 if (circle[iCircle].radius < minRSqr)
396 minRSqr = circle[iCircle].
radius;
436 return circle[iMinRSqr];
439 template <
typename InputType,
typename ComputeType>
Circle2< ComputeType > UpdateSupport1(int i)
Circle2< ComputeType > UpdateSupport2(int i)
int GetNumSupport() const
std::array< int, 3 > const & GetSupport() const
Circle2< ComputeType > ExactCircle2(int i0, int i1) const
Circle2< ComputeType > ExactCircle3(int i0, int i1, int i2) const
bool Contains(int i, Circle2< ComputeType > const &circle) const
bool SupportContains(int j) const
GLfixed GLfixed GLint GLint GLfixed points
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
#define LogError(message)
Circle2< ComputeType > ExactCircle1(int i0) const
std::array< int, 3 > mSupport
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
std::vector< Vector2< ComputeType > > mComputePoints
Circle2< ComputeType > UpdateSupport3(int i)
bool operator()(int numPoints, Vector2< InputType > const *points, Circle2< InputType > &minimal)