touch problem

Community support forum for the ARToolKit Professional v4.x for iOS SDK.

Moderator: ARToolKit developers

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

touch problem

Postby 306806106 » Thu Apr 12, 2012 5:55 pm

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?
306806106
 
Posts: 6
Joined: Thu Apr 12, 2012 12:39 am

Re: touch problem

Postby 306806106 » Thu Apr 12, 2012 7:01 pm

I do not understand the meaning of this
- (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.
306806106
 
Posts: 6
Joined: Thu Apr 12, 2012 12:39 am

Re: touch problem

Postby 306806106 » Mon Apr 16, 2012 1:45 am

Why does not have a detailed pdf. Asked not answer.
306806106
 
Posts: 6
Joined: Thu Apr 12, 2012 12:39 am

Re: touch problem

Postby philip_lamb » Mon Apr 16, 2012 6:53 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.
User avatar
philip_lamb
Site Admin
 
Posts: 508
Joined: Thu Mar 09, 2006 8:35 pm


Return to ARToolKit for iOS

Who is online

Users browsing this forum: No registered users and 1 guest

cron