Packagecom.whirled.contrib.platformer.board
Classpublic class LineData

Information aboult a line segment in 2-dimensional space that allows some quick efficient operations and comparisons.



Public Properties
 PropertyDefined by
  D : Number
LineData
  ix : Number
LineData
  iy : Number
LineData
  mag : Number
LineData
  nx : Number
LineData
  ny : Number
LineData
  type : int
LineData
  x1 : Number
LineData
  x2 : Number
LineData
  y1 : Number
LineData
  y2 : Number
LineData
Protected Properties
 PropertyDefined by
  _connected : Dictionary
LineData
Public Methods
 MethodDefined by
  
LineData(x1:Number, y1:Number, x2:Number, y2:Number, type:int)
LineData
  
anyInside(lines:Array):Boolean
Returns true if any point of the supplied polygon is inside the line.
LineData
  
anyOutside(lines:Array):Boolean
Returns true if any point of the supplied polygone is outside the line.
LineData
  
LineData
  
createFromPoints(p1:Point, p2:Point, type:int):LineData
[static]
LineData
  
didCross(l1:LineData, l2:LineData):Boolean
Returns true if l1 and l2 are on opposite sides of the line but neither intersecting.
LineData
  
didCrossDelta(l1:LineData, xd:Number, yd:Number):Boolean
Returns true if l1 translated by xd, yd crosses the line without intersecting.
LineData
  
didPolyCrossDelta(lines:Array, xd:Number, yd:Number):Boolean
Returns true if any line in the polygon crosses this line after translation.
LineData
  
Returns true if l2 is intersecting or on the opposite of the line as l1.
LineData
  
doPolygonsCollide(lines:Array, olines:Array):Boolean
[static]
LineData
  
dot(x:Number, y:Number):Number
Returns the dot product of this line and the supplied point.
LineData
  
findIntersect(line:LineData):Number
Returns the distance on this line to the intersection point.
LineData
  
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.
LineData
  
getDist(x:Number, y:Number):Number
Returns the distance from the plane of this line and the supplied point.
LineData
  
getLineDist(line:LineData):Number
Determins the minimal distance between two line segments.
LineData
  
Returns the minimal line between two line segments.
LineData
  
getMinimalPolyDist(lines:Array):Array
Determins the minimal distance between a polygon and line.
LineData
  
getSegmentDist2(x:Number, y:Number):Number
Returns the square of the distance between this line segment and the supplied point.
LineData
  
getSegmentDistLine(x:Number, y:Number, type:int):LineData
Returns a minimal LineData between this line and the supplied point.
LineData
  
init():void
LineData
  
isConnected(line:LineData, convex:Boolean = true):Array
Checks if this line is connected to the supplied line.
LineData
  
isInside(x:Number, y:Number):Boolean
Returns true if this point is inside the line.
LineData
  
isIntersecting(line:LineData):Boolean
Returns true if this line segment intersects the supplied line segment.
LineData
  
isLineInside(line:LineData):Boolean
Return true if the line is completely inside.
LineData
  
isLineOutside(line:LineData):Boolean
Return true if the line is completely outside.
LineData
  
isOn(x:Number, y:Number):Boolean
Returns true if x,y is on the line segment.
LineData
  
isOutside(x:Number, y:Number):Boolean
Returns true if this point is outside the line.
LineData
  
normalDot(x:Number, y:Number):Number
Returns the dot product of the normal and the supplied point.
LineData
  
polyIntersect(lines:Array):Array
Returns the distance to the minimal intersecting distance of this line and the supplied polygon.
LineData
  
polyIntersecting(lines:Array):Boolean
Returns true if we are intersecting any part of the supplied polygon or are entirely contained in the polygon.
LineData
  
relDot(x:Number, y:Number):Number
Returns the dot product of this line and the supplied point.
LineData
  
toString():String
LineData
  
translate(x:Number, y:Number, other:LineData = null):void
Translates the line.
LineData
  
update(x1:Number, y1:Number, x2:Number, y2:Number, reset:Boolean = false):void
Updates a lines coordinates.
LineData
  
xIntersecting(line:LineData):Boolean
Returns true if the supplied line intersects the x component of our line segment.
LineData
  
yIntersecting(line:LineData):Boolean
Returns true if the supplied line intersects the y component of our line segment.
LineData
Public Constants
 ConstantDefined by
  EPSILON : Number = 0.000000001
LineData
Property detail
_connectedproperty
protected var _connected:Dictionary
Dproperty 
public var D:Number
ixproperty 
public var ix:Number
iyproperty 
public var iy:Number
magproperty 
public var mag:Number
nxproperty 
public var nx:Number
nyproperty 
public var ny:Number
typeproperty 
public var type:int
x1property 
public var x1:Number
x2property 
public var x2:Number
y1property 
public var y1:Number
y2property 
public var y2:Number
Constructor detail
LineData()constructor
public function LineData(x1:Number, y1:Number, x2:Number, y2:Number, type:int)Parameters
x1:Number
 
