Quaternion getRotationColumn() question

given this code:


Vector3f left = new Vector3f(-1.0f, 0.0f, 0.0f);
Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
Vector3f dir = new Vector3f(0.0f, 0f, 1.0f);
      
Quaternion q = new Quaternion().fromAxes(left,up,dir);

System.out.println(q.getRotationColumn(0));



I'm getting (1.0, 0.0, 0.0) instead of (-1.0,0,0)

Is this right ?

try setting 1 or 2 in the getRotationColumn()

Idk if it would work tho…

Thanks, I've read the docs. The problem is that I have a left handed coordsystem and attaching a CameraNode leads to incorrect results (x flipping) as this node uses methods from the Quaternion that need right handed coordsystem.



I wanted my coordssystem very similar to the default java2d coordssystem, with:

left=0, right=width

up=0, down=height

znear=-500, zfar=10000



so that a quad (0,0,10,10) positioned at 0,0,0 appears to the upper left corner of the screen.





The best solution I've found is to setup the camera like this:



   private void initCamera(Camera cam, float width, float height)
   {      
      // consider ExtGraphics2D.VIEW3D_FOCUS = 500;

      // setup view frustum
      cam.setParallelProjection(false);
      final float focus = ExtGraphics2D.VIEW3D_FOCUS;
      final float fw = width/focus/2;
      final float fh = height/focus/2;
      cam.setFrustum(1,10000,-fw,fw,fh,-fh);   
      cam.update();
            
      // setup default camera location and vectors
      Vector3f loc = new Vector3f(width/2, height/2, focus);
      Vector3f left = new Vector3f(-1.0f, 0.0f, 0.0f);
      Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
      Vector3f dir = new Vector3f(0.0f, 0f, -1.0f);
      cam.setFrame(loc, left, up, dir);

      /** Signal that we've changed our camera's location/frustum. */
      cam.update();
   }



I think that your life would be easier if you were to use a right handed coordinate system, as it is more common to opengl programs, were as direct x uses a left handed coordinate system.