MCPcopy Index your code
hub / github.com/plotly/plotly.js / rotateCartesian

Function rotateCartesian

src/plots/geo/zoom.js:418–430  ·  view source on GitHub ↗
(vector, axis, angle)

Source from the content-addressed store, hash-verified

416// axis is 0 (x), 1 (y), or 2 (z)
417// angle is in degrees
418function rotateCartesian(vector, axis, angle) {
419 var angleRads = angle * radians;
420 var vectorOut = vector.slice();
421 var ax1 = (axis === 0) ? 1 : 0;
422 var ax2 = (axis === 2) ? 1 : 2;
423 var cosa = Math.cos(angleRads);
424 var sina = Math.sin(angleRads);
425
426 vectorOut[ax1] = vector[ax1] * cosa - vector[ax2] * sina;
427 vectorOut[ax2] = vector[ax2] * cosa + vector[ax1] * sina;
428
429 return vectorOut;
430}
431function eulerFromQuaternion(q) {
432 return [
433 Math.atan2(2 * (q[0] * q[1] + q[2] * q[3]), 1 - 2 * (q[1] * q[1] + q[2] * q[2])) * degrees,

Callers 1

unRollFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…