v2.0.0
Loading...
Searching...
No Matches
sphere.h File Reference

Best-fit sphere from a 3-D point cloud with closed-form and Nelder–Mead solvers. More...

#include "math_global.h"
#include <Eigen/Core>
Include dependency graph for sphere.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  UTILSLIB::FitUser
 Cost-function workspace for Sphere::fit_sphere_simplex: holds the nx3 point cloud and a verbose-report flag. More...
class  UTILSLIB::Sphere
 3-D sphere value type with algebraic and Nelder–Mead best-fit factories. More...

Namespaces

namespace  UTILSLIB
 Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).

Detailed Description

Best-fit sphere from a 3-D point cloud with closed-form and Nelder–Mead solvers.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.0.0
Date
March 2026

UTILSLIB::Sphere fits a single sphere \((\mathbf{c}, r)\) to an n×3 point cloud and is the geometric primitive used to build the spherical head models consumed by FWDLIB's BEM solvers and by INVERSELIB's depth weighting. Two solvers are provided: a closed-form algebraic fit due to Alan Jennings (University of Dayton) that solves a single linear system in O(n) and returns the algebraic best fit in one shot, and a Nelder–Mead refinement (fit_sphere_simplex) that minimises the geometric residual \(\sum_i (\|\mathbf{p}_i - \mathbf{c}\| - r)^2\) via UTILSLIB::SimplexAlgorithm and is more robust on noisy digitiser data where the algebraic fit is biased toward outliers.

The class itself is a lightweight value type carrying (center, radius); the fit routines are static factories so the same object layout is shared between MRI head-shape extraction, HPI coil fitting and the spherical-shell BEM construction in FWDLIB.

Definition in file sphere.h.