Triangular Interpolation...

Started by
1 comment, last by pollier 22 years, 3 months ago
Suppose I have a triangle in 3D space. If I look at it from overhead it looks two-dimensional. If I take a 2D point (X and Z axis) and place it anywhere on the triangle, how can I get the Y coordinate based on the heights of the other three points? I know this would be done by interpolation, and I know how to interpolate a square, but this is a triangle that''s not necessarily equilateral. Suggestions? "No break ''till you die!" - Mr. Foster, my English teacher
"No break 'till you die!" - Mr. Foster, my English teacher
Advertisement
Your triangle is in fact a plane. Just do a google search on "point in a plane" equation and use that.

You will also need to do a "point inside a triangle" test. There is a very fast algorithm thats hard to find. Its incredibly simple and simply returns a positive number if its inside the triangle, negative if it isnt. This is what the java Polygon.contains() (or inside() if you are using Java 1.0) uses so look at those if you cant find it online.

Nitzan

-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------
Er... Is there any way of doing it with interpolation? That would work much better with my app. Thanks for the tip on testing, I was going to use the old "find the sum of the interior angles" method.

"No break 'till you die!"
- Mr. Foster, my English teacher

Edited by - pollier on January 9, 2002 8:07:50 PM
"No break 'till you die!" - Mr. Foster, my English teacher

This topic is closed to new replies.

Advertisement