|
@@ -297,6 +297,25 @@ THREE.extend( THREE.Vector3.prototype, {
|
|
|
|
|
|
}(),
|
|
|
|
|
|
+ transformDirection: function ( m ) {
|
|
|
+
|
|
|
+ // input: THREE.Matrix4 affine matrix
|
|
|
+ // vector interpreted as a direction
|
|
|
+
|
|
|
+ var x = this.x, y = this.y, z = this.z;
|
|
|
+
|
|
|
+ var e = m.elements;
|
|
|
+
|
|
|
+ this.x = e[0] * x + e[4] * y + e[8] * z;
|
|
|
+ this.y = e[1] * x + e[5] * y + e[9] * z;
|
|
|
+ this.z = e[2] * x + e[6] * y + e[10] * z;
|
|
|
+
|
|
|
+ this.normalize();
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
divide: function ( v ) {
|
|
|
|
|
|
this.x /= v.x;
|