(a, b)
| 342 | } |
| 343 | |
| 344 | function rotateBetween(a, b) { |
| 345 | if(!a || !b) return; |
| 346 | var axis = cross(a, b); |
| 347 | var norm = Math.sqrt(dot(axis, axis)); |
| 348 | var halfgamma = 0.5 * Math.acos(Math.max(-1, Math.min(1, dot(a, b)))); |
| 349 | var k = Math.sin(halfgamma) / norm; |
| 350 | return norm && [Math.cos(halfgamma), axis[2] * k, -axis[1] * k, axis[0] * k]; |
| 351 | } |
| 352 | |
| 353 | // input: |
| 354 | // rotateAngles: a calculated set of Euler angles |
no test coverage detected
searching dependent graphs…