Information aboult a line segment in 2-dimensional space that allows some quick efficient
operations and comparisons.
protected var _connected:Dictionary
public var D:Number
public var ix:Number
public var iy:Number
public var mag:Number
public var nx:Number
public var ny:Number
public var type:int
public var x1:Number
public var x2:Number
public var y1:Number
public var y2:Number
public function LineData(x1:Number, y1:Number, x2:Number, y2:Number, type:int)Parameters
| x1:Number |
| |
| y1:Number |
| |
| x2:Number |
| |
| y2:Number |
| |
| type:int |
public function anyInside(lines:Array):Boolean
Returns true if any point of the supplied polygon is inside the line.
Parameters
Returns
public function anyOutside(lines:Array):Boolean
Returns true if any point of the supplied polygone is outside the line.
Parameters
Returns
public function clone():LineData
Returns
public static function createFromPoints(p1:Point, p2:Point, type:int):LineDataParameters
| p1:Point |
| |
| p2:Point |
| |
| type:int |
Returns
public function didCross(l1:LineData, l2:LineData):Boolean
Returns true if l1 and l2 are on opposite sides of the line but neither intersecting.
Parameters
Returns
public function didCrossDelta(l1:LineData, xd:Number, yd:Number):Boolean
Returns true if l1 translated by xd, yd crosses the line without intersecting.
Parameters
Returns
public function didPolyCrossDelta(lines:Array, xd:Number, yd:Number):Boolean
Returns true if any line in the polygon crosses this line after translation.
Parameters
| lines:Array |
| |
| xd:Number |
| |
| yd:Number |
Returns
public function didSimpleCross(l1:LineData, l2:LineData):Boolean
Returns true if l2 is intersecting or on the opposite of the line as l1.
Parameters
Returns
public static function doPolygonsCollide(lines:Array, olines:Array):BooleanParameters
Returns
public function dot(x:Number, y:Number):Number
Returns the dot product of this line and the supplied point.
Parameters
Returns
public function findIntersect(line:LineData):Number
Returns the distance on this line to the intersection point.
Parameters
Returns
public function getCircleIntersect(x:Number, y:Number, rad:Number):Number
Returns the distance on the line to the near intersection between this line and the
supplied circle.
Parameters
| x:Number |
| |
| y:Number |
| |
| rad:Number |
Returns
public function getDist(x:Number, y:Number):Number
Returns the distance from the plane of this line and the supplied point. The distance is
positive if the point is outside the line, negative if the point is inside the line or zero
if the point is on the line.
Parameters
Returns
public function getLineDist(line:LineData):Number
Determins the minimal distance between two line segments.
Parameters
Returns
public function getMinimalLine(line:LineData):LineData
Returns the minimal line between two line segments.
Parameters
Returns
public function getMinimalPolyDist(lines:Array):Array
Determins the minimal distance between a polygon and line.
Parameters
Returns
public function getSegmentDist2(x:Number, y:Number):Number
Returns the square of the distance between this line segment and the supplied point.
Parameters
Returns
public function getSegmentDistLine(x:Number, y:Number, type:int):LineData
Returns a minimal LineData between this line and the supplied point.
Parameters
| x:Number |
| |
| y:Number |
| |
| type:int |
Returns
public function init():void
public function isConnected(line:LineData, convex:Boolean = true):Array
Checks if this line is connected to the supplied line. If convex is true, then the two
lines must be connected and form a convex shape that will prevent collision from outside
the lines.
returns: An array of 2 values containing the distance of the non-connected points to
the other line.
Parameters
| line:LineData |
| |
| convex:Boolean (default = true) |
Returns
public function isInside(x:Number, y:Number):Boolean
Returns true if this point is inside the line.
Parameters
Returns
public function isIntersecting(line:LineData):Boolean
Returns true if this line segment intersects the supplied line segment.
Parameters
Returns
public function isLineInside(line:LineData):Boolean
Return true if the line is completely inside.
Parameters
Returns
public function isLineOutside(line:LineData):Boolean
Return true if the line is completely outside.
Parameters
Returns
public function isOn(x:Number, y:Number):Boolean
Returns true if x,y is on the line segment.
Parameters
Returns
public function isOutside(x:Number, y:Number):Boolean
Returns true if this point is outside the line.
Parameters
Returns
public function normalDot(x:Number, y:Number):Number
Returns the dot product of the normal and the supplied point.
Parameters
Returns
public function polyIntersect(lines:Array):Array
Returns the distance to the minimal intersecting distance of this line and the supplied
polygon.
Parameters
Returns
public function polyIntersecting(lines:Array):Boolean
Returns true if we are intersecting any part of the supplied polygon or are entirely
contained in the polygon.
Parameters
Returns
public function relDot(x:Number, y:Number):Number
Returns the dot product of this line and the supplied point.
Parameters
Returns
public function toString():String
Returns
public function translate(x:Number, y:Number, other:LineData = null):void
Translates the line. If an other line is supplied, the other line is moved to this lines
translated position (and this line is remained unchanged). The other line should have the
same angle and magnitude.
Parameters
| x:Number |
| |
| y:Number |
| |
| other:LineData (default = null) |
public function update(x1:Number, y1:Number, x2:Number, y2:Number, reset:Boolean = false):void
Updates a lines coordinates. The supplied coordinates should have the same angle as the
old line values, but the magnitude can change.
Parameters
| x1:Number |
| |
| y1:Number |
| |
| x2:Number |
| |
| y2:Number |
| |
| reset:Boolean (default = false) |
public function xIntersecting(line:LineData):Boolean
Returns true if the supplied line intersects the x component of our line segment.
Parameters
Returns
public function yIntersecting(line:LineData):Boolean
Returns true if the supplied line intersects the y component of our line segment.
Parameters
Returns
public const EPSILON:Number = 0.000000001