| Package | com.rubenswieringa.geom |
| Class | public class Geom |
| Method | Defined by | ||
|---|---|---|---|
|
degrees(radians:Number):Number
[static]
Takes a value and transforms it from degrees into radians.
| Geom | ||
|
getAngle(point1:Point, point2:Point):Number
[static]
Calculates angle (in radians) between two Points.
| Geom | ||
|
getNearest(area:Array, point:Point):int
[static]
Returns the Array index of the Point that is the nearest to a given coordinate.
| Geom | ||
|
getPointFromAngle(point:Point, angle:Number, radius:Number):Point
[static]
Calculates the position of Point #2, which is positioned on a certain amount of pixels (radius parameter) from Point #1 (point parameter) at a certain angle (angle parameter).
| Geom | ||
|
getRectIntersections(line:Line, rect:Rectangle, includeNull:Boolean = false):Array
[static]
Returns an Array of Points indicating where a Line intersects with a Rectangle.
| Geom | ||
|
isPointInCorner(rect:Rectangle, point:Point, corner:String, triangular:Boolean = true):Boolean
[static]
Indicates whether or not a Point is in a certain corner of a Rectangle.
| Geom | ||
|
radians(degrees:Number):Number
[static]
Takes a value and transforms it from radians into degrees.
| Geom | ||
|
star(radius:Number, center:Point, rotation:Number = 0, points:uint = 5):Array
[static]
Returns the coordinates of a star shape.
| Geom | ||
| Constant | Defined by | ||
|---|---|---|---|
| BL : String = "bottomleft" [static]
String representation for bottom-left.
| Geom | ||
| BOTTOM : String = "bottom" [static]
String representation for bottom.
| Geom | ||
| BR : String = "bottomright" [static]
String representation for bottom-right.
| Geom | ||
| LEFT : String = "left" [static]
String representation for left.
| Geom | ||
| RIGHT : String = "right" [static]
String representation for right.
| Geom | ||
| TL : String = "topleft" [static]
String representation for top-left.
| Geom | ||
| TOP : String = "top" [static]
String representation for top.
| Geom | ||
| TR : String = "topright" [static]
String representation for top-right.
| Geom | ||
| degrees | () | method |
public static function degrees(radians:Number):NumberTakes a value and transforms it from degrees into radians.
Parametersradians:Number — An angle in radians.
|
Number — The angle in degrees.
|
See also
| getAngle | () | method |
public static function getAngle(point1:Point, point2:Point):NumberCalculates angle (in radians) between two Points.
Parameterspoint1:Point — Point
|
|
point2:Point — Point
|
Number — Number
|
| getNearest | () | method |
public static function getNearest(area:Array, point:Point):intReturns the Array index of the Point that is the nearest to a given coordinate.
Parametersarea:Array — An Array consisting of Points.
|
|
point:Point — Point for which to look up the nearest coordinate.
|
int — Index of the nearest Point. Returns -1 if no Point instance was found in the provided Array.
|
| getPointFromAngle | () | method |
public static function getPointFromAngle(point:Point, angle:Number, radius:Number):PointCalculates the position of Point #2, which is positioned on a certain amount of pixels (radius parameter) from Point #1 (point parameter) at a certain angle (angle parameter).
Parameterspoint:Point — Point #1.
|
|
angle:Number — The angle (in radians) that Point #2 makes with Point #1.
|
|
radius:Number — The distances between Point #1 and Point #2.
|
Point — Point #2.
|
| getRectIntersections | () | method |
public static function getRectIntersections(line:Line, rect:Rectangle, includeNull:Boolean = false):ArrayReturns an Array of Points indicating where a Line intersects with a Rectangle. This method loops through all sides (Lines) of a Rectangle and stores intersections in the returned Array. Note that instead of looking up (for instance) the bottom intersection by using 2 as an index value om the returned Array, you can also use the BOTTOM constant of the SuperRectangle class. Needless to say, the same goes for the TOP, RIGHT, and LEFT constants of the SuperRectangle class.
Parametersline:Line — A Line instance.
|
|
rect:Rectangle — A Rectangle instance.
|
|
includeNull:Boolean (default = false) — When set to true non-intersections values (when the getHVLineIntersection method returns null) are also inserted into the returned Array. This might come in handy when you want to find out where an intersection from the Array occured, the first value in the Array (0) is actually the returned intersection with the top side of the Rectangle, the second (1) is the intersection with the right side of the Rectangle, and so forth. This parameter defaults to false.
|
Array — Array
|
See also
| isPointInCorner | () | method |
public static function isPointInCorner(rect:Rectangle, point:Point, corner:String, triangular:Boolean = true):BooleanIndicates whether or not a Point is in a certain corner of a Rectangle.
Parametersrect:Rectangle — Rectangle who's area to inspect.
|
|
point:Point — Point of which to find out whether or not it is in the specified corner of rect.
|
|
corner:String — Either Geom.TL, Geom.TR, Geom.BR, or Geom.BL.
|
|
triangular:Boolean (default = true) — If true, the Rectangle is imaginary split in half diagonally before the calculations are conducted. If false, the method will use Rectangle corners instead of triangular ones.
|
Boolean — true if point is in the specified corner of rect.
|
See also
| radians | () | method |
public static function radians(degrees:Number):NumberTakes a value and transforms it from radians into degrees.
Parametersdegrees:Number — An angle in degrees.
|
Number — The angle in radians.
|
See also
| star | () | method |
public static function star(radius:Number, center:Point, rotation:Number = 0, points:uint = 5):ArrayReturns the coordinates of a star shape.
Parametersradius:Number — The radius of the outer corners of the star.
|
|
center:Point — Center of the star.
|
|
rotation:Number (default = 0) — Rotation (radians) of the star.
|
|
points:uint (default = 5) — Amount of points (outer corners) that the star has. Defaults to 5.
|
Array |
| BL | constant |
public static const BL:String = "bottomleft"String representation for bottom-left.
| BOTTOM | constant |
public static const BOTTOM:String = "bottom"String representation for bottom.
| BR | constant |
public static const BR:String = "bottomright"String representation for bottom-right.
| LEFT | constant |
public static const LEFT:String = "left"String representation for left.
| RIGHT | constant |
public static const RIGHT:String = "right"String representation for right.
| TL | constant |
public static const TL:String = "topleft"String representation for top-left.
| TOP | constant |
public static const TOP:String = "top"String representation for top.
| TR | constant |
public static const TR:String = "topright"String representation for top-right.