![]() |
RobWorkProject
23.9.11-
|
A hyper-sphere 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 hyper-sphere 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 hyper-sphere. More... | |
| double | area () const |
| Calculate the surface area of a hyper-sphere. More... | |
| double | volume () const |
| The volume of a hyper-sphere. More... | |
A hyper-sphere of K dimensions.
Functions are provided to create (almost) uniform distribution of points on a hyper-sphere as shown in [1].
The distribution of points is illustrated below for 2 and 3 dimensional hyper-spheres. 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 hyper-sphere with applications to vector bit-plane encoding." IEE Proceedings-Vision, Image and Signal Processing 148.3 (2001): 187-193.
| HyperSphere | ( | unsigned int | dimensions | ) |
Construct a hyper-sphere of unit size.
| dimensions | [in] the number of dimensions. |
| double area | ( | ) | const |
Calculate the surface area of a hyper-sphere.
Calculated for even dimensionality as \( \frac{K \pi^{K/2}}{(K/2)!}\)
Calculated for odd dimensionality as \( \frac{K 2^K \pi^{(K-1)/2}}{K!}\)
| unsigned int getDimensions | ( | ) | const |
Get the number of dimensions of the hyper-sphere.
| 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 hyper-sphere.
Calculated for even dimensionality as \( \frac{\pi^{K/2}}{(K/2)!}\)
Calculated for odd dimensionality as \( \frac{2 (2 \pi)^{(K-1)/2}}{K!!}\) where the double factorial for odd K means \( 1 \cdot 3 \cdot 5 \dots K\)