OGS
MinimalBoundingSphere.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <vector>
7
8#include "MathLib/Point3d.h"
9
10namespace GeoLib
11{
12
18{
19public:
21 explicit MinimalBoundingSphere(
22 MathLib::Point3d const& p,
23 double radius = std::numeric_limits<double>::epsilon());
28 MathLib::Point3d const& r);
31 MathLib::Point3d const& q,
32 MathLib::Point3d const& r,
33 MathLib::Point3d const& s);
35 explicit MinimalBoundingSphere(
36 std::vector<MathLib::Point3d*> const& points);
37
40
42 double getRadius() const { return _radius; }
43
46 double pointDistanceSquared(MathLib::Point3d const& pnt) const;
47
48private:
51
70 std::vector<MathLib::Point3d*> sphere_points,
71 std::size_t start_idx,
72 std::size_t length,
73 std::size_t n_boundary_points);
74
75 double _radius{-1};
76 MathLib::Point3d _center{{std::numeric_limits<double>::max(),
77 std::numeric_limits<double>::max(),
78 std::numeric_limits<double>::max()}};
79};
80
81} // namespace GeoLib
MinimalBoundingSphere(MathLib::Point3d const &p, double radius=std::numeric_limits< double >::epsilon())
Point-Sphere.
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