Beispiel #1
0
 public void alignAxisToVec(String axisName, Vector3f vec) {
   Vector3f alignAxis = axis(axisName);
   Vector3f rotAxis = new Vector3f();
   rotAxis.cross(alignAxis, vec);
   if (rotAxis.length() == 0) rotAxis = axis(("XYZ".indexOf(axisName) + 1) % 3);
   Matrix3f rotMatrix = Matrix3f.rotation(rotAxis, alignAxis.angle(vec));
   Matrix3f ori = orientation();
   rotMatrix.mul(ori);
   orientation(rotMatrix);
 }
Beispiel #2
0
  public void rotateLocal(float x, float y, float z) {
    Matrix3f ori = orientation();

    Matrix3f rot = new Matrix3f();
    MatrixUtil.setEulerZYX(rot, x, y, z);

    ori.mul(rot);

    orientation(ori);
  }