View Full Version : barycentric coordinates in R3
i was wondering if it is possible to get the barycentric coordinates when the point P lies outside the triangle plane defined by a,b,c ?
do i need to project the point back onto the plane so it becomes solvable in 2d ?
sorry my brain is getting tired.
if no projection is required is there any source i can have a look at ?
much appreciated !
12-14-2006, 12:18 AM
your point will need to be on the plane, remember that you only have three points (that's a single plane, so you're still lacking a Z definition from those points). it's after all just the relationship in the perpendicular between the point and it's opposite edge within a triangle, so there's no way to define a movement away from the planes surface itself.
here's some code for projecting points onto planes (it's pretty simple). http://softsurfer.com/Archive/algorithm_0104/algorithm_0104.htm
yeah thats what i expected.
i use a different way to project, by eliminating the dominant coordinate of the normal and convert all the
points into uv space. seems to give the most reliable results.
thanks for the reply !
12-16-2006, 03:25 PM
Depending on your needs there is one other alternative.. barycentric coordinates are the area of opposite triangles over the area of the sum of the triangles.
You might want do draw a picture of this.. you've got triangle T, made of points abc. You have a point inside, p. The triangle A is pbc. The triangle B is pca. The triangle C is pab.
The position of P is Area(A)/Area(T) * a + Area(B)/Area(T) * b + Area(C)/Area(T) * c.
However, a natural extension of this when the point isn't in T is to replace Area(T) in the above equation with Area(A)+Area(B)+Area(C). It's just replacing the normalizing term.
So, the behavior of this is a little bit different than the other solution with projection. The projection solution will project to the plane, and allow inside/outside tests. This solution assumes that you want every point in 3D to map to some point inside the triangle, and may or may not be useful for your application. Meh, probably not, but I think it's kind of interesting..
12-16-2006, 03:25 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.