Constructor
new module:Vector(start, end)
Vector constructor
Name | Type | Description |
---|---|---|
start | PositionDefinition | Starting vector's position |
end | PositionDefinition | Ending vector's position |
- Source
Members
height
Get this vector vertical component
- Source
length
Return this vector's length
- Source
width
Get this vector horizontal component
- Source
Methods
(static) from(vectorDefinitionopt) → {Vector}
Create a Vector from a generic definition
Name | Type | Attributes | Description |
---|---|---|---|
vectorDefinition | VectorDefinition | <optional> | Vector definition |
- Source
- Type:
- Vector
add(modification) → {Vector}
Add a vector
Name | Type | Description |
---|---|---|
modification | VectorDefinition | | Any Vector or Position or Number |
- Source
Itself
- Type:
- Vector
clone() → {Vector}
Create a new copy of this vector
- Source
- Type:
- Vector
getClosestToPoint(positionDefinition) → {Position}
Find the closest position to a point on this vector
Name | Type | Description |
---|---|---|
positionDefinition | PositionDefinition | Any position |
- Source
- Type:
- Position
getDelta() → {Position}
Get the vector move with start at (0, 0)
- Source
- Type:
- Position
getIntersectionPoint(vectorDefinition) → {Position}
Return the intersection point between two vector or null if no intersection happen
Name | Type | Description |
---|---|---|
vectorDefinition | VectorDefinition | Any vector |
- Source
- Type:
- Position
intersect(vectorDefinition) → {Boolean}
Define if this vector intersect another
Name | Type | Description |
---|---|---|
vectorDefinition | VectorDefinition | Any vector |
- Source
- Type:
- Boolean
multiply(modification) → {Vector}
Multiply this vector
Name | Type | Description |
---|---|---|
modification | VectorDefinition | | Any Vector or Position or Number |
- Source
Itself
- Type:
- Vector
toJSON() → {Array.<Array.<Number>>}
Return a JSON ready Vector definition
- Source
- Type:
- Array.<Array.<Number>>
translate(modification) → {Vector}
Move this vector
Name | Type | Description |
---|---|---|
modification | VectorDefinition | | Any Vector or Position or Number |
- Source
Itself
- Type:
- Vector
(inner) sanitizeParameters(definition) → {Position|Number}
Accept all kind of type and return only Number or Position
Name | Type | Description |
---|---|---|
definition | VectorDefinition | | Value definition |
- Source
- Type:
- Position |
Number
Type Definitions
AbstractVector
- Object
Name | Type | Attributes | Description |
---|---|---|---|
start | PositionDefinition | <optional> | Start coordinates |
end | PositionDefinition | <optional> | End coordinates |
- Source
VectorDefinition
- Array.<PositionDefinition> |
AbstractVector
- Source