Packageorg.flintparticles.twoD.zones
Classpublic class RectangleZone
InheritanceRectangleZone Inheritance Object
Implements Zone2D

The RectangleZone zone defines a rectangular shaped zone.



Public Properties
 PropertyDefined By
  bottom : Number
The bottom coordinate of the rectangle defining the region of the zone.
RectangleZone
  left : Number
The left coordinate of the rectangle defining the region of the zone.
RectangleZone
  right : Number
The right coordinate of the rectangle defining the region of the zone.
RectangleZone
  top : Number
The top coordinate of the rectangle defining the region of the zone.
RectangleZone
Public Methods
 MethodDefined By
  
RectangleZone(left:Number = 0, top:Number = 0, right:Number = 0, bottom:Number = 0)
The constructor creates a RectangleZone zone.
RectangleZone
  
collideParticle(particle:Particle2D, bounce:Number = 1):Boolean
Manages collisions between a particle and the zone.
RectangleZone
  
contains(x:Number, y:Number):Boolean
The contains method determines whether a point is inside the zone.
RectangleZone
  
getArea():Number
The getArea method returns the size of the zone.
RectangleZone
  
getLocation():Point
The getLocation method returns a random point inside the zone.
RectangleZone
Property Detail
bottomproperty
bottom:Number

The bottom coordinate of the rectangle defining the region of the zone.


Implementation
    public function get bottom():Number
    public function set bottom(value:Number):void
leftproperty 
left:Number

The left coordinate of the rectangle defining the region of the zone.


Implementation
    public function get left():Number
    public function set left(value:Number):void
rightproperty 
right:Number

The right coordinate of the rectangle defining the region of the zone.


Implementation
    public function get right():Number
    public function set right(value:Number):void
topproperty 
top:Number

The top coordinate of the rectangle defining the region of the zone.


Implementation
    public function get top():Number
    public function set top(value:Number):void
Constructor Detail
RectangleZone()Constructor
public function RectangleZone(left:Number = 0, top:Number = 0, right:Number = 0, bottom:Number = 0)

The constructor creates a RectangleZone zone.

Parameters
left:Number (default = 0) — The left coordinate of the rectangle defining the region of the zone.
 
top:Number (default = 0) — The top coordinate of the rectangle defining the region of the zone.
 
right:Number (default = 0) — The right coordinate of the rectangle defining the region of the zone.
 
bottom:Number (default = 0) — The bottom coordinate of the rectangle defining the region of the zone.
Method Detail
collideParticle()method
public function collideParticle(particle:Particle2D, bounce:Number = 1):Boolean

Manages collisions between a particle and the zone. Particles will collide with the edges of the rectangle defined for this zone, from inside or outside the zone. The collisionRadius of the particle is used when calculating the collision.

Parameters

particle:Particle2D — The particle to be tested for collision with the zone.
 
bounce:Number (default = 1) — The coefficient of restitution for the collision.

Returns
Boolean — Whether a collision occured.
contains()method 
public function contains(x:Number, y:Number):Boolean

The contains method determines whether a point is inside the zone. This method is used by the initializers and actions that use the zone. Usually, it need not be called directly by the user.

Parameters

x:Number — The x coordinate of the location to test for.
 
y:Number — The y coordinate of the location to test for.

Returns
Boolean — true if point is inside the zone, false if it is outside.
getArea()method 
public function getArea():Number

The getArea method returns the size of the zone. This method is used by the MultiZone class. Usually, it need not be called directly by the user.

Returns
Number — a random point inside the zone.
getLocation()method 
public function getLocation():Point

The getLocation method returns a random point inside the zone. This method is used by the initializers and actions that use the zone. Usually, it need not be called directly by the user.

Returns
Point — a random point inside the zone.