Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     this.rotate = function(angle, axis){
  2.         var rotatemiddleX = this.cubes[1][0];
  3.         var rotatemiddleY = this.cubes[1][1];
  4.         var rotatemiddleZ = this.cubes[1][2];
  5.         for(var i = 0;i<this.cubes.length;i++){
  6.             this.cubes[i][0] = this.translate(this.cubes[i][0]-rotatemiddleX,0,0);
  7.             this.cubes[i][1] = this.translate(0,this.cubes[i][1]-rotatemiddleY,0);
  8.             this.cubes[i][2] = this.translate(0,0,this.cubes[i][2]-rotatemiddleZ);
  9.         }
  10.         for(var i = 0;i<this.cubes.length;i++){
  11.         this.cubes[i] = mult(this.cubes[i],rotate(angle,axis));
  12.         }
  13.         for(var i = 0;i<this.cubes.length;i++){
  14.             this.cubes[i][0] = this.translate(this.cubes[i][0]+rotatemiddleX,0,0);
  15.             this.cubes[i][1] = this.translate(0,this.cubes[i][1]+rotatemiddleY,0);
  16.             this.cubes[i][2] = this.translate(0,0,this.cubes[i][2]+rotatemiddleZ);
  17.         }
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement