Archived

This topic is now archived and is closed to further replies.

ThaUnknownProgga

Point in a triangle

Recommended Posts

Ok, imagine you are viewing a triangle from overhead, IE it has a normal that is facing "up" in the world. Each vertice has a different height value, IE each vertices y values are different. Now imagine viewing that triangle overhead as if it''s a 2 dimensional picture. given an X Y coordinate (2d, remember), how would you determine the 3 dimensional y value? Argh that''s confusing, let me try some pictures. _______ | / | / | P / | / | / |/ I know P''s offset from the left side of the triangle and it''s offset from the bottom of the triangle, so to make it a 3d point i need to set it''s "height" so that it lies on the triangle at that specific place. how do i find this "height" value?

Share this post


Link to post
Share on other sites
mbarela    122
Ok, im not exactly sure what your asking. How about a little clarification. Are you looking for the the y value of the vertices or are you looking for an arbutrary point(p im assuming) in the triangle? If you are looking for an arbitrary point in the triangle you need to first test to make sure the point is contained in the triangle and then transform the point into a coordinate system based on the axes defined by the u and v values.

If your not good with this kind of stuff check out [url]www.acm.org/tog/graphicsgems[/url] or look up Badouels ray/poly intersection algorythm.



Mike Barela
mbarela@earthlink.net

Share this post


Link to post
Share on other sites