AABB
Script Reference | AABB Functions |
CenterPoint
Gets the center of the bounding box.
Parameters: none
Returns: Vector3 - center point of the AABB.
Example: <syntaxhighlight lang="java">
b = AABB(); v = b.CenterPoint();</syntaxhighlight>
Contains
Checks if the bounding box contains a point.
Parameters: (Vector3)
Returns: true if Vector3 parameter is contained within AABB, false if not.
Example: <syntaxhighlight lang="java">
b = AABB(); v = Vector3(); if(b.Contains(v)) { print("v is inside b"); }</syntaxhighlight>
Expand
Expands the bounding box to contain a position.
Parameters: (Vector3)
Returns: none
Example: <syntaxhighlight lang="java">
b = AABB(); v1 = Vector3(40,50,60); v2 = Vector3(30,10,90); b.Expand(v1); b.Expand(v2);</syntaxhighlight>
FindIntersection
Gets the AABB overlap of 2 bounding boxes.
Parameters: (AABB)
Returns: AABB the bounds that overlaps the bounding box. Null if there is no overlap.
Example: <syntaxhighlight lang="java">
b = AABB(); b2 = AABB(); overlapAABB = b.FindIntersection(b2); if(overlapAABB) { print("b overlaps b2"); }</syntaxhighlight>
GetAxisLength
Gets the length of an axis of the bounding box.
Parameters: ("x"),("y"),or ("z")
Returns: float - length of requested AABB axis.
Example: <syntaxhighlight lang="java">
b = AABB(); xlen = b.GetAxisLength("x");</syntaxhighlight>
Intersects
Checks if 2 AABBs intersect.
Parameters: (AABB)
Returns: true if AABB overlaps this AABB, false if not.
Example: <syntaxhighlight lang="java">
b = AABB(); b2 = AABB(); if(b.Intersects(b2)) { print("b touches b2"); }</syntaxhighlight>
IsZero
Checks if the AABB is has no volume.
Parameters: none
Returns: true if the AABB is not defined(0,0,0 for mins and maxs)
Example: <syntaxhighlight lang="java">
b = AABB(); if(b.IsZero()) { }</syntaxhighlight>
Scale
Scales the AABB by some amount in every direction.
Parameters: (float)
Returns: none
Example: <syntaxhighlight lang="java">
b = AABB(); b.Scale(10);</syntaxhighlight>
Set
Initializes the AABB mins and maxs.
Parameters: (Vector3, Vector3)
Returns: none
Example: <syntaxhighlight lang="java">
b = AABB(); min = Vector3(-10, -10, -10); max = Vector3(10, 10, 10); b.Set(min, max);</syntaxhighlight>
SetCenter
Translates the bounding box to some position. Usually used to move a local space bounding box to world space.
Parameters: (Vector3)
Returns: none
Example: <syntaxhighlight lang="java">
b = AABB(); c = Vector3(10, 10, 10); b.SetCenter(c);</syntaxhighlight>