Example #1
0
 public EDVector3 translate(EDVector3 vec) {
   float x = vec.x * this.mat[0] + vec.y * this.mat[1] + vec.z * this.mat[2] + this.mat[3];
   float y = vec.x * this.mat[4] + vec.y * this.mat[5] + vec.z * this.mat[6] + this.mat[7];
   float z = vec.x * this.mat[8] + vec.y * this.mat[9] + vec.z * this.mat[10] + this.mat[11];
   vec.x = x;
   vec.y = y;
   vec.z = z;
   return vec;
 }
Example #2
0
 public static EDMatrix4 rotationMat(double angle, EDVector3 axis) {
   axis = axis.copy().normalize();
   float x = axis.x;
   float y = axis.y;
   float z = axis.z;
   angle *= 0.0174532925D;
   float cos = (float) Math.cos(angle);
   float ocos = 1.0F - cos;
   float sin = (float) Math.sin(angle);
   EDMatrix4 rotmat = new EDMatrix4();
   rotmat.mat[0] = (x * x * ocos + cos);
   rotmat.mat[1] = (y * x * ocos + z * sin);
   rotmat.mat[2] = (x * z * ocos - y * sin);
   rotmat.mat[4] = (x * y * ocos - z * sin);
   rotmat.mat[5] = (y * y * ocos + cos);
   rotmat.mat[6] = (y * z * ocos + x * sin);
   rotmat.mat[8] = (x * z * ocos + y * sin);
   rotmat.mat[9] = (y * z * ocos - x * sin);
   rotmat.mat[10] = (z * z * ocos + cos);
   rotmat.mat[15] = 1.0F;
   return rotmat;
 }