23 template <
typename Real>
40 template <
typename Real>
50 template <
typename Real>
55 Real covar00 = (Real)0, covar01 = (Real)0, covar02 = (Real)0;
56 Real covar11 = (Real)0, covar12 = (Real)0, covar22 = (Real)0;
57 for (
int i = 0; i < numPoints; i++)
60 covar00 += diff[0] * diff[0];
61 covar01 += diff[0] * diff[1];
62 covar02 += diff[0] * diff[2];
63 covar11 += diff[1] * diff[1];
64 covar12 += diff[1] * diff[2];
65 covar22 += diff[2] * diff[2];
68 Real invNumPoints = ((Real)1) /
static_cast<Real
>(numPoints);
69 covar00 *= invNumPoints;
70 covar01 *= invNumPoints;
71 covar02 *= invNumPoints;
72 covar11 *= invNumPoints;
73 covar12 *= invNumPoints;
74 covar22 *= invNumPoints;
78 std::array<Real, 3> eval;
79 std::array<std::array<Real, 3>, 3> evec;
80 es(covar00, covar01, covar02, covar11, covar12, covar22,
false, +1,
85 template <
typename Real>
102 std::vector<std::array<Real, 3>> items(numPoints);
103 for (
int i = 0; i < numPoints; ++i)
105 items[i][0] =
Dot(basis[1], points[i]);
106 items[i][1] =
Dot(basis[2], points[i]);
107 items[i][2] = atan2(items[i][1], items[i][0]);
109 std::sort(items.begin(), items.end(),
110 [](std::array<Real, 3>
const& item0, std::array<Real, 3>
const& item1)
112 return item0[2] < item1[2];
119 int numPointsM1 = numPoints - 1;
120 Real maxDiff = (Real)
GTE_C_TWO_PI + items[0][2] - items[numPointsM1][2];
121 int end0 = 0, end1 = numPointsM1;
122 for (
int i0 = 0, i1 = 1; i0 < numPointsM1; i0 = i1++)
124 Real diff = items[i1][2] - items[i0][2];
134 arcEnd0 = items[end0][0] * basis[1] + items[end0][1] * basis[2];
135 arcEnd1 = items[end1][0] * basis[1] + items[end1][1] * basis[2];
void operator()(int numPoints, Vector3< Real > const *points, Vector3< Real > &normal)
GLfixed GLfixed GLint GLint GLfixed points
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
Real Normalize(GVector< Real > &v, bool robust=false)
Real ComputeOrthogonalComplement(int numInputs, Vector2< Real > *v, bool robust=false)
void operator()(int numPoints, Vector3< Real > const *points, Vector3< Real > &normal, Vector3< Real > &arcEnd0, Vector3< Real > &arcEnd1)