OGS
|
Calculated center and radius of a minimal bounding sphere for a given number of geometric points.
Definition at line 28 of file MinimalBoundingSphere.h.
#include <MinimalBoundingSphere.h>
Public Member Functions | |
MinimalBoundingSphere (MathLib::Point3d const &p, double radius=std::numeric_limits< double >::epsilon()) | |
Point-Sphere. | |
MinimalBoundingSphere (MathLib::Point3d const &p, MathLib::Point3d const &q) | |
Bounding sphere using two points. | |
MinimalBoundingSphere (MathLib::Point3d const &p, MathLib::Point3d const &q, MathLib::Point3d const &r) | |
Bounding sphere using three points. | |
MinimalBoundingSphere (MathLib::Point3d const &p, MathLib::Point3d const &q, MathLib::Point3d const &r, MathLib::Point3d const &s) | |
Bounding sphere using four points. | |
MinimalBoundingSphere (std::vector< MathLib::Point3d * > const &points) | |
Bounding sphere of n points. | |
MathLib::Point3d | getCenter () const |
Returns the center point of the sphere. | |
double | getRadius () const |
Returns the radius of the sphere. | |
double | pointDistanceSquared (MathLib::Point3d const &pnt) const |
Private Member Functions | |
MinimalBoundingSphere () | |
Constructor using no points. | |
Static Private Member Functions | |
static MinimalBoundingSphere | recurseCalculation (std::vector< MathLib::Point3d * > sphere_points, std::size_t start_idx, std::size_t length, std::size_t n_boundary_points) |
Private Attributes | |
double | _radius {-1} |
MathLib::Point3d | _center |
|
explicit |
GeoLib::MinimalBoundingSphere::MinimalBoundingSphere | ( | MathLib::Point3d const & | p, |
MathLib::Point3d const & | q ) |
Bounding sphere using two points.
Definition at line 34 of file MinimalBoundingSphere.cpp.
References _center, _radius, and MathLib::Point3d::asEigenVector3d().
GeoLib::MinimalBoundingSphere::MinimalBoundingSphere | ( | MathLib::Point3d const & | p, |
MathLib::Point3d const & | q, | ||
MathLib::Point3d const & | r ) |
Bounding sphere using three points.
Definition at line 46 of file MinimalBoundingSphere.cpp.
References MinimalBoundingSphere(), _center, _radius, MathLib::Point3d::asEigenVector3d(), getCenter(), and getRadius().
GeoLib::MinimalBoundingSphere::MinimalBoundingSphere | ( | MathLib::Point3d const & | p, |
MathLib::Point3d const & | q, | ||
MathLib::Point3d const & | r, | ||
MathLib::Point3d const & | s ) |
Bounding sphere using four points.
Definition at line 80 of file MinimalBoundingSphere.cpp.
References _center, _radius, MathLib::Point3d::asEigenVector3d(), getCenter(), getRadius(), and MathLib::isCoplanar().
|
explicit |
Bounding sphere of n points.
Definition at line 127 of file MinimalBoundingSphere.cpp.
|
privatedefault |
Constructor using no points.
Referenced by MinimalBoundingSphere(), and recurseCalculation().
|
inline |
Returns the center point of the sphere.
Definition at line 50 of file MinimalBoundingSphere.h.
References _center.
Referenced by MinimalBoundingSphere(), and MinimalBoundingSphere().
|
inline |
Returns the radius of the sphere.
Definition at line 53 of file MinimalBoundingSphere.h.
References _radius.
Referenced by MinimalBoundingSphere(), MinimalBoundingSphere(), and MeshToolsLib::RadiusEdgeRatioMetric::calculateQuality().
double GeoLib::MinimalBoundingSphere::pointDistanceSquared | ( | MathLib::Point3d const & | pnt | ) | const |
Returns the squared euclidean distance of a point from the sphere (for points within the sphere distance is negative)
Definition at line 194 of file MinimalBoundingSphere.cpp.
References _center, _radius, and MathLib::sqrDist().
Referenced by recurseCalculation().
|
staticprivate |
Recursive method for calculating a minimal bounding sphere for an arbitrary number of points. Note: This method will change the order of elements in the vector sphere_points.
sphere_points | The vector of points for which the smallest enclosing sphere is calculated |
start_idx | Start index of the vector subrange analysed in the current recursive step |
length | Length of the vector subrange analysed in the current recursive step |
n_boundary_points | Number of found boundary points in the current recursive step |
Algorithm based the following two papers: Emo Welzl: Smallest enclosing disks (balls and ellipsoids). New Results and New Trends in Computer Science, pp. 359–370, 1991 Bernd Gaertner: Fast and Robust Smallest Enclosing Balls. ESA99, pp. 325–338, 1999. Code based on "Smallest Enclosing Spheres" implementation by Nicolas Capens on flipcode's Developer Toolbox (www.flipcode.com)
Definition at line 138 of file MinimalBoundingSphere.cpp.
References MinimalBoundingSphere(), pointDistanceSquared(), and recurseCalculation().
Referenced by recurseCalculation().
|
private |
Definition at line 87 of file MinimalBoundingSphere.h.
Referenced by MinimalBoundingSphere(), MinimalBoundingSphere(), MinimalBoundingSphere(), getCenter(), and pointDistanceSquared().
|
private |
Definition at line 86 of file MinimalBoundingSphere.h.
Referenced by MinimalBoundingSphere(), MinimalBoundingSphere(), MinimalBoundingSphere(), getRadius(), and pointDistanceSquared().