vec2
Fields
| Name | Type | Description | Access rights |
|---|---|---|---|
| x | number | x coordinate | read/write |
| y | number | y coordinate | read/write |
Example
vector = vec2( 2, 3 ) -- or vector = vec2( )
utility.println( 'x:' .. vector.x .. ' y:' .. vector.y )
Methods
| Method | Description | Returns |
|---|---|---|
| length( ) | calculates the length | number |
| dot( other ) | calculates the dot product | number |
vec2:length( )
Description
Calculates the length of the vector.
Example
Returns
number - length of the vector
vec2:dot( )
Description
Calculates the dot product of two vectors.
Arguments
| Name | Type | Description |
|---|---|---|
| other | vec2 | the other vector |
Example
Returns
number - dot product of the two vectors