Package org.robwork.sdurw_geometry
Class BSphere_f
- java.lang.Object
-
- org.robwork.sdurw_geometry.BVBSphere_f
-
- org.robwork.sdurw_geometry.BSphere_f
-
public class BSphere_f extends BVBSphere_f
class representing an Bounding sphere
-
-
Constructor Summary
Constructors Constructor Description BSphere_f()
constructor using sphere center of (0, 0, 0)BSphere_f(float radius)
constructor using sphere center of (0, 0, 0)BSphere_f(long cPtr, boolean cMemoryOwn)
BSphere_f(BSphere_f bs)
Copy constroctorBSphere_f(Vector3Df pos)
constructor setting both sphere center and radiusBSphere_f(Vector3Df pos, float radius)
constructor setting both sphere center and radius
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description float
calcArea()
get the surface areafloat
calcVolume()
get the volumevoid
delete()
static BSphere_f
fitEigen(GeometryDataPtr tris)
static BSphere_f
fitEigen(TriMesh tris)
fit a sphere in $O(n)$ to a triangle mesh using Principal Component Analysis (PCA)
where the eigen values of the vertices are used to compute the center of the sphere
using the vector with the maximum spread (largest eigenvalue).static BSphere_f
fitEigen(TriMeshPtr tris)
static long
getCPtr(BSphere_f obj)
Vector3Df
getPosition()
get the position of the sphere centerfloat
getRadius()
get the sphere radiusfloat
getRadiusSqr()
get the sphere radius^2void
setPosition(Vector3Df p3d)
set the sphere center coordinatejava.lang.String
toString()
-
Methods inherited from class org.robwork.sdurw_geometry.BVBSphere_f
getCPtr
-
-
-
-
Constructor Detail
-
BSphere_f
public BSphere_f(long cPtr, boolean cMemoryOwn)
-
BSphere_f
public BSphere_f(float radius)
constructor using sphere center of (0, 0, 0)- Parameters:
radius
- [in] set the radius of the sphere
-
BSphere_f
public BSphere_f()
constructor using sphere center of (0, 0, 0)
-
BSphere_f
public BSphere_f(Vector3Df pos, float radius)
constructor setting both sphere center and radius- Parameters:
pos
- [in] the position of the center of the sphereradius
- [in] set the radius of the sphere
-
BSphere_f
public BSphere_f(Vector3Df pos)
constructor setting both sphere center and radius- Parameters:
pos
- [in] the position of the center of the sphere
-
BSphere_f
public BSphere_f(BSphere_f bs)
Copy constroctor- Parameters:
bs
- [in] object to copy
-
-
Method Detail
-
getCPtr
public static long getCPtr(BSphere_f obj)
-
delete
public void delete()
- Overrides:
delete
in classBVBSphere_f
-
getPosition
public Vector3Df getPosition()
get the position of the sphere center- Returns:
- a Vector3D with the center coordinates
-
setPosition
public void setPosition(Vector3Df p3d)
set the sphere center coordinate- Parameters:
p3d
- [in] the new center coordinates
-
getRadius
public float getRadius()
get the sphere radius- Returns:
- sphere radius
-
getRadiusSqr
public float getRadiusSqr()
get the sphere radius^2- Returns:
- sphere radius^2
-
calcArea
public float calcArea()
get the surface area- Returns:
- surface area
-
calcVolume
public float calcVolume()
get the volume- Returns:
- volume
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
fitEigen
public static BSphere_f fitEigen(TriMesh tris)
fit a sphere in $O(n)$ to a triangle mesh using Principal Component Analysis (PCA)
where the eigen values of the vertices are used to compute the center of the sphere
using the vector with the maximum spread (largest eigenvalue).- Parameters:
tris
- [in] input mesh- Returns:
- bounding sphere
-
fitEigen
public static BSphere_f fitEigen(TriMeshPtr tris)
-
fitEigen
public static BSphere_f fitEigen(GeometryDataPtr tris)
-
-