Package org.robwork.sdurw_geometry
Class BSphere
- java.lang.Object
-
- org.robwork.sdurw_geometry.BVBSphere
-
- org.robwork.sdurw_geometry.BSphere
-
public class BSphere extends BVBSphere
class representing an Bounding sphere
-
-
Constructor Summary
Constructors Constructor Description BSphere()
constructor using sphere center of (0, 0, 0)BSphere(double radius)
constructor using sphere center of (0, 0, 0)BSphere(long cPtr, boolean cMemoryOwn)
BSphere(BSphere bs)
Copy constroctorBSphere(Vector3D pos)
constructor setting both sphere center and radiusBSphere(Vector3D pos, double radius)
constructor setting both sphere center and radius
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double
calcArea()
get the surface areadouble
calcVolume()
get the volumevoid
delete()
static BSphere
fitEigen(GeometryDataPtr tris)
static BSphere
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
fitEigen(TriMeshPtr tris)
static long
getCPtr(BSphere obj)
Vector3D
getPosition()
get the position of the sphere centerdouble
getRadius()
get the sphere radiusdouble
getRadiusSqr()
get the sphere radius^2void
setPosition(Vector3D p3d)
set the sphere center coordinatejava.lang.String
toString()
-
-
-
Constructor Detail
-
BSphere
public BSphere(long cPtr, boolean cMemoryOwn)
-
BSphere
public BSphere(double radius)
constructor using sphere center of (0, 0, 0)- Parameters:
radius
- [in] set the radius of the sphere
-
BSphere
public BSphere()
constructor using sphere center of (0, 0, 0)
-
BSphere
public BSphere(Vector3D pos, double 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
public BSphere(Vector3D pos)
constructor setting both sphere center and radius- Parameters:
pos
- [in] the position of the center of the sphere
-
BSphere
public BSphere(BSphere bs)
Copy constroctor- Parameters:
bs
- [in] object to copy
-
-
Method Detail
-
getCPtr
public static long getCPtr(BSphere obj)
-
getPosition
public Vector3D getPosition()
get the position of the sphere center- Returns:
- a Vector3D with the center coordinates
-
setPosition
public void setPosition(Vector3D p3d)
set the sphere center coordinate- Parameters:
p3d
- [in] the new center coordinates
-
getRadius
public double getRadius()
get the sphere radius- Returns:
- sphere radius
-
getRadiusSqr
public double getRadiusSqr()
get the sphere radius^2- Returns:
- sphere radius^2
-
calcArea
public double calcArea()
get the surface area- Returns:
- surface area
-
calcVolume
public double calcVolume()
get the volume- Returns:
- volume
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
fitEigen
public static BSphere 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 fitEigen(TriMeshPtr tris)
-
fitEigen
public static BSphere fitEigen(GeometryDataPtr tris)
-
-