Packagenet.guttershark.util.geom
Classpublic class Point
SubclassesPoint3D

The Point class plots x and y coordinates in a 2D grid.



Public Properties
 PropertyDefined by
  x : Number
The x coordinate.
Point
  y : Number
The y coordinate.
Point
Protected Properties
 PropertyDefined by
  mu : MathUtils
MathUtils
Point
Public Methods
 MethodDefined by
  
Point(x:Number = 0, y:Number = 0)
Constructor for Point instances.
Point
  
Clone this Point.
Point
  
displace(x:Number, y:Number):Point
Returns a new point based on this point with x and y offset values.
Point
  
Algo to give the grid based distance when only vertical & horizontal moves are allowed.
Point
  
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.
Point
  
getAngle(p:Point):Number
Get the angle degree between this point and a second point.
Point
  
getDistance(p:Point):Number
Get the distance between two points.
Point
  
isEqual(p:Point):Boolean
Check if two Points are equal.
Point
  
offset(x:Number, y:Number):void
Offset this Point object by a specified amount.
Point
  
rotate(p:Point, angle:Number):void
Rotate this Point around another Point by the specified angle.
Point
Property detail
muproperty
protected var mu:MathUtils

MathUtils

xproperty 
public var x:Number

The x coordinate.

yproperty 
public var y:Number

The y coordinate.

Constructor detail
Point()constructor
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.
Method detail
clone()method
public function clone():Point

Clone this Point.

Returns
Point
displace()method 
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
Point
getAbsoluteGridDistance()method 
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
Number
getAbsoluteGridDistanceAllowDiagonals()method 
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
Number
getAngle()method 
public function getAngle(p:Point):Number

Get the angle degree between this point and a second point.

Parameters
p:Point — The target Point.

Returns
Number
getDistance()method 
public function getDistance(p:Point):Number

Get the distance between two points.

Parameters
p:Point — The Point whose distance will be calculated.

Returns
Number
isEqual()method 
public function isEqual(p:Point):Boolean

Check if two Points are equal.

Parameters
p:Point — The Point to test equality against.

Returns
Boolean
offset()method 
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
rotate()method 
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.