Monte Carlo Integration Library 1.0
High-performance Monte Carlo methods for numerical integration and optimization
Public Member Functions | List of all members
mc::domains::Hypersphere< dim > Class Template Reference

N-dimensional ball (solid sphere). More...

#include <hypersphere.hpp>

Inheritance diagram for mc::domains::Hypersphere< dim >:
Collaboration diagram for mc::domains::Hypersphere< dim >:

Public Member Functions

 Hypersphere (double rad)
 Construct a hypersphere of given radius.
 
mc::geom::Bounds< dimgetBounds () const override
 Get the axis-aligned bounding box (hypercube).
 
double getBoxVolume () const override
 Get the volume of the bounding hypercube.
 
bool isInside (const mc::geom::Point< dim > &point) const override
 Test if a point is inside the hypersphere.
 
- Public Member Functions inherited from mc::domains::IntegrationDomain< dim >
virtual ~IntegrationDomain ()=default
 Virtual destructor for proper cleanup of derived classes.
 

Detailed Description

template<size_t dim>
class mc::domains::Hypersphere< dim >

N-dimensional ball (solid sphere).

Template Parameters
dimDimensionality (e.g., 2 for disk, 3 for ball, N for hypersphere).

Represents a closed ball of specified radius centered at the origin: B = {x ∈ ℝⁿ : ||x|| ≤ r}

Uses the closed-form volume formula: V = (π^(n/2) / Γ(n/2 + 1)) * r^n

Bounding box is a hypercube [-r, r]ⁿ.

Definition at line 30 of file hypersphere.hpp.

Constructor & Destructor Documentation

◆ Hypersphere()

template<size_t dim>
mc::domains::Hypersphere< dim >::Hypersphere ( double  rad)

Construct a hypersphere of given radius.

Parameters
radRadius of the sphere (must be > 0).

Member Function Documentation

◆ getBounds()

template<size_t dim>
mc::geom::Bounds< dim > mc::domains::Hypersphere< dim >::getBounds ( ) const
overridevirtual

Get the axis-aligned bounding box (hypercube).

Returns
Bounds [-radius, radius] for each dimension.

Implements mc::domains::IntegrationDomain< dim >.

◆ getBoxVolume()

template<size_t dim>
double mc::domains::Hypersphere< dim >::getBoxVolume ( ) const
overridevirtual

Get the volume of the bounding hypercube.

Returns
(2*radius)^dim

Implements mc::domains::IntegrationDomain< dim >.

◆ isInside()

template<size_t dim>
bool mc::domains::Hypersphere< dim >::isInside ( const mc::geom::Point< dim > &  point) const
overridevirtual

Test if a point is inside the hypersphere.

Parameters
pointPoint to test.
Returns
true if ||point|| ≤ radius; false otherwise.

Implements mc::domains::IntegrationDomain< dim >.


The documentation for this class was generated from the following file: