Simbody  3.6
SimTK::Geo::Point_< P > Class Template Reference

A 3d point primitive represented by a Vec3 from the origin of an unspecified frame, and a collection of point-related utility methods. More...

Public Member Functions

 Point_ ()
 Construct an uninitialized Point object; the location will be garbage. More...
 
 Point_ (const Vec3P &location)
 Construct a Point with the given location. Also serves as implicit conversion from Vec3 to Geo::Point. More...
 
Point_setLocation (const Vec3P &location)
 Change the location of this point. More...
 
const Vec3PgetLocation () const
 Get the location of this Point. More...
 
RealP calcDistance (const Vec3P &p2) const
 Calculate the distance between this point and another one whose location is expressed in the same frame (expensive). More...
 
RealP findDistanceSqr (const Vec3P &p2) const
 Find the square of the distance between this point and another one whose location is expressed in the same frame (cheap). More...
 

Static Public Member Functions

Miscellaneous point-related utilities

These static methods work with points or collections of points.

Collections of points are represented either as an Array of point locations or as an indirect Array of pointers to point locations, which can save a lot of copying for large point sets.

static RealP calcDistance (const Vec3P &p1, const Vec3P &p2)
 Calculate the distance between two points (expensive). More...
 
static RealP findDistanceSqr (const Vec3P &p1, const Vec3P &p2)
 Find the square of the distance between two points (cheap). More...
 
static Vec3P findMidpoint (const Vec3P &p1, const Vec3P &p2)
 Find the point midway between two points. More...
 
static bool pointsAreNumericallyCoincident (const Vec3P &p1, const Vec3P &p2)
 Determine whether two points whose locations are known to an accuracy tol are numerically indistinguishable. More...
 
static bool pointsAreNumericallyCoincident (const Vec3P &p1, const Vec3P &p2, RealP tol)
 Alternate signature with explicitly-supplied tolerance. More...
 
static void findSupportPoint (const Array_< Vec3P > &points, const UnitVec3P &direction, int &most, RealP &mostCoord)
 Given a set of points, find the one that is the furthest in a given direction, and return its index and location along that direction. More...
 
static void findSupportPointIndirect (const Array_< const Vec3P *> &points, const UnitVec3P &direction, int &most, RealP &mostCoord)
 Alternate signature taking an array of pointers to points rather than the points themselves. More...
 
static void findExtremePoints (const Array_< Vec3P > &points, const UnitVec3P &direction, int &least, int &most, RealP &leastCoord, RealP &mostCoord)
 Given a set of points, find the two points that are the most extreme along a given direction (not necessarily distinct), and return their indices and locations along the given direction. More...
 
static void findExtremePointsIndirect (const Array_< const Vec3P *> &points, const UnitVec3P &direction, int &least, int &most, RealP &leastCoord, RealP &mostCoord)
 Alternate signature taking an array of pointers to points rather than the points themselves. More...
 
static Vec3P calcCentroid (const Array_< Vec3P > &points_F)
 Given a set of points, calculate the centroid (average location) of those points. More...
 
static Vec3P calcCentroidIndirect (const Array_< const Vec3P *> &points_F)
 Alternate signature taking an array of pointers to points rather than the points themselves. More...
 
static void calcCovariance (const Array_< Vec3P > &points_F, Vec3P &centroid, SymMat33P &covariance)
 Given a set of points, calculate the centroid (average location) and covariance matrix of those points. More...
 
static void calcCovarianceIndirect (const Array_< const Vec3P *> &points_F, Vec3P &centroid, SymMat33P &covariance)
 Alternate signature taking an array of pointers to points rather than the points themselves. More...
 
static void calcPrincipalComponents (const Array_< Vec3P > &points_F, TransformP &X_FP)
 Given a set of points in an unspecified frame F, find the principal component directions describing the distribution of the points in space. More...
 
static void calcPrincipalComponentsIndirect (const Array_< const Vec3P *> &points_F, TransformP &X_FP)
 Alternate signature taking an array of pointers to points rather than the points themselves. More...
 
Axis-aligned bounding box creation

These static methods create a minimal axis-aligned box that includes all of a set of given points.

