java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.Sphere
- All Implemented Interfaces:
ConstJoltPhysicsObject
,ConstSphere
,AutoCloseable
,Comparable<JoltPhysicsObject>
3-D geometric description of a sphere.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
encapsulatePoint
(Vec3Arg point) Construct the smallest sphere that encapsulates the sphere and the specified point.Copy the location of the sphere's center.float
Return the radius of the sphere.getSupport
(Vec3Arg direction) Calculate the support vector for the specified direction.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Constructor Details
-
Sphere
Instantiate a sphere with the specified center and radius.- Parameters:
center
- the desired location for the center (not null, unaffected)radius
- the desired radius
-
Sphere
Instantiate a sphere with the specified center and radius.- Parameters:
center
- the desired location for the center (not null, unaffected)radius
- the desired radius
-
-
Method Details
-
encapsulatePoint
Construct the smallest sphere that encapsulates the sphere and the specified point.- Parameters:
point
- the point to encapsulate (not null, unaffected)
-
getCenter
Copy the location of the sphere's center.- Specified by:
getCenter
in interfaceConstSphere
- Returns:
- a new location vector
-
getRadius
public float getRadius()Return the radius of the sphere.- Specified by:
getRadius
in interfaceConstSphere
- Returns:
- the radius
-
getSupport
Calculate the support vector for the specified direction.- Specified by:
getSupport
in interfaceConstSphere
- Parameters:
direction
- the direction to use (not null, unaffected)- Returns:
- a new offset vector
-