| Package | org.MARS.dynamics.collision.geom |
| Class | public class AABR |
An AABR is a rectangle with 2 sides parallel to the world x-axis and the other 2 parallel to the world y-axis. It bounds a more complicated (or rotated) geometry. Collision detection between 2 AABRs is inexpensive. This is used for coarse-level collision detection to cull elements that aren't colliding.
See also
| Property | Defined by | ||
|---|---|---|---|
| maxX : Number maximum point on body along world x-axis
| AABR | ||
| maxY : Number maximum point on body along world y-axis
| AABR | ||
| minX : Number minimum point on body along world x-axis
| AABR | ||
| minY : Number minimum point on body along world y-axis
| AABR | ||
| Method | Defined by | ||
|---|---|---|---|
|
AABR(minX:Number, minY:Number, maxX:Number, maxY:Number)
| AABR | ||
|
hasCollision(rect:AABR):Boolean
Indicates whether instance is intersecting with
rect
This is a simple algorithm. | AABR | ||
| maxX | property |
public var maxX:Numbermaximum point on body along world x-axis
| maxY | property |
public var maxY:Numbermaximum point on body along world y-axis
| minX | property |
public var minX:Numberminimum point on body along world x-axis
| minY | property |
public var minY:Numberminimum point on body along world y-axis
| AABR | () | constructor |
public function AABR(minX:Number, minY:Number, maxX:Number, maxY:Number)Parameters
minX:Number |
|
minY:Number |
|
maxX:Number |
|
maxY:Number |
| hasCollision | () | method |
public function hasCollision(rect:AABR):Boolean
Indicates whether instance is intersecting with rect
This is a simple algorithm. If the furthest reaching extent of 1 body along the x-axis is LESS than the least reaching extent of the other body in question, the AABR's do NOT overlap. This query is repeated along each axis in each direction.
Parametersrect:AABR — AABR to check for collision against instance
|
Boolean — true if the AABRs are coincident, false otherwise
|