Vec
Denotes a point in 2D space.
Constructor Summary
Public Constructor | ||
public |
constructor(x: number, y: number) Initializes a point. |
Member Summary
Public Members | ||
public get |
Magnitude of the vector. |
|
public |
X coordinate. |
|
public |
Y coordinate. |
Method Summary
Public Methods | ||
public |
Sums with another vector. |
|
public |
Calculates the manhattan distance with another vector. |
|
public |
Clips the vector to within the bounds of the supplied rectangle. |
|
public |
Returns an identical instance. |
|
public |
Floors all properties. |
|
public |
interpolate(f: number): Vec Linearly interpolates this vector with another. |
|
public |
Rounds all properties. |
|
public |
Scales the vector. |
|
public |
Sets the properties. |
|
public |
Difference with another vector. |
Public Constructors
Public Members
Public Methods
public add(v: Vec): Vec source
Sums with another vector.
Params:
Name | Type | Attribute | Description |
v | Vec | Other |
public blockDist(v: Vec): number source
Calculates the manhattan distance with another vector.
Params:
Name | Type | Attribute | Description |
v | Vec | Other |
public clip(rect: Rect): * source
Clips the vector to within the bounds of the supplied rectangle.
Params:
Name | Type | Attribute | Description |
rect | Rect | Bounds |
Return:
* |
public interpolate(f: number): Vec source
Linearly interpolates this vector with another.
Params:
Name | Type | Attribute | Description |
f | number | Interpolation factor |
public scale(f: number): Vec source
Scales the vector.
Params:
Name | Type | Attribute | Description |
f | number | Factor to scale by |