Class Box

All Implemented Interfaces:
PointerInterface

public class Box extends Record
A 3D box, described as the volume between a minimum and
a maximum vertices.

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

  • Field Details

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • allocBox

      public static Box allocBox()
      Allocates a new #graphene_box_t.

      The contents of the returned structure are undefined.
      Returns:
      the newly allocated #graphene_box_t structure. Use graphene_box_free() to free the resources allocated by this function
    • containsBox

      public boolean containsBox(@Nonnull Box b)
      Checks whether the #graphene_box_t @a contains the given
      #graphene_box_t @b.
      Parameters:
      b - a #graphene_box_t
      Returns:
      `true` if the box is contained in the given box
    • containsPoint

      public boolean containsPoint(@Nonnull Point3D point)
      Checks whether @box contains the given @point.
      Parameters:
      point - the coordinates to check
      Returns:
      `true` if the point is contained in the given box
    • equal

      public boolean equal(@Nonnull Box b)
      Checks whether the two given boxes are equal.
      Parameters:
      b - a #graphene_box_t
      Returns:
      `true` if the boxes are equal
    • expand

      public void expand(@Nonnull Point3D point, @Nonnull Box res)
      Expands the dimensions of @box to include the coordinates at @point.
      Parameters:
      point - the coordinates of the point to include
      res - return location for the expanded box
    • expandScalar

      public void expandScalar(float scalar, @Nonnull Box res)
      Expands the dimensions of @box by the given @scalar value.

      If @scalar is positive, the #graphene_box_t will grow; if @scalar is
      negative, the #graphene_box_t will shrink.
      Parameters:
      scalar - a scalar value
      res - return location for the expanded box
    • expandVec3

      public void expandVec3(@Nonnull Vec3 vec, @Nonnull Box res)
      Expands the dimensions of @box to include the coordinates of the
      given vector.
      Parameters:
      vec - the coordinates of the point to include, as a #graphene_vec3_t
      res - return location for the expanded box
    • free

      public void free()
      Frees the resources allocated by graphene_box_alloc().
    • getBoundingSphere

      public void getBoundingSphere(@Nonnull Sphere sphere)
      Computes the bounding #graphene_sphere_t capable of containing the given
      #graphene_box_t.
      Parameters:
      sphere - return location for the bounding sphere
    • getCenter

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

      public float getDepth()
      Retrieves the size of the @box on the Z axis.
      Returns:
      the depth of the box
    • getHeight

      public float getHeight()
      Retrieves the size of the @box on the Y axis.
      Returns:
      the height of the box
    • getMax

      public void getMax(@Nonnull Point3D max)
      Retrieves the coordinates of the maximum point of the given
      #graphene_box_t.
      Parameters:
      max - return location for the maximum point
    • getMin

      public void getMin(@Nonnull Point3D min)
      Retrieves the coordinates of the minimum point of the given
      #graphene_box_t.
      Parameters:
      min - return location for the minimum point
    • getSize

      public void getSize(@Nonnull Vec3 size)
      Retrieves the size of the box on all three axes, and stores
      it into the given @size vector.
      Parameters:
      size - return location for the size
    • getWidth

      public float getWidth()
      Retrieves the size of the @box on the X axis.
      Returns:
      the width of the box
    • init

      public Box init(@Nullable Point3D min, @Nullable Point3D max)
      Initializes the given #graphene_box_t with two vertices.
      Parameters:
      min - the coordinates of the minimum vertex
      max - the coordinates of the maximum vertex
      Returns:
      the initialized #graphene_box_t
    • initFromBox

      public Box initFromBox(@Nonnull Box src)
      Initializes the given #graphene_box_t with the vertices of
      another #graphene_box_t.
      Parameters:
      src - a #graphene_box_t
      Returns:
      the initialized #graphene_box_t
    • initFromVec3

      public Box initFromVec3(@Nullable Vec3 min, @Nullable Vec3 max)
      Initializes the given #graphene_box_t with two vertices
      stored inside #graphene_vec3_t.
      Parameters:
      min - the coordinates of the minimum vertex
      max - the coordinates of the maximum vertex
      Returns:
      the initialized #graphene_box_t
    • intersection

      public boolean intersection(@Nonnull Box b, @Nullable Box res)
      Intersects the two given #graphene_box_t.

      If the two boxes do not intersect, @res will contain a degenerate box
      initialized with graphene_box_empty().
      Parameters:
      b - a #graphene_box_t
      res - return location for the result
      Returns:
      true if the two boxes intersect
    • union

      public void union(@Nonnull Box b, @Nonnull Box res)
      Unions the two given #graphene_box_t.
      Parameters:
      b - the box to union to @a
      res - return location for the result
    • empty

      public static Box empty()
      A degenerate #graphene_box_t that can only be expanded.

      The returned value is owned by Graphene and should not be modified or freed.
      Returns:
      a #graphene_box_t
    • infinite

      public static Box infinite()
      A degenerate #graphene_box_t that cannot be expanded.

      The returned value is owned by Graphene and should not be modified or freed.
      Returns:
      a #graphene_box_t
    • minusOne

      public static Box minusOne()
      A #graphene_box_t with the minimum vertex set at (-1, -1, -1) and the
      maximum vertex set at (0, 0, 0).

      The returned value is owned by Graphene and should not be modified or freed.
      Returns:
      a #graphene_box_t
    • one

      public static Box one()
      A #graphene_box_t with the minimum vertex set at (0, 0, 0) and the
      maximum vertex set at (1, 1, 1).

      The returned value is owned by Graphene and should not be modified or freed.
      Returns:
      a #graphene_box_t
    • oneMinusOne

      public static Box oneMinusOne()
      A #graphene_box_t with the minimum vertex set at (-1, -1, -1) and the
      maximum vertex set at (1, 1, 1).

      The returned value is owned by Graphene and should not be modified or freed.
      Returns:
      a #graphene_box_t
    • zero

      public static Box zero()
      A #graphene_box_t with both the minimum and maximum vertices set at (0, 0, 0).

      The returned value is owned by Graphene and should not be modified or freed.
      Returns:
      a #graphene_box_t
    • 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()