Class com.sekati.geom.Point

Implemented Interfaces

IPoint

Description

Create a Point Object

 Usage:
 var Point = new com.sekati.geom.Point(10,10);
 

Field Index

x, y

Method Index

new Point()
clone(), displace(), getAbsoluteGridDistance(), getAbsoluteGridDistanceAllowDiagonals(), getAngle(), getDistance(), isEqual(), offset(), rotate()

Inherited from CoreObject

Constructor Detail

Point

public function Point(nX:Number, nY:Number)

Point Constructor

Parameters

nX(Number)
nY(Number)

Field Detail

x

public x:Number

y

public y:Number

Method Detail

isEqual

public function isEqual(p:Point):Boolean

check if two points match

Parameters

p(Point)

Return

Boolean

Specified By

isEqual() in com.sekati.geom.IPoint

getDistance

public function getDistance(p:Point):Number

get distance between two points

Parameters

p(Point)

Return

Number

Specified By

getDistance() in com.sekati.geom.IPoint

getAbsoluteGridDistance

public function getAbsoluteGridDistance(p:Point):Number

Algo to give the grid based distance when only vertical & horizontal moves are allowed

Parameters

p(Point)

Return

Number

getAbsoluteGridDistanceAllowDiagonals

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)

Return

Number

getAngle

public function getAngle(p:Point):Number

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

Parameters

p(Point)

Return

Number

displace

public function displace(nX:Number, nY:Number):Point

Returns a new point based on this point with x and y offset values

Parameters

nX(Number)
nY(Number)

Return

Point

Specified By

displace() in com.sekati.geom.IPoint

offset

public function offset(x:Number, y:Number):Void

Offset the Point object by a specified amount.

Parameters

x(Number) horizontal offset
y(Number) vertical offset

Return

Void

Specified By

offset() in com.sekati.geom.IPoint

rotate

public function rotate(p:Point, angle:Number):Void

Rotate this Point around another Point by the specified angle.

Parameters

p(Point)
angle(Number)

Return

Void

clone

public function clone():Point

Clone this Point.

Return

Point

Specified By

clone() in com.sekati.geom.IPoint