| Index: third_party/WebKit/Source/devtools/front_end/common/Geometry.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/common/Geometry.js b/third_party/WebKit/Source/devtools/front_end/common/Geometry.js
|
| index 4f51a59574eb9dd99ecc96100967259d8a417d48..1f8284c3f86d3ea6f6afd815c4ec0dfc9b7bc708 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/common/Geometry.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/common/Geometry.js
|
| @@ -197,7 +197,26 @@ WebInspector.Geometry.EulerAngles.fromRotationMatrix = function(rotationMatrix)
|
| var beta = Math.atan2(rotationMatrix.m23, rotationMatrix.m33);
|
| var gamma = Math.atan2(-rotationMatrix.m13, Math.sqrt(rotationMatrix.m11 * rotationMatrix.m11 + rotationMatrix.m12 * rotationMatrix.m12));
|
| var alpha = Math.atan2(rotationMatrix.m12, rotationMatrix.m11);
|
| - return new WebInspector.Geometry.EulerAngles(WebInspector.Geometry.radToDeg(alpha), WebInspector.Geometry.radToDeg(beta), WebInspector.Geometry.radToDeg(gamma));
|
| + return new WebInspector.Geometry.EulerAngles(WebInspector.Geometry.radiansToDegrees(alpha), WebInspector.Geometry.radiansToDegrees(beta), WebInspector.Geometry.radiansToDegrees(gamma));
|
| +}
|
| +
|
| +WebInspector.Geometry.EulerAngles.prototype = {
|
| + /**
|
| + * @return {string}
|
| + */
|
| + toRotate3DString: function()
|
| + {
|
| + var gammaAxisY = Math.sin(WebInspector.Geometry.degreesToRadians(this.beta));
|
| + var gammaAxisZ = Math.cos(WebInspector.Geometry.degreesToRadians(this.beta));
|
| + var axis = {
|
| + alpha: [0, -1, 0],
|
| + beta: [1, 0, 0],
|
| + gamma: [0, gammaAxisY, gammaAxisZ]
|
| + };
|
| + return "rotate3d(" + axis.alpha.join(",") + "," + this.alpha + "deg) "
|
| + + "rotate3d(" + axis.beta.join(",") + "," + this.beta + "deg) "
|
| + + "rotate3d(" + axis.gamma.join(",") + "," + this.gamma + "deg)";
|
| + }
|
| }
|
|
|
| /**
|
| @@ -264,14 +283,23 @@ WebInspector.Geometry.calculateAngle = function(u, v)
|
| var cos = WebInspector.Geometry.scalarProduct(u, v) / uLength / vLength;
|
| if (Math.abs(cos) > 1)
|
| return 0;
|
| - return WebInspector.Geometry.radToDeg(Math.acos(cos));
|
| + return WebInspector.Geometry.radiansToDegrees(Math.acos(cos));
|
| +}
|
| +
|
| +/**
|
| + * @param {number} deg
|
| + * @return {number}
|
| + */
|
| +WebInspector.Geometry.degreesToRadians = function(deg)
|
| +{
|
| + return deg * Math.PI / 180;
|
| }
|
|
|
| /**
|
| * @param {number} rad
|
| * @return {number}
|
| */
|
| -WebInspector.Geometry.radToDeg = function(rad)
|
| +WebInspector.Geometry.radiansToDegrees = function(rad)
|
| {
|
| return rad * 180 / Math.PI;
|
| }
|
|
|