The Point class plots x and y coordinates in a 2D grid.
protected var mu:MathUtils
MathUtils
public var x:Number
The x coordinate.
public var y:Number
The y coordinate.
public function Point(x:Number = 0, y:Number = 0)
Constructor for Point instances.
Parameters
| x:Number (default = 0) — The x coordinate.
|
| |
| y:Number (default = 0) — The y coordinate.
|
public function clone():Point
Clone this Point.
Returns
public function displace(x:Number, y:Number):Point
Returns a new point based on this point with x and y offset values.
Parameters
| x:Number — The x coordinate offset.
|
| |
| y:Number — The y coordinate offset.
|
Returns
public function getAbsoluteGridDistance(p:Point):Number
Algo to give the grid based distance when only vertical & horizontal moves are allowed.
Parameters
| p:Point — The target Point
|
Returns
public function getAbsoluteGridDistanceAllowDiagonals(p:Point):Number
Algo to give the grid based distance when diagonal moves are allowed
by finding math.min of the differences, we're figuring out how many moves can be diagonal ones.
Then we can just substract that number from the normal .getAbsoluteGridDistance() method since diagonals take
1 move instead of the usual 2
Parameters
| p:Point — The target Point.
|
Returns
public function getAngle(p:Point):Number
Get the angle degree between this point and a second point.
Parameters
| p:Point — The target Point.
|
Returns
public function getDistance(p:Point):Number
Get the distance between two points.
Parameters
| p:Point — The Point whose distance will be calculated.
|
Returns
public function isEqual(p:Point):Boolean
Check if two Points are equal.
Parameters
| p:Point — The Point to test equality against.
|
Returns
public function offset(x:Number, y:Number):void
Offset this Point object by a specified amount.
Parameters
| x:Number — Horizontal offset
|
| |
| y:Number — Vertical offset
|
public function rotate(p:Point, angle:Number):void
Rotate this Point around another Point by the specified angle.
Parameters
| p:Point — The target Point.
|
| |
| angle:Number — The angle to rotate around the target Point.
|