Log in or register to post comments

Collision of 2 images

August 27, 2012 - 2:53pm #1

I have a 2 similar teapot image for 2 different targets. If these targets are kept very near such that both of them can be focused from mobile camera screen at the same and the both of these targets renders 2 teapots, I get 2 similar teapots at a time overlapping each other.

Can I in some way find that if a teapot is being overlapped by another teapot programmatically ?



Collision of 2 images

August 29, 2012 - 4:29pm #6

I am using 

QCAR::Matrix34F poseMatrix = trackable->getPose();

 Is this correct ? If yes, with what should I compare my indices 3,7,11 of poseMatrix to find if the teapot intersects with another one ?

Also, I have 

// Get the trackable:

        const QCAR::Trackable* trackable = state.getActiveTrackable(tIdx);

        QCAR::Matrix44F modelViewMatrix = QCAR::Tool::convertPose2GLMatrix(trackable->getPose());

in my code.

I find poseMatrix of tracable as below :

        QCAR::Matrix34F poseMatrix = trackable->getPose();

How can I find poseMatrix for individual trackable ? I have 2 or more trackable at a time. Since these trackables are same(i.e.  if 2 teapots, both of them are teapots ) . How would I find poseMatrix for each of them ?


Collision of 2 images

August 29, 2012 - 2:43pm #5

How are you obtaining the pose matrix?

getPose() is going to return a 3x4 matrix and you'll want to use the right most column (i.e. indices 3, 7, 11 ), which will give you the x,y,z coordinates relative to the camera position - the camera is 0,0,0.


Matrix34F getPose () const =0
  Returns the current pose matrix in row-major order.

Collision of 2 images

August 29, 2012 - 2:31pm #4

Thank you for your reply.

Should I compare the pose matrix(3x3 sub-matrix in left 3 columns) in

 SampleUtils::translatePoseMatrix(float x, float y, float z, float* matrix)  for each of teapots ?

The matrix passed here is 4x4 matrix, the discussion below says 3x4 pose matrix. Can you please help me know the correct matrix to compare ?




Collision of 2 images

August 28, 2012 - 9:04am #3

You should be able to do this by comparing the pose matrices of the respective Trackables. If the models are offset from the origin of their parent target, these offsets will need to be taken into account.

The pose matrix that QCAR delivers is a 3x4 matrix row-major matrix. The 3x3 sub-matrix in left three columns is a pure rotation matrix (ortho-normal), whereas the right-most column is the translation vector. The pose matrix represents the pose of the target as seen from the camera. Hence, the translation vector says where the target is as seen from the camera. A value of <0,0,0> means that camera and target are at the same position, whereas a value of <0,0,10> means that the target is 10 units away into the viewing direction of the camera (an seen in the middle of the camera image).

Collision of 2 images

August 28, 2012 - 3:46am #2

Hi nrgarach

It sounds like your question is "how can I check if two teapots collide?"

If so, then you might need to implement some kind of basic box collision for 3D objects - the kind of thing that you get for free with Unity.

Basically if each teapot lives inside a bounding box, then you can check to see if they collide with some simple maths (search the web or game forums), based around the pose/matrix for each.



Log in or register to post comments