title: integrating JPCT-ae with QCAR(vuforia)
body: <p>i know what i am going to ask is already discussed sometimes but after going through all of them i can't found my complete answer so i am asking a new question</p>
  
  <p>when i tried integrating <a href="http://www.jpct.net/jpct-ae/" rel="nofollow noreferrer">JPCT-ae</a> with <a href="https://ar.qualcomm.at/forum/2000012" rel="nofollow noreferrer">QCAR</a> all goes well as expected, i got my modelview matrix from renderframe from jni and successfully transferred that in java to jpct model is shown perfectly as expected. but when i tried to pass this matrix to JPCT world camera my model disappear.</p>
  
  <p>my code:in onsurfacechanged:</p>
  
  <pre><code>world = new World();
              world.setAmbientLight(20, 20, 20);
              sun = new Light(world);
              sun.setIntensity(250, 250, 250);
              cube = Primitives.getCube(1);
              cube.calcTextureWrapSpherical();
              cube.strip();
              cube.build();
              world.addObject(cube);
              cam = world.getCamera();
              cam.moveCamera(Camera.CAMERA_MOVEOUT, 10);
              cam.lookAt(cube.getTransformedCenter());
              SimpleVector sv = new SimpleVector();
              sv.set(cube.getTransformedCenter());
              sv.y -= 100;
              sv.z -= 100;
              sun.setPosition(sv);
              MemoryHelper.compact();
  </code></pre>
  
  <p>and in ondraw:</p>
  
  <pre><code>com.threed.jpct.Matrix mResult = new com.threed.jpct.Matrix();
              mResult.setDump(modelviewMatrix );  //modelviewMatrix i get from Qcar
              cube.setRotationMatrix(mResult);
              cam.setBack(mResult);
                       fb.clear(back);
          world.renderScene(fb);
          world.draw(fb);
          fb.display();
  </code></pre>
  
  <p>after some research i found that QCAR uses a right-handed coordinate system meaning that the X positive goes right, the Y positive goes up and the Z positive comes out of screen but in JPCT coordinate system the X positive goes right, the Y positive goes down and the Z positive goes into the screen.</p>
  
  <p>Qcar coordinate system:</p>
  
  <p><img src="https://i.stack.imgur.com/4qH6x.jpg" alt="QCAR coordinate system"></p>
  
  <p>i know that matrix QCar is giving is a 4*4 matrix having 3*3 rotational values and translation vector . </p>
  
  <p>i am posting matrices to be more clear:</p>
  
  <p>modelviewmatrix:</p>
  
  <pre><code>1.512537      -159.66255   -10.275316   0.0
  -89.86529      -1.1592013   4.7839375            0.0
  -8.619186     10.179538     -159.44305   0.0
  59.182976        93.205956     437.2832            1.0
  </code></pre>
  
  <p>modelviewmatrix after reverse using cam.setBack(modelviewmatrix.invert(modelviewmatrix)) :</p>
  
  <pre><code>5.9083453E-5   -0.01109448   -3.3668696E-4   0.0
  0.0040540528   -3.8752193E-4   0.0047518034   0.0
  -0.004756433   -4.6811014E-4   0.0040459237   0.0
  0.7533285     0.4116795            2.7063704   0.9999999
  </code></pre>
  
  <p>if i remove 13,14 and 15 matrix element assuming 3*3 rotation matrix...model is rotated properly but translation(in and out movement of image) is not there
  finally i dont know what changes translation vector is needed.
  so please suggest me what i am missing here?</p>