Packagecom.transmote.utils.geom
Classpublic class Line
InheritanceLine Inheritance Object

Represents a 2D line segment.



Public Properties
 PropertyDefined By
  x1 : Number
Line
  x2 : Number
Line
  y1 : Number
Line
  y2 : Number
Line
Public Methods
 MethodDefined By
  
Line(x1:Number = 0.0, y1:Number = 0.0, x2:Number = 0.0, y2:Number = 0.0)
constructs and initializes a Line from the specified coordinates.
Line
  
createLineByPointAngleLength(pt:Point, angleInRadians:Number, length:Number):Line
[static] returns the Line from a starting point, of a given angle and length.
Line
  
createLineByPoints(pt1:Point, pt2:Point):Line
[static] returns the Line defined by two Points.
Line
  
getAngle():Number
angle of this Line (in radians).
Line
  
getBounds():Rectangle
Line
  
getIntersection(line:Line, bWithinSegmentBounds:Boolean = false):Point
returns the Point of intersection of this and another Line.
Line
  
getPt1():Point
retrieve Line startpoint.
Line
  
getPt2():Point
retrieve Line endpoint.
Line
  
getSlope():Number
Line
  
getYIntercept():Number
Line
Property Detail
x1property
public var x1:Number

x2property 
public var x2:Number

y1property 
public var y1:Number

y2property 
public var y2:Number

Constructor Detail
Line()Constructor
public function Line(x1:Number = 0.0, y1:Number = 0.0, x2:Number = 0.0, y2:Number = 0.0)

constructs and initializes a Line from the specified coordinates.

Parameters
x1:Number (default = 0.0)
 
y1:Number (default = 0.0)
 
x2:Number (default = 0.0)
 
y2:Number (default = 0.0)
Method Detail
createLineByPointAngleLength()method
public static function createLineByPointAngleLength(pt:Point, angleInRadians:Number, length:Number):Line

returns the Line from a starting point, of a given angle and length.

Parameters

pt:Point — line startpont.
 
angleInRadians:Number — angle in radians.
 
length:Number — line length.

Returns
Line — calculated Line. TODO: not yet tested.
createLineByPoints()method 
public static function createLineByPoints(pt1:Point, pt2:Point):Line

returns the Line defined by two Points.

Parameters

pt1:Point — line startpoint.
 
pt2:Point — line endpoint.

Returns
Line — calculated Line.
getAngle()method 
public function getAngle():Number

angle of this Line (in radians).

Returns
Number
getBounds()method 
public function getBounds():Rectangle

Returns
Rectangle
getIntersection()method 
public function getIntersection(line:Line, bWithinSegmentBounds:Boolean = false):Point

returns the Point of intersection of this and another Line. if Lines are parallel, returns null.

Parameters

line:Line — other Line with which to find intersection.
 
bWithinSegmentBounds:Boolean (default = false) — if true, returns intersections only with Line.getBounds of each Line.

Returns
Point
getPt1()method 
public function getPt1():Point

retrieve Line startpoint.

Returns
Point
getPt2()method 
public function getPt2():Point

retrieve Line endpoint.

Returns
Point
getSlope()method 
public function getSlope():Number

Returns
Number
getYIntercept()method 
public function getYIntercept():Number

Returns
Number