* 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)
| 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. |