Vector3.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 {Vector3} from '@lcluber/type6js';
let vector = new Vector3(-2,-2,-2);
let squaredMagnitude = vector.getMagnitude(true);
let magnitude = vector.getMagnitude(false);
console.log(squaredMagnitude);
console.log(magnitude);