Packagenet.duncanhall.geom
Classpublic class DirectedPath
InheritanceDirectedPath Inheritance Object



Public Methods
 MethodDefined By
  
correctPath(points:Array, threshold:Number, recursive:Boolean = false, minDistance:Number = 10):Array
[static] Removes dead ends and vertices that double back on themselves from a path of consecutive points.
DirectedPath
  
correctPathRecursive(points:Array, threshold:Number, minDistance:Number = 10, maxLevels:int = 4):Array
[static] Removes dead ends and vertices that double back on themselves from a path of consecutive points.
DirectedPath
Method Detail
correctPath()method
public static function correctPath(points:Array, threshold:Number, recursive:Boolean = false, minDistance:Number = 10):Array

Removes dead ends and vertices that double back on themselves from a path of consecutive points.

Parameters

points:Array — The path of points to correct
 
threshold:Number — The minimum allowable angle between any 3 consecutive points
 
recursive:Boolean (default = false) — Whether the result of the correction will be passed back into the method
 
minDistance:Number (default = 10) — If recursive is set to true, this specifies the minimum distance allowed between 2 points when their joining point has been removed.

Returns
Array — The points along the new corrected path. If the recursive property is set to true, the first item in the array is an integer value representing the number of faults that were corrected.
correctPathRecursive()method 
public static function correctPathRecursive(points:Array, threshold:Number, minDistance:Number = 10, maxLevels:int = 4):Array

Removes dead ends and vertices that double back on themselves from a path of consecutive points. If the path is found to find faults, the path is recursively corrected until no more faults are found, or the maxLevels parameter is reached.

Parameters

points:Array — The path of points to correct
 
threshold:Number — The minimum allowable angle between any 3 consecutive points
 
minDistance:Number (default = 10) — Whether the result of the correction will be passed back into the method
 
maxLevels:int (default = 4) — If recursive is set to true, this specifies the minimum distance allowed between 2 points when their joining point has been removed.

Returns
Array — The points along the new corrected path.