y1:Number
 
x2:Number
 
y2:Number
 
type:int
Method detail
anyInside()method
public function anyInside(lines:Array):Boolean

Returns true if any point of the supplied polygon is inside the line.

Parameters
lines:Array

Returns
Boolean
anyOutside()method 
public function anyOutside(lines:Array):Boolean

Returns true if any point of the supplied polygone is outside the line.

Parameters
lines:Array

Returns
Boolean
clone()method 
public function clone():LineData

Returns
LineData
createFromPoints()method 
public static function createFromPoints(p1:Point, p2:Point, type:int):LineDataParameters
p1:Point
 
p2:Point
 
type:int

Returns
LineData
didCross()method 
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
l1:LineData
 
l2:LineData

Returns
Boolean
didCrossDelta()method 
public function didCrossDelta(l1:LineData, xd:Number, yd:Number):Boolean

Returns true if l1 translated by xd, yd crosses the line without intersecting.

Parameters
l1:LineData
 
xd:Number
 
yd:Number

Returns
Boolean
didPolyCrossDelta()method 
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
Boolean
didSimpleCross()method 
public function didSimpleCross(l1:LineData, l2:LineData):Boolean

Returns true if l2 is intersecting or on the opposite of the line as l1.

Parameters
l1:LineData
 
l2:LineData

Returns
Boolean
doPolygonsCollide()method 
public static function doPolygonsCollide(lines:Array, olines:Array):BooleanParameters
lines:Array
 
olines:Array

Returns
Boolean
dot()method 
public function dot(x:Number, y:Number):Number

Returns the dot product of this line and the supplied point.

Parameters
x:Number
 
y:Number

Returns
Number
findIntersect()method 
public function findIntersect(line:LineData):Number

Returns the distance on this line to the intersection point.

Parameters
line:LineData

Returns
Number
getCircleIntersect()method 
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
Number
getDist()method 
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
x:Number
 
y:Number

Returns
Number
getLineDist()method 
public function getLineDist(line:LineData):Number

Determins the minimal distance between two line segments.

Parameters
line:LineData

Returns
Number
getMinimalLine()method 
public function getMinimalLine(line:LineData):LineData

Returns the minimal line between two line segments.

Parameters
line:LineData

Returns
LineData
getMinimalPolyDist()method 
public function getMinimalPolyDist(lines:Array):Array

Determins the minimal distance between a polygon and line.

Parameters
lines:Array

Returns
Array
getSegmentDist2()method 
public function getSegmentDist2(x:Number, y:Number):Number

Returns the square of the distance between this line segment and the supplied point.

Parameters
x:Number
 
y:Number

Returns
Number
getSegmentDistLine()method 
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
LineData
init()method 
public function init():void
isConnected()method 
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
Array
isInside()method 
public function isInside(x:Number, y:Number):Boolean

Returns true if this point is inside the line.

Parameters
x:Number
 
y:Number

Returns
Boolean
isIntersecting()method 
public function isIntersecting(line:LineData):Boolean

Returns true if this line segment intersects the supplied line segment.

Parameters
line:LineData

Returns
Boolean
isLineInside()method 
public function isLineInside(line:LineData):Boolean

Return true if the line is completely inside.

Parameters
line:LineData

Returns
Boolean
isLineOutside()method 
public function isLineOutside(line:LineData):Boolean

Return true if the line is completely outside.

Parameters
line:LineData

Returns
Boolean
isOn()method 
public function isOn(x:Number, y:Number):Boolean

Returns true if x,y is on the line segment.

Parameters
x:Number
 
y:Number

Returns
Boolean
isOutside()method 
public function isOutside(x:Number, y:Number):Boolean

Returns true if this point is outside the line.

Parameters
x:Number
 
y:Number

Returns
Boolean
normalDot()method 
public function normalDot(x:Number, y:Number):Number

Returns the dot product of the normal and the supplied point.

Parameters
x:Number
 
y:Number

Returns
Number
polyIntersect()method 
public function polyIntersect(lines:Array):Array

Returns the distance to the minimal intersecting distance of this line and the supplied polygon.

Parameters
lines:Array

Returns
Array
polyIntersecting()method 
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
lines:Array

Returns
Boolean
relDot()method 
public function relDot(x:Number, y:Number):Number

Returns the dot product of this line and the supplied point.

Parameters
x:Number
 
y:Number

Returns
Number
toString()method 
public function toString():String

Returns
String
translate()method 
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)
update()method 
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)
xIntersecting()method 
public function xIntersecting(line:LineData):Boolean

Returns true if the supplied line intersects the x component of our line segment.

Parameters
line:LineData

Returns
Boolean
yIntersecting()method 
public function yIntersecting(line:LineData):Boolean

Returns true if the supplied line intersects the y component of our line segment.

Parameters
line:LineData

Returns
Boolean
Constant detail
EPSILONconstant
public const EPSILON:Number = 0.000000001