MCPcopy Create free account
hub / github.com/TheAlgorithms/JavaScript / distance

Method distance

Data-Structures/Vectors/Vector2.js:102–105  ·  view source on GitHub ↗

* Distance between this vector and another vector. * * @param vector The vector to which to calculate the distance. * @returns The distance.

(vector)

Source from the content-addressed store, hash-verified

100 * @returns The distance.
101 */
102 distance(vector) {
103 const difference = vector.subtract(this)
104 return difference.length()
105 }
106
107 /**
108 * Vector dot product

Callers 1

Vector2.test.jsFile · 0.80

Calls 2

subtractMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected