Packagecom.rubenswieringa.geom
Classpublic class Line
InheritanceLine Inheritance InfiniteLine

Describes a line consisting of two Points.

See also

edit 4 Before modifying and/or redistributing this class, please contact Ruben Swieringa (ruben.swieringa


Public Properties
 PropertyDefined by
  a : Point
Line's first Point.
Line
  b : Point
Line's second Point.
Line
  diffX : Number
[read-only] The outcome of Point B its x-position minus Point A its x-position.
Line
  diffY : Number
[read-only] The outcome of Point B its y-position minus Point A its y-position.
Line
 Inheritedhorizontal : Boolean
Indicates whether or not this InfiniteLine instance is horizontal.
InfiniteLine
  middle : Point
[read-only] The exact center of the first and second Points of this Line.
Line
 Inheritedvertical : Boolean
Indicates whether or not this InfiniteLine instance is vertical.
InfiniteLine
  xCoefficient : Number
Line
  xIntersection : Number
Line
  yCoefficient : Number
Line
  yIntersection : Number
Line
Public Methods
 MethodDefined by
  
Line(pointA:Point = null, pointB:Point = null)
Constructor.
Line
  
clone():*
Returns a cloned instance of this Line.
Line
  
containsLine(line:Line, round:Boolean = true):Boolean
Returns true if the provided Line is in this Line.
Line
  
containsLinePartially(line:Line, round:Boolean = true):Boolean
Returns true if the provided Line is partially in this Line.
Line
  
containsPoint(point:Point, round:Boolean = true):Boolean
Returns true if the provided coordinate is on this Line.
Line
  
createFromInfinite(line:InfiniteLine, range:Number = 100):Line
[static] Creates a Line from an InfiniteLine instance.
Line
 Inherited
createFromPoints(a:Point, b:Point):InfiniteLine
[static] Creates an InfiniteLine at the hand of two Points.
InfiniteLine
 Inherited
createFromX(xIntersection:Number, xCoefficient:Number):InfiniteLine
[static] Creates an InfiniteLine instance at the hand of an x-intersection and an x-coefficient.
InfiniteLine
 Inherited
createFromY(yIntersection:Number, yCoefficient:Number):InfiniteLine
[static] Creates an InfiniteLine instance at the hand of an y-intersection and an y-coefficient.
InfiniteLine
  
equals(line:InfiniteLine, round:Boolean = true):Boolean
Returns true if the provided Line instance is equal to this Line.
Line
 Inherited
getAngle():Number
Returns the angle of this InfiniteLine with the x-axis.
InfiniteLine
  
getIntersection(line1:Line, line2:Line):Point
[static] Returns a Point instance that represents the coordinate at which two Line instances intersect.
Line
 Inherited
getPointByX(x:Number):Point
Return a Point on this InfiniteLine where the x-position equals the specified value.
InfiniteLine
 Inherited
getPointByY(y:Number):Point
Return a Point on this InfiniteLine where the y-position equals the specified value.
InfiniteLine
 Inherited
isParallelTo(line:InfiniteLine, round:Boolean = true):Boolean
Returns true if the provided InfiniteLine instance is parallel to this InfiniteLine.
InfiniteLine
  
syncToPoints(a:Point, b:Point):void
Sets both ends of this Line instance equal to the values of the respective parameter values.
Line
  
toArray():Array
Returns an Array if which the first index and second (0 and 1) indexes are (respectively) the Line its first and second Points (a and b).
Line
  
toString():String
The String representation of this Line instance.
Line
Property detail
aproperty
a:Point  [read-write]

Line's first Point.

Implementation
    public function get a():Point
    public function set a(value:Point):void
bproperty 
b:Point  [read-write]

Line's second Point.

Implementation
    public function get b():Point
    public function set b(value:Point):void
diffXproperty 
diffX:Number  [read-only]

The outcome of Point B its x-position minus Point A its x-position.

Implementation
    public function get diffX():Number

See also

diffYproperty 
diffY:Number  [read-only]

The outcome of Point B its y-position minus Point A its y-position.

Implementation
    public function get diffY():Number

See also

middleproperty 
middle:Point  [read-only]

The exact center of the first and second Points of this Line.

Implementation
    public function get middle():Point
xCoefficientproperty 
xCoefficient:Number  [read-write]

Implementation
    public function get xCoefficient():Number
    public function set xCoefficient(value:Number):void

See also

xIntersectionproperty 
xIntersection:Number  [read-write]

Implementation
    public function get xIntersection():Number
    public function set xIntersection(value:Number):void

See also

yCoefficientproperty 
yCoefficient:Number  [read-write]

Implementation
    public function get yCoefficient():Number
    public function set yCoefficient(value:Number):void

See also

yIntersectionproperty 
yIntersection:Number  [read-write]

Implementation
    public function get yIntersection():Number
    public function set yIntersection(value:Number):void

See also

Constructor detail
Line()constructor
public function Line(pointA:Point = null, pointB:Point = null)

Constructor.

Parameters
pointA:Point (default = null) — Line's first Point.
 
pointB:Point (default = null) — Line's second Point.

See also

Method detail
clone()method
public override function clone():*

Returns a cloned instance of this Line.

Returns
* — Line
containsLine()method 
public function containsLine(line:Line, round:Boolean = true):Boolean

Returns true if the provided Line is in this Line. Note that true is only returned if both Points of the provided Line instance are on this Line.

Parameters
line:Line — Line
 
round:Boolean (default = true) — Boolean indicating whether or not to round values before making equations.

Returns
Boolean

See also

containsLinePartially()method 
public function containsLinePartially(line:Line, round:Boolean = true):Boolean

Returns true if the provided Line is partially in this Line.

Parameters
line:Line — Line
 
round:Boolean (default = true) — Boolean indicating whether or not to round values before making equations.

Returns
Boolean

See also

containsPoint()method 
public override function containsPoint(point:Point, round:Boolean = true):Boolean

Returns true if the provided coordinate is on this Line.

Parameters
point:Point — Point instance representing a coordinate.
 
round:Boolean (default = true) — Boolean indicating whether or not to round values before making equations.

Returns
Boolean

See also

createFromInfinite()method 
public static function createFromInfinite(line:InfiniteLine, range:Number = 100):Line

Creates a Line from an InfiniteLine instance.

Parameters
line:InfiniteLine — InfiniteLine
 
range:Number (default = 100) — Distance between both ends of the returned Line and the x-intersection of the InfiniteLine. Consequently, the returned Line instance its length will be twice the value of the range parameter.

Returns
Line — Line.

See also

equals()method 
public override function equals(line:InfiniteLine, round:Boolean = true):Boolean

Returns true if the provided Line instance is equal to this Line.

Parameters
line:InfiniteLine — Line
 
round:Boolean (default = true) — Boolean indicating whether or not to round values before making equations.

Returns
Boolean — Boolean

See also

getIntersection()method 
public static function getIntersection(line1:Line, line2:Line):Point

Returns a Point instance that represents the coordinate at which two Line instances intersect.

Parameters
line1:Line — Line
 
line2:Line — Line

Returns
Point — A Point instance if intersections occurs, null of otherwise.

See also

syncToPoints()method 
public override function syncToPoints(a:Point, b:Point):void

Sets both ends of this Line instance equal to the values of the respective parameter values. This method does nothing more than setting the values of the a and b properties.

Parameters
a:Point — Line's first Point.
 
b:Point — Line's second Point.

See also

toArray()method 
public function toArray():Array

Returns an Array if which the first index and second (0 and 1) indexes are (respectively) the Line its first and second Points (a and b).

Returns
Array — Array
toString()method 
public override function toString():String

The String representation of this Line instance.

Returns
String — String