Package limn.math
Record Class Aabb
java.lang.Object
java.lang.Record
limn.math.Aabb
An axis-aligned bounding box. Used for the broadphase of picking and (later)
frustum culling. Build one by folding points into
EMPTY with
union(limn.math.Vec3).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AabbInverted/empty box (min = +∞, max = −∞), the identity forunion(limn.math.Vec3). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncenter()Midpoint of the box.final booleanIndicates whether some other object is "equal to" this one.extent()Full size per axis:max - min, not the half-extent.final inthashCode()Returns a hash code value for this object.floatRay/box intersection (slab method).booleanisEmpty()Whether the box is inverted on any axis, which is whatEMPTYis.max()Returns the value of themaxrecord component.min()Returns the value of theminrecord component.static AabbA box from explicit corners; the caller guaranteesmin <= maxper axis.final StringtoString()Returns a string representation of this record class.World-space AABB of this box transformed by an affinem(bottom row 0,0,0,1, which every model/world matrix has).This box grown to contain another;EMPTYis the identity.This box grown to containp.
-
Field Details
-
EMPTY
Inverted/empty box (min = +∞, max = −∞), the identity forunion(limn.math.Vec3).
-
-
Constructor Details
-
Aabb
Creates an instance of aAabbrecord class.- Parameters:
min- the value for theminrecord componentmax- the value for themaxrecord component
-
-
Method Details
-
of
A box from explicit corners; the caller guaranteesmin <= maxper axis. -
union
This box grown to containp. -
union
This box grown to contain another;EMPTYis the identity. -
isEmpty
public boolean isEmpty()Whether the box is inverted on any axis, which is whatEMPTYis. -
center
Midpoint of the box. Meaningless whenisEmpty(). -
extent
Full size per axis:max - min, not the half-extent. -
transformedBy
World-space AABB of this box transformed by an affinem(bottom row 0,0,0,1, which every model/world matrix has). Arvo's method: new center = M·c, new half-extent = |M|·h. That is equivalent to transforming the 8 corners but allocation-light (runs per mesh per frame for culling). An empty box staysEMPTY. -
intersect
Ray/box intersection (slab method). Returns the nearest non-negative distancetof entry (or0if the origin is inside), orFloat.NaNif the ray misses. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
min
Returns the value of theminrecord component.- Returns:
- the value of the
minrecord component
-
max
Returns the value of themaxrecord component.- Returns:
- the value of the
maxrecord component
-