I'm currently doing some experimental stuff with GLUT and C++ but I'm having quite a problem understanding how to calculate the point of intersect in a triangle when I've got 2 3D points to draw a line between.
Here's an example of what I need to calculate (the X Y and Z of value p)
I've got this image from http://sarvanz.blogspot.nl/2012/03/probing-using-ray-casting-in-opengl.html but I just don't understand how I can get the intersecting point X Y and Z so I can determine what triangle I clicked on my screen.
I can already determine the near and far point of the mouse position and I have acces to the triangles (it's a simple calculation that is already done in the draw loop)
Can someone explain to me how I can calculate the position of p?
The question has been closed for the following reason "I've found the answer, posted it below." by nitrocrime Feb 28 at 06:10
You need two givens to come up with the third like in the Pythagorean theorem. You start from a point of origin "0, 0, 0" and calculate the cartesian coordinate. You need a point of origin to contrast the vectors with.
answered Feb 26 at 21:13
I've found the answer!
The main problem with my code was that my cross product of 2 3D vectors was completely wrong.