All pastes #780542 Raw Edit

Meins

public text v1 · immutable
·published 2007-11-18 16:41 UTC
rendered paste body
/*SETZT this.MATRIX ALS Translationsmatrix*/
 public void setTranslation(double dx, double dy, double dz){

 /*
  1 0 0 Tx
  0 1 0 Ty
  0 0 1 Tz
  0 0 0  1
 */
  this.setIdentity();
  this.setElement(0,3,dx);
  this.setElement(1,3,dy);
  this.setElement(2,3,dz);
 }

/*SETZT this.MATRIX ALS TRANSFORMATIONSMATRIX*/
 
 public void setTransformation(double rotx, double roty, double rotz, double rotdx, double rotdy, double rotdz){

 Matrix4D MatrixRotX = new Matrix4D(); MatrixRotX.setIdentity(); MatrixRotX.rotX(rotx);
 Matrix4D MatrixRotY = new Matrix4D(); MatrixRotY.setIdentity(); MatrixRotY.rotY(roty);
 Matrix4D MatrixRotZ = new Matrix4D(); MatrixRotZ.setIdentity(); MatrixRotZ.rotZ(rotz);
 
 Matrix4D MatrixTransl = new Matrix4D(); MatrixTransl.setIdentity(); MatrixTransl.setTranslation(rotdx, rotdy, rotdz);

 // REIHENFOLGE : G = Rx * Ry * Rz * T //
 
 Matrix4D ergebnis = mul(MatrixTransl,mul(MatrixRotZ,mul(MatrixRotY,MatrixRotX)));

 for (zeile=0;zeile<=3;zeile++)
  {
   for (spalte=0;spalte<=3;spalte++)
   {
   this.setElement(zeile,spalte,ergebnis.getElement(zeile,spalte));
   }
  }
 }