Packageorg.flintparticles.twoD.zones
Classpublic class LineZone
InheritanceLineZone Inheritance Object
Implements Zone2D

The LineZone zone defines a zone that contains all the points on a line.



Public Properties
 PropertyDefined By
  end : Point
The point at the other end of the line.
LineZone
  endX : Number
The x coordinate of the point at the end of the line.
LineZone
  endY : Number
The y coordinate of the point at the end of the line.
LineZone
  start : Point
The point at one end of the line.
LineZone
  startX : Number
The x coordinate of the point at the start of the line.
LineZone
  startY : Number
The y coordinate of the point at the start of the line.
LineZone
Public Methods
 MethodDefined By
  
LineZone(start:Point = null, end:Point = null)
The constructor creates a LineZone zone.
LineZone
  
collideParticle(particle:Particle2D, bounce:Number = 1):Boolean
Manages collisions between a particle and the zone.
LineZone
  
contains(x:Number, y:Number):Boolean
Determines whether a point is inside the zone.
LineZone
  
getArea():Number
Returns the size of the zone.
LineZone
  
getLocation():Point
Returns a random point inside the zone.
LineZone
Property Detail
endproperty
end:Point

The point at the other end of the line.


Implementation
    public function get end():Point
    public function set end(value:Point):void
endXproperty 
endX:Number

The x coordinate of the point at the end of the line.


Implementation
    public function get endX():Number
    public function set endX(value:Number):void
endYproperty 
endY:Number

The y coordinate of the point at the end of the line.


Implementation
    public function get endY():Number
    public function set endY(value:Number):void
startproperty 
start:Point

The point at one end of the line.


Implementation
    public function get start():Point
    public function set start(value:Point):void
startXproperty 
startX:Number

The x coordinate of the point at the start of the line.


Implementation
    public function get startX():Number
    public function set startX(value:Number):void
startYproperty 
startY:Number

The y coordinate of the point at the start of the line.


Implementation
    public function get startY():Number
    public function set startY(value:Number):void
Constructor Detail
LineZone()Constructor
public function LineZone(start:Point = null, end:Point = null)

The constructor creates a LineZone zone.

Parameters
start:Point (default = null) — The point at one end of the line.
 
end:Point (default = null) — The point at the other end of the line.
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 line defined for this zone. In the interests of speed, the collisions are not exactly accurate at the ends of the line, but are accurate enough to ensure the particle doesn't pass through the line and to look realistic in most circumstances. 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

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

Returns the size of the zone. This method is used by the MultiZone class to manage the balancing between the different zones.

Returns
Number — the size of the zone.
getLocation()method 
public function getLocation():Point

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.