static void findAxisAlignedExtremePoints (const Array_< Vec3P > &points, int least[3], int most[3], Vec3P &low, Vec3P &high)
 Given a set of points, find the six points that are the most extreme along the axial directions (not necessarily distinct points). More...
 
static void findAxisAlignedExtremePointsIndirect (const Array_< const Vec3P *> &points, int least[3], int most[3], Vec3P &low, Vec3P &high)
 Alternate signature taking an array of pointers to points rather than the points themselves. More...
 
static Geo::AlignedBox_< P > calcAxisAlignedBoundingBox (const Array_< Vec3P > &points, Array_< int > &support)
 Calculate the smallest axis-aligned bounding box including all n given points. More...
 
static Geo::AlignedBox_< P > calcAxisAlignedBoundingBox (const Array_< Vec3P > &points)
 Alternate signature doesn't return support points. More...
 
static Geo::AlignedBox_< P > calcAxisAlignedBoundingBoxIndirect (const Array_< const Vec3P *> &points, Array_< int > &support)
 Alternate signature taking an array of pointers to points rather than the points themselves. More...
 
static Geo::AlignedBox_< P > calcAxisAlignedBoundingBoxIndirect (const Array_< const Vec3P *> &points)
 Alternate signature doesn't return support points. More...
 
Oriented bounding box creation

These static methods create a tight-fitting oriented bounding box (OBB) that includes all of a set of given points.

The OBB is not guaranteed to be minimal but will usually be very good. You can optionally obtain the set of support points that determined the size of the box.

static void findOrientedExtremePoints (const Array_< Vec3P > &points_F, const RotationP &R_FB, int least[3], int most[3], Vec3P &low_B, Vec3P &high_B)
 Given a set of points, find the six points that are the most extreme along specified orientation directions (not necessarily distinct points). More...
 
static void findOrientedExtremePointsIndirect (const Array_< const Vec3P *> &points_F, const RotationP &R_FB, int least[3], int most[3], Vec3P &low_B, Vec3P &high_B)
 Alternate signature taking an array of pointers to points rather than the points themselves. More...
 
static Geo::OrientedBox_< P > calcOrientedBoundingBox (const Array_< Vec3P > &points, Array_< int > &support, bool optimize=true)
 Calculate a tight-fitting oriented bounding box (OBB) that includes all n given points. More...
 
static Geo::OrientedBox_< P > calcOrientedBoundingBox (const Array_< Vec3P > &points)
 Alternate signature doesn't return support points. More...
 
static Geo::OrientedBox_< P > calcOrientedBoundingBoxIndirect (const Array_< const Vec3P *> &points, Array_< int > &support, bool optimize=true)
 Alternate signature taking an array of pointers to points rather than the points themselves. More...
 
static Geo::OrientedBox_< P > calcOrientedBoundingBoxIndirect (const Array_< const Vec3P *> &points, bool optimize=true)
 Alternate signature doesn't return support points. More...
 
Sphere-related utilities

These static methods work with spheres or collections of spheres.

Bounding spheres

Bounding sphere methods calculate the smallest sphere around a given set of points such that no point is outside the sphere, although some may be on its surface. How many and specifically which points were actually used to define the sphere can be returned; there will never be more than 4. This information is primarily used to construct bounding sphere algorithms; users normally just need the sphere so can use the simpler signatures.

Bounding sphere methods address roundoff by stretching the sphere enough to guarantee that all points are strictly inside the sphere and that later tests can produce only false positives not false negatives which might cause a contact to be missed. To do that we have to account not just for machine precision, but for relative errors caused by spheres of large radius or spheres that are located far from the origin. These adjustments ensure that if a test point appears numerically to be outside the sphere, it really cannot contact anything that is inside the sphere.

We use a bounding sphere method due originally to Emo Welzl that computes a near-perfect minimal bounding sphere around a set of points with expected O(n) run time. Our implementation has been extensively modified to deal with singular cases so you do not have to precondition the points before asking for their bounding sphere.

