What if camera vectors are not orthogonal?

hey there.



i am currently writing a CameraAnimationController that also enables you to animate the up, left, and direction vectors. that means you provide these three vectors to every point in a normal curve and the CameraAnimationController interpolates the camera vectors inbetween. this means that the up, left and direction vectors are not absolutely orthogonal (because interpolation is not perfect. mostly they are off by 0.0005 or so.



my question is: the javadoc of Quaternion.fromAxes(x, y, z) says that i have to provide orthogonal vectors and no error checking is done. but since the animation works quite well even with the vectors being off a little: what happens (or can happen) when they are not absolutely orthogonal (MOD: things get pretty messed up when you attach / align something else to the camera node and the camera jumps around sometimes)? how can i make the two of these vectors orthogonal to the other one?



thx in advance,

Andy



PS.: jME @ JavaOne rocked!

well, as always: "think of the solution, not about the problem!"



i just make them orthogonal in case they are not:



      curUp.normalizeLocal();
      curLeft.normalizeLocal();
      curDir.normalizeLocal();
     
      tmpVec = curUp.cross(curDir);
      if(FastMath.acos(curLeft.dot(tmpVec)) * FastMath.RAD_TO_DEG > 90) {
        tmpVec.multLocal(-1);
      } // if
      curLeft = tmpVec;
     
      tmpVec = curUp.cross(curLeft);
      if(FastMath.acos(curDir.dot(tmpVec)) * FastMath.RAD_TO_DEG > 90) {
        tmpVec.multLocal(-1);
      } // if
      curDir = tmpVec;



i will share the CameraAnimationController when i'm done.

so long,
Andy

there we go: http://www.jmonkeyengine.com/jmeforum/index.php?topic=7953.0