Given two glViewMatrices for two different objects, is it possible to detect a collision or distance between their centers?
I am using OpenCV’s solvepnp to get the OpenGL view matrix from the tvec and rvec with a calibrated camera. I now want to know if these two independantly tracked objects can be located relative to one another.
The viewMatrix created from the results of OpenCV’s solvePnp method, and is transposed into the OpenGL co-ordinate system (shown below).
cv::Mat glViewMatrix1 = cv::Mat::zeros(4, 4, CV_64F); cv::transpose(viewMatrix , glViewMatrix1); glMatrixMode(GL_MODELVIEW); glLoadMatrixd(&glViewMatrix1.at<double>(0, 0));
Is it possible to get the distance between the center of two models using the viewMatrix?
The vertices of the hoop are a unit circle (z is 0, centered at (0,0,0)).
The vertices of the ball are a unit sphere (centered at (0,0,0)).