Jump to content
  • Advertisement
Sign in to follow this  
stargazer2k

Point of intersection inside 3D triangle?

This topic is 4884 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Lets say I have a triangle with V1(x,y,z), V2(x,y,z) and V3(x,y,z) and a point P(x,y) inside the triangle. How can I compute for P(z) if values of V1, V2, V3 and P(x,y) are known? I'm not good in math, please help. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Treat the triangle as a 2D triangle, each vertex of which has a value (the Z values from your original triangle). Then use linear interpolation to find the corresponding Z value of the target point.

Share this post


Link to post
Share on other sites
Quote:
I'm sorry but I still don't get it. What is the exact formula for this?
If you want more references in addition to the one sneftel gave, google for 'barycentric coordinates', or 'parametric triangle'. The idea is to project the triangle into a plane - the xy plane in your case - and solve for the barycentric coordinates or parametric values. Then apply these to the vertex z components to get your interpolated z value. You should be able to find the formulas online using the above search terms.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!