We also provide a conventional fast and dumb approximate bounding sphere using Ritter's method as described in Christer Ericson's book. This is mostly useful for testing the Welzl method's accuracy and performance and should not generally be used. A Welzl bounding sphere should never be larger than a Ritter sphere and should normally be substantially smaller.

static Sphere_< P > calcBoundingSphere (const Vec3P &p)
 Create a tiny bounding sphere around a single point. More...
 
static Sphere_< P > calcBoundingSphere (const Vec3P &p0, const Vec3P &p1)
 Create a minimal bounding sphere around two points. More...
 
static Sphere_< P > calcBoundingSphere (const Vec3P &p0, const Vec3P &p1, const Vec3P &p2)
 Create a minimal bounding sphere around three points. More...
 
static Sphere_< P > calcBoundingSphere (const Vec3P &p0, const Vec3P &p1, const Vec3P &p2, const Vec3P &p3)
 Create a minimal bounding sphere around four points. More...
 
static Sphere_< P > calcBoundingSphere (const Array_< Vec3P > &points)
 Create a minimal bounding sphere around a collection of n points. More...
 
static Sphere_< P > calcBoundingSphere (const std::vector< Vec3P > &points)
 This signature takes an std::vector rather than a SimTK::Array_; no extra copying is required. More...
 
static Sphere_< P > calcBoundingSphereIndirect (const Array_< const Vec3P *> &points)
 Create a minimal bounding sphere around a collection of n points, given indirectly as an array of pointers. More...
 
static Sphere_< P > calcBoundingSphere (const std::vector< const Vec3P *> &points)
 This signature takes an std::vector rather than a SimTK::Array_; no extra copying is required. More...
 
static Sphere_< P > calcBoundingSphere (const Vec3P &p0, Array_< int > &which)
 Create one-point bounding sphere and return the (trivial) support point, of which there is always one. More...
 
static Sphere_< P > calcBoundingSphere (const Vec3P &p0, const Vec3P &p1, Array_< int > &which)
 Create a minimum sphere around two points. More...
 
static Sphere_< P > calcBoundingSphere (const Vec3P &p0, const Vec3P &p1, const Vec3P &p2, bool forceCircumsphere, Array_< int > &which)
 Create a minimum sphere around three points. More...
 
static Sphere_< P > calcBoundingSphere (const Vec3P &p0, const Vec3P &p1, const Vec3P &p2, const Vec3P &p3, bool forceCircumsphere, Array_< int > &which)
 Create a minimum sphere around four points. More...
 
static Sphere_< P > calcBoundingSphere (const Array_< Vec3P > &points, Array_< int > &which)
 Create an optimal minimum sphere around a collection of n points. More...
 
static Sphere_< P > calcBoundingSphereIndirect (const Array_< const Vec3P *> &points, Array_< int > &which)
 Alternate signature works with an array of pointers to points. More...
 
static Sphere_< P > calcApproxBoundingSphere (const Array_< Vec3P > &points)
 Calculate an approximate bounding sphere. You should normally use calcBoundingSphere() which will give a smaller sphere. More...
 
static Sphere_< P > calcApproxBoundingSphere (const std::vector< Vec3P > &points)
 This signature takes an std::vector rather than a SimTK::Array_; no extra copying is required. More...
 
static Sphere_< P > calcApproxBoundingSphereIndirect (const Array_< const Vec3P *> &points)
 Alternate signature works with an array of pointers to points. More...
 
static Sphere_< P > calcApproxBoundingSphereIndirect (const std::vector< const Vec3P *> &points)
 This signature takes an std::vector rather than a SimTK::Array_; no extra copying is required. More...
 

Detailed Description

template<class P>
class SimTK::Geo::Point_< P >

A 3d point primitive represented by a Vec3 from the origin of an unspecified frame, and a collection of point-related utility methods.

Constructor & Destructor Documentation

◆ Point_() [1/2]

template<class P >
SimTK::Geo::Point_< P >::Point_ ( )
inline

Construct an uninitialized Point object; the location will be garbage.

◆ Point_() [2/2]

template<class P >
SimTK::Geo::Point_< P >::Point_ ( const Vec3P location)
inline

Construct a Point with the given location. Also serves as implicit conversion from Vec3 to Geo::Point.

