Packageorg.MARS.dynamics.collision.geom
Classpublic class AABR

Axis-Aligned Bounding Rectangle

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

IBody
AABRDetector


Public Properties
 PropertyDefined 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
Public Methods
 MethodDefined 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
Property detail
maxXproperty
public var maxX:Number

maximum point on body along world x-axis

maxYproperty 
public var maxY:Number

maximum point on body along world y-axis

minXproperty 
public var minX:Number

minimum point on body along world x-axis

minYproperty 
public var minY:Number

minimum point on body along world y-axis

Constructor detail
AABR()constructor
public function AABR(minX:Number, minY:Number, maxX:Number, maxY:Number)Parameters
minX:Number
 
minY:Number
 
maxX:Number
 
maxY:Number
Method detail
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.

Parameters
rect:AABR — AABR to check for collision against instance

Returns
Boolean — true if the AABRs are coincident, false otherwise