![]() |
OGS
|
Calculated center and radius of a minimal bounding sphere for a given number of geometric points.
Definition at line 27 of file MinimalBoundingSphere.h.
#include <MinimalBoundingSphere.h>
Public Member Functions | |
MinimalBoundingSphere (MathLib::Point3d const &p, double radius=std::numeric_limits< double >::epsilon()) | |
Point-Sphere. More... | |
MinimalBoundingSphere (MathLib::Point3d const &p, MathLib::Point3d const &q) | |
Bounding sphere using two points. More... | |
MinimalBoundingSphere (MathLib::Point3d const &p, MathLib::Point3d const &q, MathLib::Point3d const &r) | |
Bounding sphere using three points. More... | |
MinimalBoundingSphere (MathLib::Point3d const &p, MathLib::Point3d const &q, MathLib::Point3d const &r, MathLib::Point3d const &s) | |
Bounding sphere using four points. More... | |
MinimalBoundingSphere (std::vector< MathLib::Point3d * > const &points) | |
Bounding sphere of n points. More... | |
MathLib::Point3d | getCenter () const |
Returns the center point of the sphere. More... | |
double | getRadius () const |
Returns the radius of the sphere. More... | |
double | 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) More... | |
Private Member Functions | |
MinimalBoundingSphere () | |
Constructor using no points. More... | |
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 |
Point-Sphere.
Definition at line 27 of file MinimalBoundingSphere.cpp.
GeoLib::MinimalBoundingSphere::MinimalBoundingSphere | ( | MathLib::Point3d const & | p, |
MathLib::Point3d const & | q | ||
) |
Bounding sphere using two points.
Definition at line 33 of file MinimalBoundingSphere.cpp.
References _center, _radius, and MathLib::q.
GeoLib::MinimalBoundingSphere::MinimalBoundingSphere | ( | MathLib::Point3d const & | p, |
MathLib::Point3d const & | q, | ||
MathLib::Point3d const & | r | ||
) |
Bounding sphere using three points.
Definition at line 47 of file MinimalBoundingSphere.cpp.
References MinimalBoundingSphere(), _center, _radius, getCenter(), getRadius(), MathLib::q, and MathLib::r.
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 83 of file MinimalBoundingSphere.cpp.
References _center, _radius, getCenter(), MathLib::TemplatePoint< T, DIM >::getCoords(), getRadius(), MathLib::isCoplanar(), MathLib::q, and MathLib::r.
|
explicit |
Bounding sphere of n points.
Definition at line 135 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 49 of file MinimalBoundingSphere.h.
References _center.
Referenced by MinimalBoundingSphere().
|
inline |
Returns the radius of the sphere.
Definition at line 52 of file MinimalBoundingSphere.h.
References _radius.
Referenced by MinimalBoundingSphere(), and MeshLib::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 202 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 146 of file MinimalBoundingSphere.cpp.
References MinimalBoundingSphere(), MathLib::LinAlg::copy(), and pointDistanceSquared().
|
private |
Definition at line 81 of file MinimalBoundingSphere.h.
Referenced by MinimalBoundingSphere(), getCenter(), and pointDistanceSquared().
|
private |
Definition at line 80 of file MinimalBoundingSphere.h.
Referenced by MinimalBoundingSphere(), getRadius(), and pointDistanceSquared().