Member Function Documentation

◆ setLocation()

template<class P >
Point_& SimTK::Geo::Point_< P >::setLocation ( const Vec3P location)
inline

Change the location of this point.

◆ getLocation()

template<class P >
const Vec3P& SimTK::Geo::Point_< P >::getLocation ( ) const
inline

Get the location of this Point.

◆ calcDistance() [1/2]

template<class P >
RealP SimTK::Geo::Point_< P >::calcDistance ( const Vec3P p2) const
inline

Calculate the distance between this point and another one whose location is expressed in the same frame (expensive).

Cost is about 30 flops.

◆ findDistanceSqr() [1/2]

template<class P >
RealP SimTK::Geo::Point_< P >::findDistanceSqr ( const Vec3P p2) const
inline

Find the square of the distance between this point and another one whose location is expressed in the same frame (cheap).

Cost is 8 flops.

◆ calcDistance() [2/2]

template<class P >
static RealP SimTK::Geo::Point_< P >::calcDistance ( const Vec3P p1,
const Vec3P p2 
)
inlinestatic

Calculate the distance between two points (expensive).

Cost is about 30 flops.

◆ findDistanceSqr() [2/2]

template<class P >
static RealP SimTK::Geo::Point_< P >::findDistanceSqr ( const Vec3P p1,
const Vec3P p2 
)
inlinestatic

Find the square of the distance between two points (cheap).

Cost is 8 flops.

◆ findMidpoint()

template<class P >
static Vec3P SimTK::Geo::Point_< P >::findMidpoint ( const Vec3P p1,
const Vec3P p2 
)
inlinestatic

Find the point midway between two points.

Cost is 4 flops.

◆ pointsAreNumericallyCoincident() [1/2]

template<class P >
static bool SimTK::Geo::Point_< P >::pointsAreNumericallyCoincident ( const Vec3P p1,
const Vec3P p2 
)
inlinestatic

Determine whether two points whose locations are known to an accuracy tol are numerically indistinguishable.

We define this to mean that they are so close that a perturbation of their measure numbers by no more than tol could make them coincident. If a measure number has value x, we define a tol-sized perturbation to be max(tol, |x|*tol). We use the default tolerance if none is supplied. Cost is about 20 flops.

See also
Geo::getDefaultTol()

◆ pointsAreNumericallyCoincident() [2/2]

template<class P >
static bool SimTK::Geo::Point_< P >::pointsAreNumericallyCoincident ( const Vec3P p1,
const Vec3P p2,
RealP  tol 
)
inlinestatic

Alternate signature with explicitly-supplied tolerance.

◆ findSupportPoint()

template<class P >
static void SimTK::Geo::Point_< P >::findSupportPoint ( const Array_< Vec3P > &  points,
const UnitVec3P direction,
int &  most,
RealP &  mostCoord 
)
static

Given a set of points, find the one that is the furthest in a given direction, and return its index and location along that direction.

There must be at least one point in the set.

◆ findSupportPointIndirect()

template<class P >
static void SimTK::Geo::Point_< P >::findSupportPointIndirect ( const Array_< const Vec3P *> &  points,
const UnitVec3P direction,
int &  most,
RealP &  mostCoord 
)
static

Alternate signature taking an array of pointers to points rather than the points themselves.

◆ findExtremePoints()

template<class P >
static void SimTK::Geo::Point_< P >::findExtremePoints ( const Array_< Vec3P > &  points,
const UnitVec3P direction,
int &  least,
int &  most,
RealP &  leastCoord,
RealP &  mostCoord 
)
static

Given a set of points, find the two points that are the most extreme along a given direction (not necessarily distinct), and return their indices and locations along the given direction.

There must be at least one point in the set.

◆ findExtremePointsIndirect()

template<class P >
static void SimTK::Geo::Point_< P >::findExtremePointsIndirect ( const Array_< const Vec3P *> &  points,
const UnitVec3P direction,
int &  least,
int &  most,
RealP &  leastCoord,
RealP &  mostCoord 
)
static

Alternate signature taking an array of pointers to points rather than the points themselves.

