Methods
(static) add(p1, p2) → {Point}
Adds two points
Parameters:
Name | Type | Description |
---|---|---|
p1 |
Point | Point 1 |
p2 |
Point | Point 2 |
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 |
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 |
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 |
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 |
Returns:
p1 - p2
- Type
- Point
clone() → {Point}
Returns a clone of this point
Returns:
a clone of this point
- Type
- Point
len() → {number}
Returns the Euclidian length auf this point
Returns:
the length
- Type
- number
normalize() → {Point}
Normalizes this point (when interpreted as 2D vector)
Returns:
this for chaining
- Type
- Point
reverse() → {Point}
Reverses this point (x,y) -> (-x,-y)
Returns:
this for chaining
- Type
- Point
rotate(phi) → {Point}
Rotates this arrow by phi radians
Parameters:
Name | Type | Description |
---|---|---|
phi |
number | angle in radians |
Returns:
this for chaining
- Type
- Point
scale() → {Point}
Scales this Point
Returns:
this for chaining
- Type
- Point
toSATVector() → {SAT.Vector}
Returns this arrow as SATVector represenation
Returns:
this as SAT Vector
- Type
- SAT.Vector