From 6c7a4898de89c3b1872ccaa080a9c8251e41a275 Mon Sep 17 00:00:00 2001 From: Ben Houston Date: Fri, 19 Dec 2014 12:11:49 -0500 Subject: [PATCH] Matrix4.makeShear - standard shear constructor with optional Autodesk Maya style construction. --- src/math/Matrix4.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/math/Matrix4.js b/src/math/Matrix4.js index 331178df72..80c77e0c64 100644 --- a/src/math/Matrix4.js +++ b/src/math/Matrix4.js @@ -146,6 +146,35 @@ THREE.Matrix4.prototype = { }(), + makeShear: function ( vector3Shear, reverseStyle ) { + + var xy = vector3Shear.x; + var xz = vector3Shear.y; + var yz = vector3Shear.z; + + if ( reverseStyle ) { + + this.set( + 1, 0, 0, 0, + xy, 1, 0, 0, + xz, yz, 1, 0, + 0, 0, 0, 1 + ); + + } else { + // Maya style + this.set( + 1, xy, xz, 0, + 0, 1, yz, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ); + } + + return this; + + }, + makeRotationFromEuler: function ( euler ) { if ( euler instanceof THREE.Euler === false ) { -- GitLab