◆ calcCentroid()

template<class P >
static Vec3P SimTK::Geo::Point_< P >::calcCentroid ( const Array_< Vec3P > &  points_F)
static

Given a set of points, calculate the centroid (average location) of those points.

Cost is about 3*n+10 flops for n points.

◆ calcCentroidIndirect()

template<class P >
static Vec3P SimTK::Geo::Point_< P >::calcCentroidIndirect ( const Array_< const Vec3P *> &  points_F)
static

Alternate signature taking an array of pointers to points rather than the points themselves.

◆ calcCovariance()

template<class P >
static void SimTK::Geo::Point_< P >::calcCovariance ( const Array_< Vec3P > &  points_F,
Vec3P centroid,
SymMat33P covariance 
)
static

Given a set of points, calculate the centroid (average location) and covariance matrix of those points.

◆ calcCovarianceIndirect()

template<class P >
static void SimTK::Geo::Point_< P >::calcCovarianceIndirect ( const Array_< const Vec3P *> &  points_F,
Vec3P centroid,
SymMat33P covariance 
)
static

Alternate signature taking an array of pointers to points rather than the points themselves.

◆ calcPrincipalComponents()

template<class P >
static void SimTK::Geo::Point_< P >::calcPrincipalComponents ( const Array_< Vec3P > &  points_F,
TransformP X_FP 
)
static

Given a set of points in an unspecified frame F, find the principal component directions describing the distribution of the points in space.

The result is a frame P with origin at the centroid, x axis along the direction of maximum dispersion, y axis along the direction of minimum dispersion, and z=x X y. Note that clustering of points affects the directions.

◆ calcPrincipalComponentsIndirect()

template<class P >
static void SimTK::Geo::Point_< P >::calcPrincipalComponentsIndirect ( const Array_< const Vec3P *> &  points_F,
TransformP X_FP 
)
static

Alternate signature taking an array of pointers to points rather than the points themselves.

◆ findAxisAlignedExtremePoints()

template<class P >
static void SimTK::Geo::Point_< P >::findAxisAlignedExtremePoints ( const Array_< Vec3P > &  points,
int  least[3],
int  most[3],
Vec3P low,
Vec3P high 
)
static

Given a set of points, find the six points that are the most extreme along the axial directions (not necessarily distinct points).

Return the indices of the extreme points and the locations of the box corners. Note that the corners do not necessarily correspond to any points in the set. There must be at least one point in the set.

◆ findAxisAlignedExtremePointsIndirect()

template<class P >
static void SimTK::Geo::Point_< P >::findAxisAlignedExtremePointsIndirect ( const Array_< const Vec3P *> &  points,
int  least[3],
int  most[3],
Vec3P low,
Vec3P high 
)
static

Alternate signature taking an array of pointers to points rather than the points themselves.

◆ calcAxisAlignedBoundingBox() [1/2]

template<class P >
static Geo::AlignedBox_<P> SimTK::Geo::Point_< P >::calcAxisAlignedBoundingBox ( const Array_< Vec3P > &  points,
Array_< int > &  support 
)
static

Calculate the smallest axis-aligned bounding box including all n given points.

Cost is O(n).

◆ calcAxisAlignedBoundingBox() [2/2]

template<class P >
static Geo::AlignedBox_<P> SimTK::Geo::Point_< P >::calcAxisAlignedBoundingBox ( const Array_< Vec3P > &  points)
inlinestatic

Alternate signature doesn't return support points.

◆ calcAxisAlignedBoundingBoxIndirect() [1/2]

template<class P >
static Geo::AlignedBox_<P> SimTK::Geo::Point_< P >::calcAxisAlignedBoundingBoxIndirect ( const Array_< const Vec3P *> &  points,
Array_< int > &  support 
)
static

Alternate signature taking an array of pointers to points rather than the points themselves.

◆ calcAxisAlignedBoundingBoxIndirect() [2/2]

template<class P >
static Geo::AlignedBox_<P> SimTK::Geo::Point_< P >::calcAxisAlignedBoundingBoxIndirect ( const Array_< const Vec3P *> &  points)
inlinestatic

