Packageorg.flintparticles.twoD.zones
Classpublic class DiscZone
InheritanceDiscZone Inheritance Object
Implements Zone2D

The DiscZone zone defines a circular zone. The zone may have a hole in the middle, like a doughnut.



Public Properties
 PropertyDefined By
  center : Point
The centre of the disc.
DiscZone
  centerX : Number
The x coordinate of the point that is the center of the disc.
DiscZone
  centerY : Number
The y coordinate of the point that is the center of the disc.
DiscZone
  innerRadius : Number
The radius of the inner edge of the disc.
DiscZone
  outerRadius : Number
The radius of the outer edge of the disc.
DiscZone
Public Methods
 MethodDefined By
  
DiscZone(center:Point = null, outerRadius:Number = 0, innerRadius:Number = 0)
The constructor defines a DiscZone zone.
DiscZone
  
collideParticle(particle:Particle2D, bounce:Number = 1):Boolean
Manages collisions between a particle and the zone.
DiscZone
  
contains(x:Number, y:Number):Boolean
The contains method determines whether a point is inside the zone.
DiscZone
  
getArea():Number
The getArea method returns the size of the zone.
DiscZone
  
getLocation():Point
The getLocation method returns a random point inside the zone.
DiscZone
Property Detail
centerproperty
center:Point

The centre of the disc.


Implementation
    public function get center():Point
    public function set center(value:Point):void
centerXproperty 
centerX:Number

The x coordinate of the point that is the center of the disc.


Implementation
    public function get centerX():Number
    public function set centerX(value:Number):void
centerYproperty 
centerY:Number

The y coordinate of the point that is the center of the disc.


Implementation
    public function get centerY():Number
    public function set centerY(value:Number):void
innerRadiusproperty 
innerRadius:Number

The radius of the inner edge of the disc.


Implementation
    public function get innerRadius():Number
    public function set innerRadius(value:Number):void
outerRadiusproperty 
outerRadius:Number

The radius of the outer edge of the disc.


Implementation
    public function get outerRadius():Number
    public function set outerRadius(value:Number):void
Constructor Detail
DiscZone()Constructor
public function DiscZone(center:Point = null, outerRadius:Number = 0, innerRadius:Number = 0)

The constructor defines a DiscZone zone.

Parameters
center:Point (default = null) — The centre of the disc.
 
outerRadius:Number (default = 0) — The radius of the outer edge of the disc.
 
innerRadius:Number (default = 0) — If set, this defines the radius of the inner edge of the disc. Points closer to the center than this inner radius are excluded from the zone. If this parameter is not set then all points inside the outer radius are included in the zone.
Method Detail
collideParticle()method
public function collideParticle(particle:Particle2D, bounce:Number = 1):Boolean

Manages collisions between a particle and the zone. The particle will collide with the edges of the disc defined for this zone, from inside or outside the disc. 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.