Class: Point

Point

new Point()

Represents a point
Source:

Methods

(static) add(p1, p2) → {Point}

Adds two points
Parameters:
Name Type Description
p1 Point Point 1
p2 Point Point 2
Source:
Returns:
p1 + p2
Type
Point

(static) angle(p1, p2) → {number}

Returns the angle between two points (interpreted as Vector)
Parameters:
Name Type Description
p1 Point Point 1
p2 Point Point 2
Source:
Returns:
Angle between points in radians
Type
number

(static) interpolate(p1, p2, amountopt) → {Point}

Interpolates two points
Parameters:
Name Type Attributes Description
p1 Point Point 1
p2 Point Point 2
amount number <optional>
the influence of the secound point, default: 0.5
Source:
Returns:
p1*(1-amount) + p2*amount;
Type
Point

(static) scale(point, scale, scaleyopt) → {Point}

Scales a point by a scalar value
Parameters:
Name Type Attributes Description
point Point The point
scale number The value for scaling
scaley number <optional>
The value for scaling in y
Source:
Returns:
point*scale
Type
Point

(static) sub(p1, p2) → {Point}

Subtracts one point of another
Parameters:
Name Type Description
p1 Point Point 1
p2 Point Point to be substracted
Source:
Returns:
p1 - p2
Type
Point

clone() → {Point}

Returns a clone of this point
Source:
Returns:
a clone of this point
Type
Point

len() → {number}

Returns the Euclidian length auf this point
Source:
Returns:
the length
Type
number

normalize() → {Point}

Normalizes this point (when interpreted as 2D vector)
Source:
Returns:
this for chaining
Type
Point

reverse() → {Point}

Reverses this point (x,y) -> (-x,-y)
Source:
Returns:
this for chaining
Type
Point

rotate(phi) → {Point}

Rotates this arrow by phi radians
Parameters:
Name Type Description
phi number angle in radians
Source:
Returns:
this for chaining
Type
Point

scale() → {Point}

Scales this Point
Source:
Returns:
this for chaining
Type
Point

toSATVector() → {SAT.Vector}

Returns this arrow as SATVector represenation
Source:
Returns:
this as SAT Vector
Type
SAT.Vector