Back to class index
Sphere[Class Summary]
pos
r
ctor (+4 overloads)
Translate(offset)
Transform(transform) (+3 overloads)
MinimalEnclosingAABB()[const]
MaximalContainedAABB()[const]
SetNegativeInfinity()
Volume()[const]
SurfaceArea()[const]
Diameter()[const]
Centroid()[const]
AnyPointFast()[const]
ExtremePoint(direction)[const] (+1 overload)
ProjectToAxis(...)[const]
IsFinite()[const]
IsDegenerate()[const]
SetDegenerate()
Contains(point)[const] (+11 overloads)
Distance(point)[const] (+9 overloads)
MaxDistance(point)[const]
ClosestPoint(point)[const]
Intersects(...)[const] (+11 overloads)
Enclose(point,epsilon) (+10 overloads)
ExtendRadiusToContain(point,epsilon) (+1 overload)
RandomPointInside(lcg)
RandomPointOnSurface(lcg)
Triangulate(...)[const]
ToString()[const]
SerializeToString()[const]
SerializeToCodeString()[const]
Equals(rhs,epsilon)[const]
BitEquals(other)[const]
FastEnclosingSphere(...)[static]
OptimalEnclosingSphere(...)[static] (+4 overloads)
FitThroughPoints(a,b)[static] (+2 overloads)
RandomPointInside(lcg,center,radius)[static]
RandomPointOnSurface(lcg,center,radius)[static]
RandomUnitaryFloat3(lcg)[static]
IntersectLine(...)[static]
FromString(str,outEndStr)[static] (+1 overload)

Sphere::OptimalEnclosingSphere

Syntax

Sphere Sphere::OptimalEnclosingSphere(const float4 *pointArray, int numPoints); [58 lines of code]

Computes the minimal bounding sphere for the given point array.

This function implements Emo Welzl's optimal enclosing sphere algorithm. See "Smallest enclosing disks (balls and ellipsoids)", Lecture Notes in Computer Science 555 (1991) pp. 359-370. The running time is expected linear time, but compared to Ritter's algorithm (the FastEnclosingSphere() function), this algorithm is considerably slower. The implementation of this function is based on the book Geometric Tools for Computer Graphics, pp. 807-813, by Schneider and Eberly.

Parameters

const float4 *pointArrayAn array of points to compute an enclosing sphere for. This pointer must not be null. intnumPointsThe number of elements in the input array pointArray.

See Also

FastEnclosingSphere().

Syntax

Sphere Sphere::OptimalEnclosingSphere(const float4 &a, const float4 &b); [16 lines of code]

Computes the minimal bounding sphere for two points.

This function computes the smallest volume sphere that contains the given two points. For two points, the OptimalEnclosingSphere(a, b) is the same as calling FitThroughPoints(a, b).

See Also

FitThroughPoints().

Syntax

Sphere Sphere::OptimalEnclosingSphere(const float4 &a, const float4 &b, const float4 &c); [64 lines of code]

Computes the minimal bounding sphere for three points.

For reference, see http://realtimecollisiondetection.net/blog/?p=20 .

This function computes the smallest volume sphere that contains the given three points. The smallest enclosing sphere may not pass through all the three points that are specified.

Syntax

Sphere Sphere::OptimalEnclosingSphere(const float4 &a, const float4 &b, const float4 &c, const float4 &d); [68 lines of code]

Computes the minimal bounding sphere for four points.

For reference, see http://realtimecollisiondetection.net/blog/?p=20 .

This function computes the smallest volume sphere that contains the given four points. The smallest enclosing sphere may not pass through all the four points that are specified.

Syntax

Sphere Sphere::OptimalEnclosingSphere(const float4 &a, const float4 &b, const float4 &c, const float4 &d, const float4 &e, int &redundantPoint); [32 lines of code]

Computes the minimal bounding sphere for four points.

This function computes the smallest volume sphere that contains the given five points.

Parameters

int &redundantPoint [out]Since a sphere is characterized by four points, one of the given points will necessarily be redundant and not part of the support set of the minimal enclosing sphere. This parameter will receive the index [0, 4] of the five input points denoting which point became redundant. (Note that there may be more than one point not lying on the support set of the sphere, but this function only returns one)

Return Value

The smallest volume sphere that encloses the given five points.