Package org.robwork.sdurw_geometry
Class HyperSphereCPtr
- java.lang.Object
-
- org.robwork.sdurw_geometry.HyperSphereCPtr
-
public class HyperSphereCPtr extends java.lang.Object
Ptr stores a pointer and optionally takes ownership of the value.
-
-
Constructor Summary
Constructors Constructor Description HyperSphereCPtr()
Default constructor yielding a NULL-pointer.HyperSphereCPtr(long cPtr, boolean cMemoryOwn)
HyperSphereCPtr(HyperSphere ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description HyperSphere
__ref__()
Dereferencing operator.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()
HyperSphere
deref()
The pointer stored in the object.boolean
equals(HyperSphere p)
static long
getCPtr(HyperSphereCPtr obj)
HyperSphere
getDeref()
Member access operator.long
getDimensions()
Get the number of dimensions of the hyper-sphere.boolean
isNull()
checks if the pointer is nullboolean
isShared()
check if this Ptr has shared ownership or none
ownershipSWIGTYPE_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
-
-
-
Constructor Detail
-
HyperSphereCPtr
public HyperSphereCPtr(long cPtr, boolean cMemoryOwn)
-
HyperSphereCPtr
public HyperSphereCPtr()
Default constructor yielding a NULL-pointer.
-
HyperSphereCPtr
public HyperSphereCPtr(HyperSphere ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
-
Method Detail
-
getCPtr
public static long getCPtr(HyperSphereCPtr obj)
-
delete
public void delete()
-
deref
public HyperSphere deref()
The pointer stored in the object.
-
__ref__
public HyperSphere __ref__()
Dereferencing operator.
-
getDeref
public HyperSphere getDeref()
Member access operator.
-
equals
public boolean equals(HyperSphere p)
-
isShared
public boolean isShared()
check if this Ptr has shared ownership or none
ownership- Returns:
- true if Ptr has shared ownership, false if it has no ownership.
-
isNull
public boolean isNull()
checks if the pointer is null- Returns:
- Returns true if the pointer is null
-
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.
-
-