java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.Sphere
- All Implemented Interfaces:
ConstJoltPhysicsObject
,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
-
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.- Returns:
- a new location vector
-
getRadius
public float getRadius()Return the radius of the sphere.- Returns:
- the radius
-
getSupport
Calculate the support vector for the specified direction.- Parameters:
direction
- the direction to use (not null, unaffected)- Returns:
- a new offset vector
-