(a, b)
| 70030 | return out; |
| 70031 | } |
| 70032 | function angle(a, b) { |
| 70033 | var x1 = a[0], y1 = a[1], x2 = b[0], y2 = b[1], // mag is the product of the magnitudes of a and b |
| 70034 | mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2), // mag &&.. short circuits if mag == 0 |
| 70035 | cosine = mag && (x1 * x2 + y1 * y2) / mag; // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1 |
| 70036 | return Math.acos(Math.min(Math.max(cosine, -1), 1)); |
| 70037 | } |
| 70038 | function zero(out) { |
| 70039 | out[0] = 0.0; |
| 70040 | out[1] = 0.0; |
no test coverage detected