Package org.robwork.sdurw_geometry
Class HyperSphere
- java.lang.Object
-
- org.robwork.sdurw_geometry.HyperSphere
-
public class HyperSphere extends java.lang.Object
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.
-
-
Constructor Summary
Constructors Constructor Description HyperSphere(long dimensions)
Construct a hyper-sphere of unit size.HyperSphere(long cPtr, boolean cMemoryOwn)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double
area()
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!}
void
delete()
static long
getCPtr(HyperSphere obj)
long
getDimensions()
Get the number of dimensions of the hyper-sphere.SWIGTYPE_p_std__vectorT_Eigen__VectorXd_t
uniformDistributionCartesian(double delta)
Create a uniform distribution in Cartesian coordinates.
This uses #uniformDistributionSpherical and maps the spherical coordinates to Cartesian
coordinates.SWIGTYPE_p_std__vectorT_Eigen__VectorXd_t
uniformDistributionSpherical(double delta)
Create a uniform distribution in spherical coordinates.
This implements the algorithm in [1], section 2.1, for dimensions 2 \leq K \leq 6.
double
volume()
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
-
-
-
Method Detail
-
getCPtr
public static long getCPtr(HyperSphere obj)
-
delete
public void delete()
-
uniformDistributionCartesian
public SWIGTYPE_p_std__vectorT_Eigen__VectorXd_t uniformDistributionCartesian(double delta)
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.
- Parameters:
delta
- [in] the resolution.- Returns:
- unit vectors, [x_1 x_2 \dots x_K]^T , in Cartesian coordinates with
dimension K.
Note: This function is only implemented for 2 \leq K \leq 6 .
-
uniformDistributionSpherical
public SWIGTYPE_p_std__vectorT_Eigen__VectorXd_t uniformDistributionSpherical(double delta)
Create a uniform distribution in spherical coordinates.
This implements the algorithm in [1], section 2.1, for dimensions 2 \leq K \leq 6.
- Parameters:
delta
- [in] the resolution.- Returns:
- list of vectors, [\theta_1 \theta_2 \dots \theta_{K-1}]^T , in spherical
coordinates with dimension K-1.
Note: This function is only implemented for 2 \leq K \leq 6 .
-
getDimensions
public long getDimensions()
Get the number of dimensions of the hyper-sphere.- Returns:
- the number of dimensions, 2 \leq K \leq 6 .
-
area
public double area()
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!}
- Returns:
- the surface area.
-
volume
public double volume()
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
- Returns:
- the volume.
-
-