Packageflash.geom
Classpublic class Line
ImplementsIParametric

Class Line introdaction line at parametrical introduction, given by points on plane start and end and realized to support internal method lineTo().
At class realized properties and methods, they help you take access to basic geometry properties of line.
Points, belongs to line defines by time-iterator. Interator t points on line Pt equally bearing distance from point Pt at start point S with distace from end point E at start point S.

Pt = (E-S)*t    (1)


See also

Bezier
Intersection


Public Properties
 PropertyDefined by
  angle : Number
Angle of incline line at radian.
Line
  bounds : Rectangle
[read-only] Return overall rectangle of object.
Line
  end : Point
Final bearing(anchor) point of piece of line.
Line
  isSegment : Boolean
Defined, is line infinite in both side or limited in borders of interators 0-1.


Current variable isSegment influense at results of methods:
intersectionBezier
intersectionLine
getClosest
Bezier.intersectionLine
Line
  length : Number
[read-only] Calculate and return length of piece of line start-end.
Line
  start : Point
First anchor point of piece of line.
Line
Protected Properties
 PropertyDefined by
  __end : Point
Line
  __isSegment : Boolean
Line
  __start : Point
Line
Public Methods
 MethodDefined by
  
Line(start:Point, end:Point, isSegment:Boolean = true)
Line
  
angleOffset(rad:Number, fulcrum:Point = null):void
Rotate line respection at point fulcrum at current angle.
Line
  
Line
  
getClosest(fromPoint:Point):Number
Calculate and return point on line, the nearest at given.
Line
  
getPoint(time:Number, point:Point = null):Point
Calculate and return point on line, given by time-iterator.
Line
  
getSegment(fromTime:Number = 0, toTime:Number = 1):Line
Return piece of line - segment of line, given by beginning and ending interators.
Line
  
getSegmentLength(time:Number):Number
Return length of segment of line from point start at point on line, given by time-iterator.
Line
  
getTimeByDistance(distance:Number):Number
Calculate and return time-iterator of point that can be found at given distance on line from point start.
Line
  
getTimesSequence(step:Number, startShift:Number = 0):Array
Calculate and return array of points on line than can be found at distance given be parameter step.
First point of array will be moved from start point at distance, given be parameter startShift.
Line
  
Calculate and return crossing with Bezier;
Line
  
Calculate and return crossing of two lines.
Line
  
offset(dX:Number = 0, dY:Number = 0):void
Move line at given distance at axes X and Y.
Line
  
setPoint(time:Number, x:Number, y:Number):void
Change position of point end, that point Ptime take coordinates, given by parameters x and y.
Line
  
toString():String
Line
Protected Methods
 MethodDefined by
  
initInstance(start:Point, end:Point, isSegment:Boolean = true):void
Line
Protected Constants
 ConstantDefined by
  PRECISION : Number = 1e-10
Line
Property detail
angleproperty
angle:Number  [read-write]

Angle of incline line at radian. Rotate realize respecting at point start. The return value is between positive PI and negative PI.

Implementation
    public function get angle():Number
    public function set angle(value:Number):void
boundsproperty 
bounds:Rectangle  [read-only]

Return overall rectangle of object.

Implementation
    public function get bounds():Rectangle
__endproperty 
protected var __end:Point
endproperty 
end:Point  [read-write]

Final bearing(anchor) point of piece of line. Interator time equally 1.

Implementation
    public function get end():Point
    public function set end(value:Point):void
__isSegmentproperty 
protected var __isSegment:Boolean
isSegmentproperty 
isSegment:Boolean  [read-write]

Defined, is line infinite in both side or limited in borders of interators 0-1.


Current variable isSegment influense at results of methods:
intersectionBezier
intersectionLine
getClosest
Bezier.intersectionLine

The default value is true.

Implementation
    public function get isSegment():Boolean
    public function set isSegment(value:Boolean):void

See also

lengthproperty 
length:Number  [read-only]

Calculate and return length of piece of line start-end. Return number only positively;

Implementation
    public function get length():Number
__startproperty 
protected var __start:Point
startproperty 
start:Point  [read-write]

First anchor point of piece of line. Interator time equally 0.

Implementation
    public function get start():Point
    public function set start(value:Point):void
Constructor detail
Line()constructor
public function Line(start:Point, end:Point, isSegment:Boolean = true)Parameters
start:Point
 
end:Point
 
isSegment:Boolean (default = true)
Method detail
angleOffset()method
public function angleOffset(rad:Number, fulcrum:Point = null):void

Rotate line respection at point fulcrum at current angle. If point fulcrum undefined, then automatically use (0,0);

Parameters
rad:Number — angle(radian)
 
fulcrum:Point (default = null) — center of rotation. If variable undefined, center of rotation is point start
clone()method 
public function clone():Line

Returns
Line — Line copy of current object Line.
getClosest()method 
public function getClosest(fromPoint:Point):Number

Calculate and return point on line, the nearest at given.

Parameters
fromPoint:Point — - free point.

Returns
Number — Number - time-interator of point on line.

See also

isSegment
getPoint()method 
public function getPoint(time:Number, point:Point = null):Point

Calculate and return point on line, given by time-iterator.

Parameters
time:Number — time-итератор
 
point:Point (default = null)

Returns
Point — Point point on line
getSegment()method 
public function getSegment(fromTime:Number = 0, toTime:Number = 1):Line

Return piece of line - segment of line, given by beginning and ending interators.

Parameters
fromTime:Number (default = 0) — time-iterator first point of segment
 
toTime:Number (default = 1) — time-iterator end point of segment of curve

Returns
Line — Line
getSegmentLength()method 
public function getSegmentLength(time:Number):Number

Return length of segment of line from point start at point on line, given by time-iterator.

Parameters
time:Number — - iterator of point.

Returns
Number — Number
getTimeByDistance()method 
public function getTimeByDistance(distance:Number):Number

Calculate and return time-iterator of point that can be found at given distance on line from point start.

Parameters
distance:Number

Returns
Number — Number
getTimesSequence()method 
public function getTimesSequence(step:Number, startShift:Number = 0):Array

Calculate and return array of points on line than can be found at distance given be parameter step.
First point of array will be moved from start point at distance, given be parameter startShift. If variable startShift bigger then step, will be used remainder from segmentation on step.

Use this method it - calculating consecution of points for drawing dotted lines.

Parameters
step:Number
 
startShift:Number (default = 0)

Returns
Array
initInstance()method 
protected function initInstance(start:Point, end:Point, isSegment:Boolean = true):voidParameters
start:Point
 
end:Point
 
isSegment:Boolean (default = true)
intersectionBezier()method 
public function intersectionBezier(target:Bezier):Intersection

Calculate and return crossing with Bezier;

Parameters
target:Bezier

Returns
Intersection
intersectionLine()method 
public function intersectionLine(targetLine:Line):Intersection

Calculate and return crossing of two lines.

Parameters
targetLine:Line

Returns
Intersection — Intersection;

See also

offset()method 
public function offset(dX:Number = 0, dY:Number = 0):void

Move line at given distance at axes X and Y.

Parameters
dX:Number (default = 0) — variable of moving at axe X
 
dY:Number (default = 0) — variable of moving at axe Y
setPoint()method 
public function setPoint(time:Number, x:Number, y:Number):void

Change position of point end, that point Ptime take coordinates, given by parameters x and y. If parameter x or y undefined, correspond variable Ptime don't change.

Parameters
time:Number
 
x:Number
 
y:Number
toString()method 
public function toString():String

Returns
String
Constant detail
PRECISIONconstant
protected const PRECISION:Number = 1e-10