Packageefnx.gfx
Classpublic class BitmapAnalyzer

BitmapAnalyzer is a collection of static functions for detecting and ordering vertices in bitmap data. This class is experimental and not in working order.



Public Properties
 PropertyDefined by
  dLines : Array
[static]
BitmapAnalyzer
  testBitmapData : BitmapData
[static]
BitmapAnalyzer
  testing : Boolean = false
[static]
BitmapAnalyzer
Public Methods
 MethodDefined by
  
BitmapAnalyzer
  
angleBetweenSlopes(m1:Number, m2:Number):Number
[static] Returns the angle between two lines with slope m1 and m2
BitmapAnalyzer
  
averageMidPoint(vertices:Array):Point
[static] Returns the middle point between a set of points by averaging all x's and y's
BitmapAnalyzer
  
combinePointsBySlope(pointSet:Array, threshold:Number):Array
[static] Returns a radially ordered set of points that make up a polygon, with all angle above theta
BitmapAnalyzer
  
combinePointsWithin(vertices:Array, distance:Number = 2):Array
[static] Finds pairs within a certain distance and combines them to one one point returns an array of points which are Numbers, not ints
BitmapAnalyzer
  
createPointsAboutPerimeter(bmd:BitmapData, distance:int = 10, threshold:uint = 0x00):Array
[static] Fills an array with points spaced somewhat uniformally about the surface of the bitmap
BitmapAnalyzer
  
distanceBetween(p1:Point, p2:Point):Number
[static] Returns the distance between two points.
BitmapAnalyzer
  
findMidPoint(vertices:Array):Point
[static] HELPER FUNCTIONS
BitmapAnalyzer
  
findSmallestDistance(vertices:Array):Number
[static] Returns the smallest distance between any of the points
BitmapAnalyzer
  
orderPointsRadially(vertices:Array):Array
[static] Orders an array of points counter clockwise from the midpoint
BitmapAnalyzer
  
pointOfIntersection(m1:Number, b1:Number, m2:Number, b2:Number):Point
[static] Returns the point of intersection of two lines
BitmapAnalyzer
  
slope(p1:Point, p2:Point):Number
[static] Returns the slope between two points.
BitmapAnalyzer
  
yIntercept(p:Point, s:Number):Number
[static] Given a point and the lines slope, determine the y-intercept // y=mx+b b=y-mx
BitmapAnalyzer
Property detail
dLinesproperty
public static var dLines:Array
testBitmapDataproperty 
public static var testBitmapData:BitmapData
testingproperty 
public static var testing:Boolean = false
Constructor detail
BitmapAnalyzer()constructor
public function BitmapAnalyzer()

Method detail
angleBetweenSlopes()method
public static function angleBetweenSlopes(m1:Number, m2:Number):Number

Returns the angle between two lines with slope m1 and m2

Parameters
m1:Number
 
m2:Number

Returns
Number
averageMidPoint()method 
public static function averageMidPoint(vertices:Array):Point

Returns the middle point between a set of points by averaging all x's and y's

Parameters
vertices:Array

Returns
Point
combinePointsBySlope()method 
public static function combinePointsBySlope(pointSet:Array, threshold:Number):Array

Returns a radially ordered set of points that make up a polygon, with all angle above theta

Parameters
pointSet:Array
 
threshold:Number

Returns
Array
combinePointsWithin()method 
public static function combinePointsWithin(vertices:Array, distance:Number = 2):Array

Finds pairs within a certain distance and combines them to one one point returns an array of points which are Numbers, not ints

Parameters
vertices:Array
 
distance:Number (default = 2)

Returns
Array
createPointsAboutPerimeter()method 
public static function createPointsAboutPerimeter(bmd:BitmapData, distance:int = 10, threshold:uint = 0x00):Array

Fills an array with points spaced somewhat uniformally about the surface of the bitmap

Parameters
bmd:BitmapData
 
distance:int (default = 10)
 
threshold:uint (default = 0x00)

Returns
Array
distanceBetween()method 
public static function distanceBetween(p1:Point, p2:Point):Number

Returns the distance between two points.

Parameters
p1:Point
 
p2:Point

Returns
Number
findMidPoint()method 
public static function findMidPoint(vertices:Array):Point

HELPER FUNCTIONS

Parameters
vertices:Array

Returns
Point
findSmallestDistance()method 
public static function findSmallestDistance(vertices:Array):Number

Returns the smallest distance between any of the points

Parameters
vertices:Array

Returns
Number
orderPointsRadially()method 
public static function orderPointsRadially(vertices:Array):Array

Orders an array of points counter clockwise from the midpoint

Parameters
vertices:Array

Returns
Array
pointOfIntersection()method 
public static function pointOfIntersection(m1:Number, b1:Number, m2:Number, b2:Number):Point

Returns the point of intersection of two lines

Parameters
m1:Number
 
b1:Number
 
m2:Number
 
b2:Number

Returns
Point
slope()method 
public static function slope(p1:Point, p2:Point):Number

Returns the slope between two points.

Parameters
p1:Point
 
p2:Point

Returns
Number
yIntercept()method 
public static function yIntercept(p:Point, s:Number):Number

Given a point and the lines slope, determine the y-intercept // y=mx+b b=y-mx

Parameters
p:Point
 
s:Number

Returns
Number