Chromium Code Reviews| 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..eed79f946032bbb6ac6714f37e24566f26c994aa 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/common/Geometry.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/common/Geometry.js |
| @@ -200,6 +200,25 @@ WebInspector.Geometry.EulerAngles.fromRotationMatrix = function(rotationMatrix) |
| return new WebInspector.Geometry.EulerAngles(WebInspector.Geometry.radToDeg(alpha), WebInspector.Geometry.radToDeg(beta), WebInspector.Geometry.radToDeg(gamma)); |
| } |
| +WebInspector.Geometry.EulerAngles.prototype = { |
| + /** |
| + * @return {string} |
| + */ |
| + toRotate3DString: function() |
| + { |
| + var gammaAxisY = Math.sin(WebInspector.Geometry.degToRad(this.beta)); |
| + var gammaAxisZ = Math.cos(WebInspector.Geometry.degToRad(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)"; |
| + } |
| +} |
| + |
| /** |
| * @param {!WebInspector.Geometry.Vector} u |
| * @param {!WebInspector.Geometry.Vector} v |
| @@ -268,6 +287,15 @@ WebInspector.Geometry.calculateAngle = function(u, v) |
| } |
| /** |
| + * @param {number} deg |
| + * @return {number} |
| + */ |
| +WebInspector.Geometry.degToRad = function(deg) |
|
lushnikov
2016/05/16 21:51:08
.toRadians =
We avoid abbreviations as much as p
luoe
2016/05/16 22:15:56
Sounds good. I was trying to match the style of "
|
| +{ |
| + return deg * Math.PI / 180; |
| +} |
| + |
| +/** |
| * @param {number} rad |
| * @return {number} |
| */ |