Log in or register to post comments

Convert 2D to 3D coordinate System

October 3, 2016 - 4:18am #1

I am facing problem while converting 2D coordinate system to 3D coordinate system in iOS. I would like to draw the .obj file where user taps on the screen. I went through the Dominos application. I am using the projectScreenPointToPlane and linePlaneIntersection method. From that i am using intersection.data[0] and intersection.data[1] value to draw the obj file. But all the time the obj file draws some where else from the touch position.

 

Could anyone help to me resolve this issue?

 

Thanks

 

Convert 2D to 3D coordinate System

October 3, 2016 - 7:56pm #2

I am using below code to draw the obj file in renderFrameQCAR method.

 

         projectScreenPointToPlane(QCAR::Vec2F(xPosition, yPosition), QCAR::Vec3F(0, 0, 0), QCAR::Vec3F(0, 0, 1), intersection, lineStart, lineEnd, vapp);

        QCAR::Matrix44F  objectMatrix;

        QCAR::Matrix44F transform = SampleMath::Matrix44FIdentity();

        float* transformPtr = &transform.data[0];

        SampleApplicationUtils::translatePoseMatrix(intersection.data[0] , intersection.data[1],   0.0, transformPtr);

        SampleApplicationUtils::scalePoseMatrix(80, 80, 80, transformPtr);

        SampleApplicationUtils::rotatePoseMatrix(270.0f, 0.0f, 0.0f, 1.0f, &modelViewMatrix.data[0]);

       

        SampleApplicationUtils::multiplyMatrix(&modelViewMatrix.data[0], transformPtr, &objectMatrix.data[0]);

        SampleApplicationUtils::multiplyMatrix(&vapp.projectionMatrix.data[0], &objectMatrix.data[0], &modelViewProjection.data[0]);

 

 

Could anyone help me to resolve this issue....

 

Thanks

Log in or register to post comments