RobWorkProject
22.2.21

A hypersphere of K dimensions. More...
#include <HyperSphere.hpp>
Public Types  
typedef rw::core::Ptr< const HyperSphere >  Ptr 
Smart pointer type for HyperSphere.  
Public Member Functions  
HyperSphere (unsigned int dimensions)  
Construct a hypersphere of unit size. More...  
virtual  ~HyperSphere () 
Destructor.  
std::vector< Eigen::VectorXd >  uniformDistributionCartesian (double delta) const 
Create a uniform distribution in Cartesian coordinates. More...  
std::vector< Eigen::VectorXd >  uniformDistributionSpherical (double delta) const 
Create a uniform distribution in spherical coordinates. More...  
unsigned int  getDimensions () const 
Get the number of dimensions of the hypersphere. More...  
double  area () const 
Calculate the surface area of a hypersphere. More...  
double  volume () const 
The volume of a hypersphere. More...  
A hypersphere of K dimensions.
Functions are provided to create (almost) uniform distribution of points on a hypersphere as shown in [1].
The distribution of points is illustrated below for 2 and 3 dimensional hyperspheres. Notice that the tessellation is best when \( \delta\) is small.
[1] Lovisolo, L., and E. A. B. Da Silva. "Uniform distribution of points on a hypersphere with applications to vector bitplane encoding." IEE ProceedingsVision, Image and Signal Processing 148.3 (2001): 187193.
HyperSphere  (  unsigned int  dimensions  ) 
Construct a hypersphere of unit size.
dimensions  [in] the number of dimensions. 
double area  (  )  const 
Calculate the surface area of a hypersphere.
Calculated for even dimensionality as \( \frac{K \pi^{K/2}}{(K/2)!}\)
Calculated for odd dimensionality as \( \frac{K 2^K \pi^{(K1)/2}}{K!}\)
unsigned int getDimensions  (  )  const 
Get the number of dimensions of the hypersphere.
std::vector< Eigen::VectorXd > uniformDistributionCartesian  (  double  delta  )  const 
Create a uniform distribution in Cartesian coordinates.
This uses uniformDistributionSpherical and maps the spherical coordinates to Cartesian coordinates. The mapping is documented in [1], section 2.1.
delta  [in] the resolution. 
std::vector< Eigen::VectorXd > uniformDistributionSpherical  (  double  delta  )  const 
Create a uniform distribution in spherical coordinates.
This implements the algorithm in [1], section 2.1, for dimensions \( 2 \leq K \leq 6\)
delta  [in] the resolution. 
double volume  (  )  const 
The volume of a hypersphere.
Calculated for even dimensionality as \( \frac{\pi^{K/2}}{(K/2)!}\)
Calculated for odd dimensionality as \( \frac{2 (2 \pi)^{(K1)/2}}{K!!}\) where the double factorial for odd K means \( 1 \cdot 3 \cdot 5 \dots K\)