All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<JoltPhysicsObject>

public class Sphere extends JoltPhysicsObject
3-D geometric description of a sphere.
  • Constructor Details

    • Sphere

      public Sphere(Float3 center, float radius)
      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

      public Sphere(Vec3Arg center, float radius)
      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

      public void encapsulatePoint(Vec3Arg point)
      Construct the smallest sphere that encapsulates the sphere and the specified point.
      Parameters:
      point - the point to encapsulate (not null, unaffected)
    • getCenter

      public Vec3 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

      public Vec3 getSupport(Vec3Arg direction)
      Calculate the support vector for the specified direction.
      Parameters:
      direction - the direction to use (not null, unaffected)
      Returns:
      a new offset vector