Class Sphere

All Implemented Interfaces:
PointerInterface

public class Sphere extends Record
A sphere, represented by its center and radius.

https://ebassi.github.io/graphene/docs/

  • Field Details

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getFieldRadius

      public float getFieldRadius()
    • allocSphere

      public static Sphere allocSphere()
      Allocates a new #graphene_sphere_t.

      The contents of the newly allocated structure are undefined.
      Returns:
      the newly allocated #graphene_sphere_t. Use graphene_sphere_free() to free the resources allocated by this function
    • containsPoint

      public boolean containsPoint(@Nonnull Point3D point)
      Checks whether the given @point is contained in the volume
      of a #graphene_sphere_t.
      Parameters:
      point - a #graphene_point3d_t
      Returns:
      `true` if the sphere contains the point
    • distance

      public float distance(@Nonnull Point3D point)
      Computes the distance of the given @point from the surface of
      a #graphene_sphere_t.
      Parameters:
      point - a #graphene_point3d_t
      Returns:
      the distance of the point
    • equal

      public boolean equal(@Nonnull Sphere b)
      Checks whether two #graphene_sphere_t are equal.
      Parameters:
      b - a #graphene_sphere_t
      Returns:
      `true` if the spheres are equal
    • free

      public void free()
      Frees the resources allocated by graphene_sphere_alloc().
    • getBoundingBox

      public void getBoundingBox(@Nonnull Box box)
      Computes the bounding box capable of containing the
      given #graphene_sphere_t.
      Parameters:
      box - return location for the bounding box
    • getCenter

      public void getCenter(@Nonnull Point3D center)
      Retrieves the coordinates of the center of a #graphene_sphere_t.
      Parameters:
      center - return location for the coordinates of the center
    • getRadius

      public float getRadius()
      Retrieves the radius of a #graphene_sphere_t.
      Returns:
    • init

      public Sphere init(@Nullable Point3D center, float radius)
      Initializes the given #graphene_sphere_t with the given @center and @radius.
      Parameters:
      center - the coordinates of the center of the sphere, or %NULL for a center in (0, 0, 0)
      radius - the radius of the sphere
      Returns:
      the initialized #graphene_sphere_t
    • isEmpty

      public boolean isEmpty()
      Checks whether the sphere has a zero radius.
      Returns:
      `true` if the sphere is empty
    • translate

      public void translate(@Nonnull Point3D point, @Nonnull Sphere res)
      Translates the center of the given #graphene_sphere_t using the @point
      coordinates as the delta of the translation.
      Parameters:
      point - the coordinates of the translation
      res - return location for the translated sphere
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()