Browse Source

OK, replaced transformVector3 function with Matrix4.muliplyVector

astrodud 14 years ago
parent
commit
6fc34c9693
1 changed files with 1 additions and 8 deletions
  1. 1 8
      src/extras/primitives/LathedObject.js

+ 1 - 8
src/extras/primitives/LathedObject.js

@@ -2,13 +2,6 @@
  * @author astrodud / http://astrodud.isgreat.org/
  */
 
-function transformVector3( v, m ) { // Transform a Vector3 via a Matrix4
-   var x = m.n11 * v.x + m.n12 * v.y + m.n13 * v.z + m.n14;
-   var y = m.n21 * v.x + m.n22 * v.y + m.n23 * v.z + m.n24;
-   var z = m.n31 * v.x + m.n32 * v.y + m.n33 * v.z + m.n34;
-   return( new THREE.Vector3( x, y, z ) );
-};
-
 function LathedObject( verts, nsteps, latheAngle ) {
    THREE.Geometry.call( this );
    nsteps = nsteps || 12;
@@ -24,7 +17,7 @@ function LathedObject( verts, nsteps, latheAngle ) {
    for ( var r = 0; r <= latheAngle + 0.001; r += stepSize ) { // need the +0.001 for it go up to latheAngle
       for ( var j = 0; j < newV.length; j ++ ) {
 	 if ( r < latheAngle ) {
-	    newV[ j ] = transformVector3( newV[ j ], m );
+	    newV[ j ] = m.multiplyVector3( newV[ j ].clone() );
 	    this.vertices.push( new THREE.Vertex( newV[ j ] ) );
 	    newInds[ j ] = this.vertices.length - 1;
 	 } else {