Barycentric coordinates

Started by
2 comments, last by RajanSky 21 years, 11 months ago
Hi all! I wrote some code today which, given a point on a triangle in 3D, it gives the texture coordinates u and v for that point. I used barycentric coordinates to do this. I get the gist of it, basically you''re making a change of basis where your 3 vectors are the 3 vertices of the triangle, etc. I was wondering if anyone knows, is this method really correct or is it just an approximation that looks good? I can''t seem to reason out why this works. Intuitively it makes sense but I can''t prove why it works... Thanks! Rajan
Advertisement
Barycentric coords are a really nice thing. Few people understand what they really are (although it''s really easy once you know ), they can be incredibly useful.

It depends a bit on how exactly you did the math, but normally it should be correct. Barycentric coordinates are simply another way to specify a point on a plane, with the additional constraint, that it must be *inside* of the triangle.

Your 3 barycentric coords (u,v,w), ranging from 0 to 1, specify a point on the triangle using the following equation: P = uA + vB + wC. Where A,B,C are the 3 vertices of your triangle. Note also that u + v + w = 1.

So to check the validity of your equation, just check them against the constraints of the barycentric equation. See if all your barycentric coords are between 0 and 1, and if they sum up to 1. In that case, they specify a valid point on the plane and inside of your triangle.

/ Yann
What is are barycentric coordinates??

Proceeding on a brutal rampage is the obvious choice.
___________________________________________________________Where to find the intensity (Updated Dec 28, 2004)Member of UBAAG (Unban aftermath Association of Gamedev)
Thanks Yann! It makes a little more sense now and I can definitely visualize how it works. I still wonder how one could prove it mathematically but for now this is good enough so again, thank you

Amish- I''m using barycentric coordinates to texture a triangle. What it means is that we have a triangle with three points in 3d space- A, B, and C. Our goal is that, if we are given a point on the triangle, P, we can calculate the barycentric coordinates u, v and w, such that:
Au + Bv + Cw = P

I won''t go into the details but basically using barycentric coordinates makes the job of calculating texture coordinates a lot easier.

Rajan

This topic is closed to new replies.

Advertisement