java.lang.Object
com.io7m.jregions.core.parameterized.volumes.PVolumesBI

public final class PVolumesBI
extends java.lang.Object

Functions over volumes.

These functions operate using the concepts of minimum-x, maximum-x, minimum-y, maximum-y, minimum-z, maximum-z, edges. It is up to individual applications to assign meaning to these edges such as "left" for minimum-x, "top" for minimum-y, or "far" for minimum-z.

  • Method Summary

    Modifier and Type Method Description
    static <S,​ T> PVolumeBI<T> cast​(PVolumeBI<S> volume)
    Brand a given volume as belonging to a different coordinate space.
    static <S> PVolumeBI<S> containing​(PVolumeBI<S> a, PVolumeBI<S> b)
    Construct a volume that will contain both a and b.
    static <S> boolean contains​(PVolumeBI<S> a, PVolumeBI<S> b)
    Determine whether or not one volume contains another.
    static <S> boolean containsPoint​(PVolumeBI<S> a, java.math.BigInteger x, java.math.BigInteger y, java.math.BigInteger z)
    Determine whether or not a volume contains a given point.
    static <S> boolean couldFitInside​(PVolumeBI<S> a, PVolumeBI<S> b)
    Determine whether or not one volume could fit inside another.
    static <S> PVolumeBI<S> create​(java.math.BigInteger x, java.math.BigInteger y, java.math.BigInteger z, java.math.BigInteger size_x, java.math.BigInteger size_y, java.math.BigInteger size_z)
    Create a volume of size (size_x, size_y, size_z) placing the minimum corner at (x, y, z).
    static <S> PVolumeBI<S> moveAbsolute​(PVolumeBI<S> volume, java.math.BigInteger x, java.math.BigInteger y, java.math.BigInteger z)
    Move the given volume to (x, y, z).
    static <S> PVolumeBI<S> moveRelative​(PVolumeBI<S> volume, java.math.BigInteger x, java.math.BigInteger y, java.math.BigInteger z)
    Move the given volume by (x, y, z).
    static <S> PVolumeBI<S> moveRelativeClamped​(PVolumeBI<S> container, PVolumeBI<S> volume, java.math.BigInteger x, java.math.BigInteger y, java.math.BigInteger z)
    Move the given volume by (x, y, z), without allowing volume to leave container.
    static <S> PVolumeBI<S> moveRelativeClampedX​(PVolumeBI<S> container, PVolumeBI<S> volume, java.math.BigInteger x)
    Move the given volume by x, without allowing volume to leave container.
    static <S> PVolumeBI<S> moveRelativeClampedY​(PVolumeBI<S> container, PVolumeBI<S> volume, java.math.BigInteger y)
    Move the given volume by y, without allowing volume to leave container.
    static <S> PVolumeBI<S> moveRelativeClampedZ​(PVolumeBI<S> container, PVolumeBI<S> volume, java.math.BigInteger z)
    Move the given volume by z, without allowing volume to leave container.
    static <S> PVolumeBI<S> moveToOrigin​(PVolumeBI<S> volume)
    Move the given volume to (0, 0, 0).
    static <S> boolean overlaps​(PVolumeBI<S> a, PVolumeBI<S> b)
    Determine whether or not two volumes overlap.
    static <S> java.lang.String show​(PVolumeBI<S> volume)  
    static <S> java.lang.String showToBuilder​(PVolumeBI<S> volume, java.lang.StringBuilder sb)  
    static <S> PVolumeSizeBI<S> size​(PVolumeBI<S> volume)  
    static <S> PVolumeXYZSplitBI<S,​PVolumeBI<S>> splitAtXYZ​(PVolumeBI<S> v, java.math.BigInteger x, java.math.BigInteger y, java.math.BigInteger z)
    Split the given volume at point (x, y, z).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • create

      public static <S> PVolumeBI<S> create​(java.math.BigInteger x, java.math.BigInteger y, java.math.BigInteger z, java.math.BigInteger size_x, java.math.BigInteger size_y, java.math.BigInteger size_z)
      Create a volume of size (size_x, size_y, size_z) placing the minimum corner at (x, y, z).
      Type Parameters:
      S - The coordinate space of the volume
      Parameters:
      x - The X value of the minimum corner
      y - The Y value of the minimum corner
      z - The Z value of the minimum corner
      size_x - The size of the volume on the X axis
      size_y - The size of the volume on the Y axis
      size_z - The size of the volume on the Z axis
      Returns:
      A volume
    • contains

      public static <S> boolean contains​(PVolumeBI<S> a, PVolumeBI<S> b)

      Determine whether or not one volume contains another.

      Containing is reflexive: contains(a, a) == true.

      Containing is transitive: contains(a, b) → contains(b, c) → contains(a, c).

      Containing is not necessarily symmetric.

      Type Parameters:
      S - The coordinate space of the volumes
      Parameters:
      a - Volume A
      b - Volume B
      Returns:
      true iff a contains b
    • moveRelative

      public static <S> PVolumeBI<S> moveRelative​(PVolumeBI<S> volume, java.math.BigInteger x, java.math.BigInteger y, java.math.BigInteger z)
      Move the given volume by (x, y, z).
      Type Parameters:
      S - The coordinate space of the volume
      Parameters:
      volume - The volume
      x - The amount to move on the X axis
      y - The amount to move on the Y axis
      z - The amount to move on the Z axis
      Returns:
      A moved volume
    • moveRelativeClampedX

      public static <S> PVolumeBI<S> moveRelativeClampedX​(PVolumeBI<S> container, PVolumeBI<S> volume, java.math.BigInteger x)
      Move the given volume by x, without allowing volume to leave container.
      Type Parameters:
      S - The coordinate space of the volume
      Parameters:
      container - The container volume
      volume - The volume
      x - The amount to move on the X axis
      Returns:
      A moved volume
      Since:
      3.0.0
    • moveRelativeClampedY

      public static <S> PVolumeBI<S> moveRelativeClampedY​(PVolumeBI<S> container, PVolumeBI<S> volume, java.math.BigInteger y)
      Move the given volume by y, without allowing volume to leave container.
      Type Parameters:
      S - The coordinate space of the volume
      Parameters:
      container - The container volume
      volume - The volume
      y - The amount to move on the Y axis
      Returns:
      A moved volume
      Since:
      3.0.0
    • moveRelativeClampedZ

      public static <S> PVolumeBI<S> moveRelativeClampedZ​(PVolumeBI<S> container, PVolumeBI<S> volume, java.math.BigInteger z)
      Move the given volume by z, without allowing volume to leave container.
      Type Parameters:
      S - The coordinate space of the volume
      Parameters:
      container - The container volume
      volume - The volume
      z - The amount to move on the Z axis
      Returns:
      A moved volume
      Since:
      3.0.0
    • moveRelativeClamped

      public static <S> PVolumeBI<S> moveRelativeClamped​(PVolumeBI<S> container, PVolumeBI<S> volume, java.math.BigInteger x, java.math.BigInteger y, java.math.BigInteger z)
      Move the given volume by (x, y, z), without allowing volume to leave container.
      Type Parameters:
      S - The coordinate space of the volume
      Parameters:
      container - The container volume
      volume - The volume
      x - The amount to move on the X axis
      y - The amount to move on the Y axis
      z - The amount to move on the Z axis
      Returns:
      A moved volume
      Since:
      3.0.0
    • moveAbsolute

      public static <S> PVolumeBI<S> moveAbsolute​(PVolumeBI<S> volume, java.math.BigInteger x, java.math.BigInteger y, java.math.BigInteger z)
      Move the given volume to (x, y, z).
      Type Parameters:
      S - The coordinate space of the volume
      Parameters:
      volume - The volume
      x - The position to which to move on the X axis
      y - The position to which to move on the Y axis
      z - The position to which to move on the Z axis
      Returns:
      A moved volume
    • moveToOrigin

      public static <S> PVolumeBI<S> moveToOrigin​(PVolumeBI<S> volume)
      Move the given volume to (0, 0, 0).
      Type Parameters:
      S - The coordinate space of the volume
      Parameters:
      volume - The volume
      Returns:
      A moved volume
    • cast

      public static <S,​ T> PVolumeBI<T> cast​(PVolumeBI<S> volume)
      Brand a given volume as belonging to a different coordinate space. Mixing up coordinate spaces is a common source of difficult-to-locate bugs. Use at your own risk.
      Type Parameters:
      S - The starting coordinate space
      T - The resulting coordinate space
      Parameters:
      volume - A volume
      Returns:
      volume
    • overlaps

      public static <S> boolean overlaps​(PVolumeBI<S> a, PVolumeBI<S> b)

      Determine whether or not two volumes overlap.

      Overlapping is reflexive: overlaps(a, a) == true.

      Overlapping is symmetric: overlaps(a, b) == overlaps(b, a).

      Overlapping is not necessarily transitive.

      Type Parameters:
      S - The coordinate space of the volumes
      Parameters:
      a - A volume
      b - A volume
      Returns:
      true iff a overlaps b
    • couldFitInside

      public static <S> boolean couldFitInside​(PVolumeBI<S> a, PVolumeBI<S> b)

      Determine whether or not one volume could fit inside another.

      Fitting is reflexive: couldFitInside(a, a) == true.

      Fitting is transitive: couldFitInside(a, b) → couldFitInside(b, c) → couldFitInside(a, c).

      Fitting is not necessarily symmetric.

      Type Parameters:
      S - The coordinate space of the volumes
      Parameters:
      a - A volume
      b - A volume
      Returns:
      true iff a could fit inside b
    • containing

      public static <S> PVolumeBI<S> containing​(PVolumeBI<S> a, PVolumeBI<S> b)
      Construct a volume that will contain both a and b.
      Type Parameters:
      S - The coordinate space of the volumes
      Parameters:
      a - A volume
      b - A volume
      Returns:
      A volume containing a and b
    • containsPoint

      public static <S> boolean containsPoint​(PVolumeBI<S> a, java.math.BigInteger x, java.math.BigInteger y, java.math.BigInteger z)

      Determine whether or not a volume contains a given point.

      Type Parameters:
      S - The coordinate space of the volume
      Parameters:
      a - A volume
      x - The X coordinate of the point
      y - The Y coordinate of the point
      z - The Z coordinate of the point
      Returns:
      true iff a contains (x, y, z)
    • splitAtXYZ

      public static <S> PVolumeXYZSplitBI<S,​PVolumeBI<S>> splitAtXYZ​(PVolumeBI<S> v, java.math.BigInteger x, java.math.BigInteger y, java.math.BigInteger z)

      Split the given volume at point (x, y, z).

      Type Parameters:
      S - The coordinate space of the volume
      Parameters:
      v - A volume
      x - The X coordinate of the point
      y - The Y coordinate of the point
      z - The Z coordinate of the point
      Returns:
      true iff a contains (x, y, z)
    • show

      public static <S> java.lang.String show​(PVolumeBI<S> volume)
      Type Parameters:
      S - The coordinate space of the volume
      Parameters:
      volume - The volume
      Returns:
      A terse string describing the position and size of the volume
    • size

      public static <S> PVolumeSizeBI<S> size​(PVolumeBI<S> volume)
      Type Parameters:
      S - The coordinate space of the volume
      Parameters:
      volume - The volume
      Returns:
      The size of the volume
    • showToBuilder

      public static <S> java.lang.String showToBuilder​(PVolumeBI<S> volume, java.lang.StringBuilder sb)
      Type Parameters:
      S - The coordinate space of the volume
      Parameters:
      volume - The volume
      sb - A string builder
      Returns:
      A terse string describing the position and size of the volume