Vector3.getDistance()
Compute and returns the distance between this vector and the vector given as parameter
Parameters
Name | Type | Description | |
---|---|---|---|
1 | v | Vector3 | |
2 | square | boolean |
Return value
number
the distance between the vectors
Usage
import {Vector3} from '@lcluber/type6js';
let vector1 = new Vector3(1,1,1);
let vector2 = new Vector3(2,2,2);
let squaredDistance = vector1.getDistance(vector2, true);
let distance = vector1.getDistance(vector2, false);
console.log(squaredDistance);
console.log(distance);