Packagecom.joshtynjala.utils
Classpublic class PointUtil

A collection of utility functions for manipulating Point objects.



Public Methods
 MethodDefined by
  
angle(origin:Point, target:Point):Number
[static] Calculates the angle between two points.
PointUtil
  
dotProduct(u:Point, v:Point):Number
[static] Calculates the dot product of two points.
PointUtil
  
reverse(v:Point):Point
[static] Reverses a point around the origin.
PointUtil
  
rotate(u:Point, angleRadians:Number):Point
[static] Rotates a point around the origin.
PointUtil
  
scalarDivide(v:Point, s:Number):Point
[static] Performs scalar division on a point.
PointUtil
  
scalarMultiply(v:Point, s:Number):Point
[static] Performs scalar multiplication on a point.
PointUtil
Method detail
angle()method
public static function angle(origin:Point, target:Point):Number

Calculates the angle between two points.

Parameters
origin:Point — the first point
 
target:Point — the second point

Returns
Number — the angle in radians
dotProduct()method 
public static function dotProduct(u:Point, v:Point):Number

Calculates the dot product of two points.

Parameters
u:Point
 
v:Point

Returns
Number
reverse()method 
public static function reverse(v:Point):Point

Reverses a point around the origin. Same as a performing a scalar multiplication of -1 on the point.

Parameters
v:Point — The point to reverse. Does not alter this value.

Returns
Point — The reversed point.
rotate()method 
public static function rotate(u:Point, angleRadians:Number):Point

Rotates a point around the origin.

Parameters
u:Point — The point to rotate.
 
angleRadians:Number — The angle at which to rotate (in radians).

Returns
Point — The rotated point.
scalarDivide()method 
public static function scalarDivide(v:Point, s:Number):Point

Performs scalar division on a point.

Parameters
v:Point
 
s:Number

Returns
Point
scalarMultiply()method 
public static function scalarMultiply(v:Point, s:Number):Point

Performs scalar multiplication on a point.

Parameters
v:Point
 
s:Number

Returns
Point