Alternate signature doesn't return support points.

◆ findOrientedExtremePoints()

template<class P >
static void SimTK::Geo::Point_< P >::findOrientedExtremePoints ( const Array_< Vec3P > &  points_F,
const RotationP R_FB,
int  least[3],
int  most[3],
Vec3P low_B,
Vec3P high_B 
)
static

Given a set of points, find the six points that are the most extreme along specified orientation directions (not necessarily distinct points).

The points are given in an arbitrary frame F. We have an oriented "box" frame B given by its orientation in F, R_FB. The origin of the B frame is coincident with the F frame. We'll find the points that are the most extreme along the B frame axis directions, and we'll also return the corner points in B (that is, the points having minimum and maximum x,y,z values in B). Note that the corners do not necessarily correspond to any points in the set. If you want to know where the corners are in F, just compute R_FB*low_B and R_FB*high_B on return. There must be at least one point in the given set.

◆ findOrientedExtremePointsIndirect()

template<class P >
static void SimTK::Geo::Point_< P >::findOrientedExtremePointsIndirect ( const Array_< const Vec3P *> &  points_F,
const RotationP R_FB,
int  least[3],
int  most[3],
Vec3P low_B,
Vec3P high_B 
)
static

Alternate signature taking an array of pointers to points rather than the points themselves.

◆ calcOrientedBoundingBox() [1/2]

template<class P >
static Geo::OrientedBox_<P> SimTK::Geo::Point_< P >::calcOrientedBoundingBox ( const Array_< Vec3P > &  points,
Array_< int > &  support,
bool  optimize = true 
)
static

Calculate a tight-fitting oriented bounding box (OBB) that includes all n given points.

The OBB is not guaranteed to be minimal but will usually be very good unless you suppress optimization to save runtime. Cost is O(n).

◆ calcOrientedBoundingBox() [2/2]

template<class P >
static Geo::OrientedBox_<P> SimTK::Geo::Point_< P >::calcOrientedBoundingBox ( const Array_< Vec3P > &  points)
inlinestatic

Alternate signature doesn't return support points.

◆ calcOrientedBoundingBoxIndirect() [1/2]

template<class P >
static Geo::OrientedBox_<P> SimTK::Geo::Point_< P >::calcOrientedBoundingBoxIndirect ( const Array_< const Vec3P *> &  points,
Array_< int > &  support,
bool  optimize = true 
)
static

Alternate signature taking an array of pointers to points rather than the points themselves.

◆ calcOrientedBoundingBoxIndirect() [2/2]

template<class P >
static Geo::OrientedBox_<P> SimTK::Geo::Point_< P >::calcOrientedBoundingBoxIndirect ( const Array_< const Vec3P *> &  points,
bool  optimize = true 
)
inlinestatic

Alternate signature doesn't return support points.

◆ calcBoundingSphere() [1/12]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcBoundingSphere ( const Vec3P p)
inlinestatic

Create a tiny bounding sphere around a single point.

The center is the point and the radius is tiny but non-zero.

◆ calcBoundingSphere() [2/12]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcBoundingSphere ( const Vec3P p0,
const Vec3P p1 
)
inlinestatic

Create a minimal bounding sphere around two points.

Some care is taken to avoid roundoff problems if the points are far from the origin or very close together.

◆ calcBoundingSphere() [3/12]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcBoundingSphere ( const Vec3P p0,
const Vec3P p1,
const Vec3P p2 
)
inlinestatic

Create a minimal bounding sphere around three points.

◆ calcBoundingSphere() [4/12]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcBoundingSphere ( const Vec3P p0,
const Vec3P p1,
const Vec3P p2,
const Vec3P p3 
)
inlinestatic

Create a minimal bounding sphere around four points.

◆ calcBoundingSphere() [5/12]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcBoundingSphere ( const Array_< Vec3P > &  points)
inlinestatic

Create a minimal bounding sphere around a collection of n points.

This has expected O(n) performance and usually yields a near-perfect bounding sphere.

◆ calcBoundingSphere() [6/12]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcBoundingSphere ( const std::vector< Vec3P > &  points)
inlinestatic

