I know this is simple, but I''m having a brain meltdown right now...I''ve looked through all my books I have and can''t seem to find anything regarding parametric representation of triangles.
I''ve done a Ray-Triangle intersection test. As a result of a successful intersection, I end up with U & V coordinates for the triangle. Here is my question...
How do I compute the X,Y,Z coordinates of the intersection based upon the U & V coordinates?
Here is what I''ve done so far. It "feels" correct, but something about the results don''t seem to work 100% of the time
V = Triangle Vertex
P = Intersection Point
Any pointers will be greatly appreciated.
ok.. for ray-triangle intersection (or ray-anything intersection ) it''s easier to work with the Q(t)=Q+vt form, all you have to do is plug that into the plane equation, get the intersection point at Q+vt for the given t and then find out if the intersection point is within the triangle.
i don''t really understand what you mean by "U & V coordinates for the triangle".. are those supposed to be 2d coordinates in the triangle''s plane, or is U an offset along two edges with V being a distance along the resulting vector, or what?
Thanks for the help...I updated my code with the correct way to determine the intersection point and I am up and going.
I''m going to have to do some reading up on barycentric coordinates. I''ve seen that term thrown around, but haven''t yet taken the time to actually understand what it is.
If you are curious: I am writing a sort of level editor (non-gaming related, eventually I get around to writing games). It is for architectural walkthroughs. But, game technologies and techniques are exactly what this project calls for.
With this piece of information (the intersection point), I now have 100% accurate polygon selection with the mouse working. I''m able to determine the polygon with the closest intersection point to the camera and highlight it for the user to do something. It is really quite pleasing to see this work perfectly.
Thanks for your help!
p.s. I apologize for posting in the "wrong" forum, I am still learning this board and didn''t actually realize where I was posting, that won''t happen in the future