Vector2.getMagnitude()
Compute and return the magnitude of the vector
Parameters
Name | Type | Description | |
---|---|---|---|
1 | square | boolean |
Return value
number
The magnitude of the vector or the squared magnitude depending on the given parameter
Usage
import {Vector2} from '@lcluber/type6js';
let vector = new Vector2(-2,-2);
let squaredMagnitude = vector.getMagnitude(true);
let magnitude = vector.getMagnitude(false);
console.log(squaredMagnitude);
console.log(magnitude);