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

Method equalsApproximately

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

* Check for approximate vector equality. * * @param vector The vector to compare to. * @param epsilon The allowed discrepancy for the x-values and the y-values. * @returns Whether they are approximately equal or not.

(vector, epsilon)

Source from the content-addressed store, hash-verified

29 * @returns Whether they are approximately equal or not.
30 */
31 equalsApproximately(vector, epsilon) {
32 return (
33 Math.abs(this.x - vector.x) < epsilon &&
34 Math.abs(this.y - vector.y) < epsilon
35 )
36 }
37
38 /**
39 * Vector length.

Callers 1

Vector2.test.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected