java.lang.Object
me.moros.bending.api.collision.geometry.AABB
All Implemented Interfaces:
Collider

public class AABB extends Object implements Collider
Axis aligned bounding box.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final AABB
     
    static final AABB
     
    final me.moros.math.Vector3d
     
    final me.moros.math.Vector3d
     

    Fields inherited from interface me.moros.bending.api.collision.geometry.Collider

    EPSILON
  • Constructor Summary

    Constructors
    Constructor
    Description
    AABB(me.moros.math.Vector3d min, me.moros.math.Vector3d max)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    at(me.moros.math.Position point)
    Calculate a new collider as if this instance was moved.
    boolean
    contains(me.moros.math.Vector3d point)
    Check if the given point is within the space of this collider.
    static AABB
    Get a dummy AABB collider.
    boolean
     
    static AABB
    fromRay(Ray ray, double raySize)
     
    static AABB
    fromRay(me.moros.math.Vector3d start, me.moros.math.Vector3d dir, double raySize)
     
    grow(me.moros.math.Vector3d diff)
    Calculate an AABB by expanding this instance by the given amount in each component.
    me.moros.math.Vector3d
    Calculate the half extents for this collider.
    int
     
    me.moros.math.Vector3d
    Get the center position for this collider.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface me.moros.bending.api.collision.geometry.Collider

    intersects
  • Field Details

    • BLOCK_BOUNDS

      public static final AABB BLOCK_BOUNDS
    • EXPANDED_BLOCK_BOUNDS

      public static final AABB EXPANDED_BLOCK_BOUNDS
    • min

      public final me.moros.math.Vector3d min
    • max

      public final me.moros.math.Vector3d max
  • Constructor Details

    • AABB

      public AABB(me.moros.math.Vector3d min, me.moros.math.Vector3d max)
  • Method Details

    • grow

      public AABB grow(me.moros.math.Vector3d diff)
      Calculate an AABB by expanding this instance by the given amount in each component. The expansion is uniform and will affect both the min and max points. For example, expanding BLOCK_BOUNDS (1x1x1 box) by Vector3d.ONE will result in a 3x3x3 box.
      Parameters:
      diff - the amount to expand
      Returns:
      the expanded AABB
    • position

      public me.moros.math.Vector3d position()
      Description copied from interface: Collider
      Get the center position for this collider.
      Specified by:
      position in interface Collider
      Returns:
      the center position
    • at

      public AABB at(me.moros.math.Position point)
      Description copied from interface: Collider
      Calculate a new collider as if this instance was moved.
      Specified by:
      at in interface Collider
      Parameters:
      point - the new center position
      Returns:
      the new collider
    • halfExtents

      public me.moros.math.Vector3d halfExtents()
      Description copied from interface: Collider
      Calculate the half extents for this collider.
      Specified by:
      halfExtents in interface Collider
      Returns:
      this half extents for this collider
    • contains

      public boolean contains(me.moros.math.Vector3d point)
      Description copied from interface: Collider
      Check if the given point is within the space of this collider.
      Specified by:
      contains in interface Collider
      Parameters:
      point - the point to check
      Returns:
      true if point is contained in this collider
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • dummy

      public static AABB dummy()
      Get a dummy AABB collider.
      Returns:
      a dummy collider
    • fromRay

      public static AABB fromRay(Ray ray, double raySize)
    • fromRay

      public static AABB fromRay(me.moros.math.Vector3d start, me.moros.math.Vector3d dir, double raySize)