java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.AaBox
- All Implemented Interfaces:
ConstAaBox,ConstJoltPhysicsObject,AutoCloseable,Comparable<JoltPhysicsObject>
3-D geometric description of an axis-aligned box. (native type: AABox)
-
Constructor Summary
ConstructorsConstructorDescriptionAaBox()Instantiate an invalid box.AaBox(ConstAaBox original) Instantiate a copy of the specified box.Instantiate a box with the specified minimum and maximum coordinates.Instantiate a cubic box with the specified center coordinates and half extent.Instantiate a box with the specified minimum and maximum coordinates. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(ConstAaBox other) Test whether the current box contains the argument box.booleanTest whether the box contains the specified point.voidencapsulate(ConstAaBox includeBox) Enlarge the current box to include the argument box.voidencapsulate(ConstTriangle triangle) Enlarge the box to include the specified triangle.voidencapsulate(ConstVertexList vertices, ConstIndexedTriangle triangle) Enlarge the box to include the specified triangle.voidencapsulate(Vec3Arg location) Enlarge the box to include the specified location.voidensureMinimalEdgeLength(float minEdgeLength) Enlarge the box so that each edge has at least the specified length.voidEnlarge the box on all sides by the specified amounts.Locate the center of the box.getClosestPoint(Vec3Arg location) Locate the closest point on or in the box for the specified location.Copy the (half) extent of the box.getMax()Copy the maximum contained coordinate on each axis.getMin()Copy the minimum contained coordinate on each axis.getSize()Copy the size (full extent) on each axis.floatgetSqDistanceTo(Vec3Arg point) Get the squared distance between the box and the specified point.getSupport(Vec3Arg direction) Calculate the support vector for this convex shape.floatGet surface area of bounding box.floatReturn the volume of the box.booleanisValid()Test whether the box is valid.booleanoverlaps(ConstAaBox other) Check if this box overlaps with another box.booleanoverlaps(ConstPlane plane) Check if this box overlaps with a plane.static AaBoxsBiggest()Instantiate the biggest finite box.Return a scaled copy of the box.voidsetEmpty()Alter the box to be empty.voidAlter the maximum coordinates.voidAlter the minimum coordinates.transformed(Mat44Arg matrix) Return a transformed copy of the box.voidMove by the specified offset.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, vaMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Constructor Details
-
AaBox
public AaBox()Instantiate an invalid box. -
AaBox
Instantiate a copy of the specified box.- Parameters:
original- the box to copy (notnull, unaffected)
-
AaBox
Instantiate a box with the specified minimum and maximum coordinates.- Parameters:
minimum- the desired minimum coordinates (not null, unaffected)maximum- the desired maximum coordinates (not null, unaffected)
-
AaBox
Instantiate a cubic box with the specified center coordinates and half extent.- Parameters:
center- the desired center coordinates (not null, unaffected)halfExtent- the desired half extent
-
AaBox
Instantiate a box with the specified minimum and maximum coordinates.- Parameters:
minimum- the desired minimum coordinates (not null, unaffected)maximum- the desired maximum coordinates (not null, unaffected)
-
-
Method Details
-
encapsulate
Enlarge the current box to include the argument box.- Parameters:
includeBox- the box to include (not null, unaffected)
-
encapsulate
Enlarge the box to include the specified triangle.- Parameters:
triangle- the triangle to include (not null, unaffected)
-
encapsulate
Enlarge the box to include the specified location.- Parameters:
location- the location to include (not null, unaffected)
-
encapsulate
Enlarge the box to include the specified triangle.- Parameters:
vertices- array of vertex locations (not null, unaffected)triangle- the triangle to include (not null, unaffected)
-
ensureMinimalEdgeLength
public void ensureMinimalEdgeLength(float minEdgeLength) Enlarge the box so that each edge has at least the specified length.- Parameters:
minEdgeLength- the desired minimum edge length
-
expandBy
Enlarge the box on all sides by the specified amounts.- Parameters:
deltas- the amount to increase the half extent on each axis (not null, unaffected)
-
sBiggest
Instantiate the biggest finite box.- Returns:
- a new JVM object with a new native object assigned
-
setEmpty
public void setEmpty()Alter the box to be empty. -
setMax
Alter the maximum coordinates. (native member: mMax)- Parameters:
max- the desired maximum coordinate for each axis (not null, unaffected)
-
setMin
Alter the minimum coordinates. (native member: mMin)- Parameters:
min- the desired minimum coordinate for each axis (not null, unaffected)
-
translate
Move by the specified offset.- Parameters:
offset- the amount to move (not null, unaffected)
-
contains
Test whether the current box contains the argument box. The current box is unaffected.- Specified by:
containsin interfaceConstAaBox- Parameters:
other- the other box to check against (not null, unaffected)- Returns:
trueif contained, otherwisefalse
-
contains
Test whether the box contains the specified point. The box is unaffected.- Specified by:
containsin interfaceConstAaBox- Parameters:
point- the point to test (not null, unaffected)- Returns:
trueif contained, otherwisefalse
-
getCenter
Locate the center of the box. The box is unaffected.- Specified by:
getCenterin interfaceConstAaBox- Returns:
- a new location vector
-
getClosestPoint
Locate the closest point on or in the box for the specified location. The box is unaffected.- Specified by:
getClosestPointin interfaceConstAaBox- Parameters:
location- the starting location (not null, unaffected)- Returns:
- a new vector
-
getExtent
Copy the (half) extent of the box. The box is unaffected.- Specified by:
getExtentin interfaceConstAaBox- Returns:
- a new vector
-
getMax
Copy the maximum contained coordinate on each axis. The box is unaffected. (native member: mMax)- Specified by:
getMaxin interfaceConstAaBox- Returns:
- a new location vector
-
getMin
Copy the minimum contained coordinate on each axis. The box is unaffected. (native member: mMin)- Specified by:
getMinin interfaceConstAaBox- Returns:
- a new location vector
-
getSize
Copy the size (full extent) on each axis. The box is unaffected.- Specified by:
getSizein interfaceConstAaBox- Returns:
- a new vector
-
getSqDistanceTo
Get the squared distance between the box and the specified point.- Specified by:
getSqDistanceToin interfaceConstAaBox- Parameters:
point- the point to measure from (not null, unaffected)- Returns:
- the distance, or zero if
pointlies inside the box
-
getSupport
Calculate the support vector for this convex shape.- Specified by:
getSupportin interfaceConstAaBox- Parameters:
direction- the direction vector- Returns:
- the support vector
-
getSurfaceArea
public float getSurfaceArea()Get surface area of bounding box.- Specified by:
getSurfaceAreain interfaceConstAaBox- Returns:
- the area
-
getVolume
public float getVolume()Return the volume of the box. The box is unaffected.- Specified by:
getVolumein interfaceConstAaBox- Returns:
- the volume
-
isValid
public boolean isValid()Test whether the box is valid. It is unaffected.- Specified by:
isValidin interfaceConstAaBox- Returns:
trueif valid, otherwisefalse
-
overlaps
Check if this box overlaps with another box.- Specified by:
overlapsin interfaceConstAaBox- Parameters:
other- the other box to check- Returns:
trueif they overlap, otherwisefalse
-
overlaps
Check if this box overlaps with a plane.- Specified by:
overlapsin interfaceConstAaBox- Parameters:
plane- thePlaneobject to be checked- Returns:
trueif they overlap, otherwisefalse
-
scaled
Return a scaled copy of the box. The current box is unaffected.- Specified by:
scaledin interfaceConstAaBox- Parameters:
factors- the scale factors to apply (not null, unaffected)- Returns:
- a new object
-
transformed
Return a transformed copy of the box. The current box is unaffected.- Specified by:
transformedin interfaceConstAaBox- Parameters:
matrix- the transformation to apply (not null, unaffected)- Returns:
- a new object
-