30 template <
typename Real>
35 unsigned int maxIterations,
bool initialCenterIsAverage,
40 template <
typename Real>
47 for (
int i = 1; i < numPoints; ++i)
51 Real invNumPoints = ((Real)1) /
static_cast<Real
>(numPoints);
52 average *= invNumPoints;
55 if (initialCenterIsAverage)
64 unsigned int iteration;
65 for (iteration = 0; iteration < maxIterations; ++iteration)
71 Real lenAverage = (Real)0;
73 for (
int i = 0; i < numPoints; ++i)
80 Real invLength = ((Real)1) /
length;
81 derLenAverage -= invLength * diff;
84 lenAverage *= invNumPoints;
85 derLenAverage *= invNumPoints;
87 sphere.
center = average + lenAverage * derLenAverage;
88 sphere.
radius = lenAverage;
GLfixed GLfixed GLint GLint GLfixed points
unsigned int operator()(int numPoints, Vector3< Real > const *points, unsigned int maxIterations, bool initialCenterIsAverage, Sphere3< Real > &sphere)
GLuint GLsizei GLsizei * length
DualQuaternion< Real > Length(DualQuaternion< Real > const &d, bool robust=false)