OGS
MinimalBoundingSphere.h
Go to the documentation of this file.
1 
15 #pragma once
16 
17 #include <vector>
18 
19 #include "MathLib/Point3d.h"
20 
21 namespace GeoLib
22 {
23 
28 {
29 public:
31  explicit MinimalBoundingSphere(
32  MathLib::Point3d const& p,
33  double radius = std::numeric_limits<double>::epsilon());
38  MathLib::Point3d const& q, MathLib::Point3d const& r);
41  MathLib::Point3d const& q,
42  MathLib::Point3d const& r,
43  MathLib::Point3d const& s);
45  explicit MinimalBoundingSphere(
46  std::vector<MathLib::Point3d*> const& points);
47 
49  MathLib::Point3d getCenter() const { return _center; }
50 
52  double getRadius() const {return _radius; }
53 
55  double pointDistanceSquared(MathLib::Point3d const& pnt) const;
56 
57 private:
60 
75  std::vector<MathLib::Point3d*> sphere_points,
76  std::size_t start_idx,
77  std::size_t length,
78  std::size_t n_boundary_points);
79 
80  double _radius{-1};
81  MathLib::Point3d _center{{std::numeric_limits<double>::max(),
82  std::numeric_limits<double>::max(),
83  std::numeric_limits<double>::max()}};
84 };
85 
86 } // namespace GeoLib
Definition of the Point3d class.
static MinimalBoundingSphere recurseCalculation(std::vector< MathLib::Point3d * > sphere_points, std::size_t start_idx, std::size_t length, std::size_t n_boundary_points)
MinimalBoundingSphere()
Constructor using no points.
double getRadius() const
Returns the radius of the sphere.
MathLib::Point3d getCenter() const
Returns the center point of the sphere.
double pointDistanceSquared(MathLib::Point3d const &pnt) const
Returns the squared euclidean distance of a point from the sphere (for points within the sphere dista...
static const double q
static const double r