**Moderator:** ARToolKit developers

Ensure that any material you post to this forum complies with Apple's iOS SDK License terms.

I have a problem, I do not know can not be achieved.I click on the iphone / iPad screen.If the interpretation of this screen coordinate conversion just inside in the 3d world coordinates of the AR model, returns a BOOL value?

I do not understand the meaning of this

I want to get the AR model is mapped to all coordinates of the 2d on the screen, there is no such method can be achieved?Help me.

- (void)convertPointInViewToRay:(CGPoint)point

{

float m[16], A[16];

float p[4], q[4];

// Find INVERSE(PROJECTION * MODELVIEW).

if (contentRotate90) {

EdenMathRotationMatrix(A, DTOR*90.0f, 0.0f, 0.0f, -1.0f);

EdenMathMultMatrix(m, cameraLens, A);

EdenMathMultMatrix(A, m, cameraPose);

} else {

EdenMathMultMatrix(A, cameraLens, cameraPose);

}

if (EdenMathInvertMatrix4x4(m, A)) {

// Next, normalise point to viewport range [-1.0, 1.0], and with depth -1.0 (i.e. at near clipping plane).

p[0] = (point.x - viewPort[viewPortIndexLeft]) * 2.0f / viewPort[viewPortIndexWidth] - 1.0f; // (winx - viewport[0]) * 2 / viewport[2] - 1.0;

p[1] = (point.y - viewPort[viewPortIndexBottom]) * 2.0f / viewPort[viewPortIndexHeight] - 1.0f; // (winy - viewport[1]) * 2 / viewport[3] - 1.0;

p[2] = -1.0f; // 2 * winz - 1.0;

p[3] = 1.0f;

// Calculate the point's world coordinates.

EdenMathMultMatrix4x4ByVector(q, m, p);

if (q[3] != 0.0f) {

rayPoint1[0] = q[0] / q[3];

rayPoint1[1] = q[1] / q[3];

rayPoint1[2] = q[2] / q[3];

// Next, a second point with depth 1.0 (i.e. at far clipping plane).

p[2] = 1.0f; // 2 * winz - 1.0;

// Calculate the point's world coordinates.

EdenMathMultMatrix4x4ByVector(q, m, p);

if (q[3] != 0.0f) {

rayPoint2[0] = q[0] / q[3];

rayPoint2[1] = q[1] / q[3];

rayPoint2[2] = q[2] / q[3];

rayIsValid = TRUE;

return;

}

}

}

rayIsValid = FALSE;

}

I want to get the AR model is mapped to all coordinates of the 2d on the screen, there is no such method can be achieved?Help me.

Why does not have a detailed pdf. Asked not answer.

- philip_lamb
- Site Admin
**Posts:**525**Joined:**Thu Mar 09, 2006 8:35 pm

This routine translates your touch on the screen into 3D coordinates of the two endpoints of a line segment corresponding to all points in the world through which that touch extends. After this call, provided rayIsValid == TRUE, rayPoint1 is the end of the ray at the near clipping plane, and rayPoint2 is the end of the ray at the far clipping plane.

To work out if your touch has intersected some object in the 3D world, you need to check for the intersection of this ray with your object.

To work out if your touch has intersected some object in the 3D world, you need to check for the intersection of this ray with your object.

Users browsing this forum: No registered users and 3 guests