Package physx.common

Class PxBounds3

java.lang.Object
physx.NativeObject
physx.common.PxBounds3

public class PxBounds3 extends NativeObject
Class representing 3D range or axis aligned bounding box.

Stored as minimum and maximum extent corners. Alternate representation would be center and dimensions. May be empty or nonempty. For nonempty bounds, minimum <= maximum has to hold for all axes. Empty bounds have to be represented as minimum = PX_MAX_BOUNDS_EXTENTS and maximum = -PX_MAX_BOUNDS_EXTENTS for all axes. All other representations are invalid and the behavior is undefined.

  • Field Details

    • SIZEOF

      public static final int SIZEOF
    • ALIGNOF

      public static final int ALIGNOF
      See Also:
  • Constructor Details

    • PxBounds3

      protected PxBounds3(long address)
    • PxBounds3

      public PxBounds3()
      Default constructor, not performing any initialization for performance reason. \remark Use empty() function below to construct empty bounds.
    • PxBounds3

      public PxBounds3(PxVec3 minimum, PxVec3 maximum)
      Construct from two bounding points
  • Method Details

    • wrapPointer

      public static PxBounds3 wrapPointer(long address)
    • arrayGet

      public static PxBounds3 arrayGet(long baseAddress, int index)
    • createAt

      public static PxBounds3 createAt(long address)
      Parameters:
      address - Pre-allocated memory, where the object is created.
      Returns:
      Stack allocated object of PxBounds3
    • createAt

      public static <T> PxBounds3 createAt(T allocator, NativeObject.Allocator<T> allocate)
      Type Parameters:
      T - Allocator class, e.g. LWJGL's MemoryStack.
      Parameters:
      allocator - Object to use for allocation, e.g. an instance of LWJGL's MemoryStack.
      allocate - Method to call on allocator to obtain the target address, e.g. MemoryStack::nmalloc.
      Returns:
      Stack allocated object of PxBounds3
    • createAt

      public static PxBounds3 createAt(long address, PxVec3 minimum, PxVec3 maximum)
      Parameters:
      address - Pre-allocated memory, where the object is created.
      minimum - WebIDL type: PxVec3 [Const, Ref]
      maximum - WebIDL type: PxVec3 [Const, Ref]
      Returns:
      Stack allocated object of PxBounds3
    • createAt

      public static <T> PxBounds3 createAt(T allocator, NativeObject.Allocator<T> allocate, PxVec3 minimum, PxVec3 maximum)
      Type Parameters:
      T - Allocator class, e.g. LWJGL's MemoryStack.
      Parameters:
      allocator - Object to use for allocation, e.g. an instance of LWJGL's MemoryStack.
      allocate - Method to call on allocator to obtain the target address, e.g. MemoryStack::nmalloc.
      minimum - WebIDL type: PxVec3 [Const, Ref]
      maximum - WebIDL type: PxVec3 [Const, Ref]
      Returns:
      Stack allocated object of PxBounds3
    • destroy

      public void destroy()
    • getMinimum

      public PxVec3 getMinimum()
      Returns:
      WebIDL type: PxVec3 [Value]
    • setMinimum

      public void setMinimum(PxVec3 value)
      Parameters:
      value - WebIDL type: PxVec3 [Value]
    • getMaximum

      public PxVec3 getMaximum()
    • setMaximum

      public void setMaximum(PxVec3 value)
    • setEmpty

      public void setEmpty()
      Sets empty to true
    • setMaximal

      public void setMaximal()
      Sets the bounds to maximum size [-PX_MAX_BOUNDS_EXTENTS, PX_MAX_BOUNDS_EXTENTS].
    • include

      public void include(PxVec3 v)
      expands the volume to include v \param v Point to expand to.
    • isEmpty

      public boolean isEmpty()
      Returns:
      WebIDL type: boolean
    • intersects

      public boolean intersects(PxBounds3 b)
      indicates whether the intersection of this and b is empty or not. \param b Bounds to test for intersection.
    • intersects1D

      public boolean intersects1D(PxBounds3 b, int axis)
      computes the 1D-intersection between two AABBs, on a given axis. \param axis the axis (0, 1, 2)
    • contains

      public boolean contains(PxVec3 v)
      indicates if these bounds contain v. \param v Point to test against bounds.
    • isInside

      public boolean isInside(PxBounds3 box)
      checks a box is inside another box. \param box the other AABB
    • getCenter

      public PxVec3 getCenter()
      returns the center of this axis aligned box.
    • getDimensions

      public PxVec3 getDimensions()
      returns the dimensions (width/height/depth) of this axis aligned box.
    • getExtents

      public PxVec3 getExtents()
      returns the extents, which are half of the width/height/depth.
    • scaleSafe

      public void scaleSafe(float scale)
      scales the AABB.

      This version is safe to call for empty bounds.

      \param scale Factor to scale AABB by.

    • scaleFast

      public void scaleFast(float scale)
      scales the AABB.

      Calling this method for empty bounds leads to undefined behavior. Use #scaleSafe() instead.

      \param scale Factor to scale AABB by.

    • fattenSafe

      public void fattenSafe(float distance)
      fattens the AABB in all 3 dimensions by the given distance.

      This version is safe to call for empty bounds.

    • fattenFast

      public void fattenFast(float distance)
      fattens the AABB in all 3 dimensions by the given distance.

      Calling this method for empty bounds leads to undefined behavior. Use #fattenSafe() instead.

    • isFinite

      public boolean isFinite()
      checks that the AABB values are not NaN
    • isValid

      public boolean isValid()
      checks that the AABB values describe a valid configuration.