This signature takes an std::vector rather than a SimTK::Array_; no extra copying is required.

◆ calcBoundingSphereIndirect() [1/2]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcBoundingSphereIndirect ( const Array_< const Vec3P *> &  points)
inlinestatic

Create a minimal bounding sphere around a collection of n points, given indirectly as an array of pointers.

This has expected O(n) performance and yields a perfect bounding sphere.

◆ calcBoundingSphere() [7/12]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcBoundingSphere ( const std::vector< const Vec3P *> &  points)
inlinestatic

This signature takes an std::vector rather than a SimTK::Array_; no extra copying is required.

◆ calcBoundingSphere() [8/12]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcBoundingSphere ( const Vec3P p0,
Array_< int > &  which 
)
inlinestatic

Create one-point bounding sphere and return the (trivial) support point, of which there is always one.

◆ calcBoundingSphere() [9/12]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcBoundingSphere ( const Vec3P p0,
const Vec3P p1,
Array_< int > &  which 
)
static

Create a minimum sphere around two points.

The center is the midpoint, and the radius is roughly half the distance between the points, possibly expanded in the face of roundoff to ensure that neither point tests outside. There will be two support points for the circle unless the given points are very close to one another. In that case, we treat these as a single point and report in which that only 1 point was used to define the sphere. Points far from the origin will produce a larger sphere because of roundoff. Cost is about 45 flops.

◆ calcBoundingSphere() [10/12]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcBoundingSphere ( const Vec3P p0,
const Vec3P p1,
const Vec3P p2,
bool  forceCircumsphere,
Array_< int > &  which 
)
static

Create a minimum sphere around three points.

There can be 1, 2, or 3 support points returned in which. You can optionally force use of the 3-point circumsphere, which will not always be minimal. Even if forceCircumsphere is set true, if the points are singular (coincident, collinear, coplanar) then it may not be possible to generate a circumsphere and fewer support points will be used.

◆ calcBoundingSphere() [11/12]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcBoundingSphere ( const Vec3P p0,
const Vec3P p1,
const Vec3P p2,
const Vec3P p3,
bool  forceCircumsphere,
Array_< int > &  which 
)
static

Create a minimum sphere around four points.

There can be 1, 2, 3, or 4 support points returned in which. You can optionally force use of the 4-point circumsphere, which will not always be minimal. Even if forceCircumsphere is set true, if the points are singular (coincident, collinear, coplanar, cospherical) then it may not be possible to generate a circumsphere and fewer support points will be used.

◆ calcBoundingSphere() [12/12]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcBoundingSphere ( const Array_< Vec3P > &  points,
Array_< int > &  which 
)
static

Create an optimal minimum sphere around a collection of n points.

This has expected O(n) performance and yields a near-perfect minimum sphere. There can be 1, 2, 3, or 4 support points used to define the sphere and which reports which of the input points were used.

◆ calcBoundingSphereIndirect() [2/2]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcBoundingSphereIndirect ( const Array_< const Vec3P *> &  points,
Array_< int > &  which 
)
static

Alternate signature works with an array of pointers to points.

◆ calcApproxBoundingSphere() [1/2]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcApproxBoundingSphere ( const Array_< Vec3P > &  points)
static

Calculate an approximate bounding sphere. You should normally use calcBoundingSphere() which will give a smaller sphere.

◆ calcApproxBoundingSphere() [2/2]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcApproxBoundingSphere ( const std::vector< Vec3P > &  points)
inlinestatic

This signature takes an std::vector rather than a SimTK::Array_; no extra copying is required.

◆ calcApproxBoundingSphereIndirect() [1/2]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcApproxBoundingSphereIndirect ( const Array_< const Vec3P *> &  points)
static

Alternate signature works with an array of pointers to points.

◆ calcApproxBoundingSphereIndirect() [2/2]

template<class P >
static Sphere_<P> SimTK::Geo::Point_< P >::calcApproxBoundingSphereIndirect ( const std::vector< const Vec3P *> &  points)
inlinestatic

This signature takes an std::vector rather than a SimTK::Array_; no extra copying is required.


The documentation for this class was generated from the following files: