PDA

View Full Version : Barycentric coordinates



gator
02-22-2004, 02:27 PM
Ok, this is not what you're thinking.

I need to compute barycentric coordinates for a point *outside* a polygon.

What I need to know, are BC coords valid outside a polygon? Can those weights be used
to find an interpolated color/normal? Are negative weights bad?

gator
02-22-2004, 09:21 PM
Please read my post again.

gator
02-23-2004, 09:42 AM
Or you can just delete your post. oh well.

madmortigan
02-23-2004, 09:52 AM
Hi

I don't think it's bad. You can find an example in 2d here:
http://graphics.cs.ucdavis.edu/GraphicsNotes/Barycentric-Coordinates/Barycentric-Coordinates.html

The first example shows 3 points and their barycentric coords wrt a line segment. One of the points is outside the line segment, and it's bar. coord. is negative, but that seems to be ok.

('Bad' things might happen when some code handles these guys and doesn't anticipate them being negative.)

mathworld.wolfram.com say lots of things about barycentric coordinates. Couldn't find anything about outside the triangle, but might have missed it as well.

To recap, it looks like it should be safe, at least when used reasonably, ie, when your point outside the triangle doesn't actually goes to infinity. But then again, in graphics you shouldn't be getting that anyway.

mad

gator
02-23-2004, 02:16 PM
Do you know if barycentric coordinates can be computed relatively in some way?

For example, let's say I have a point inside a triangle and compute its BC coords.
Then I move that point outside the triangle by some delta amount.

Is there someway I can determine the new BC coords based on the old BC coords and
old position of the point?

madmortigan
02-24-2004, 04:05 AM
I'm a bit confused by your last question. Could you please repeat what's the input for this calculation you want to do? I assume the output will be the new BC. You say you want to find that based on old BC and old position. What else will be known?

mad


[This message has been edited by madmortigan (edited 02-24-2004).]

gator
02-24-2004, 09:31 AM
I don't even know if it is possible or not.

Is there a relationship between two BC coords based on position?

gator
02-24-2004, 11:13 AM
This is what I got:

w1 + w2 + w3 = 1
w4 + w5 + w6 = 1, so

w1 + w2 + w3 = w4 + w5 + w6,

w1 = a1/A, so

(a1/A) + (a2/A) + (a3/A) = (a4/A) + (a5/A) + (a6/A)

a1 + a2 + a3 = a4 + a5 + a6,

but this gets me no where.

How to involve position, when I'm dealing with area?

madmortigan
02-24-2004, 02:18 PM
May be we are not asking the right questions here, but we'll get it.

You've probably seen this, but just in case, wolfram has a couple of interesting formulas here:
http://mathworld.wolfram.com/BarycentricCoordinates.html

at the end of the page they give the equation of a line in barycentric coordinates and the connection between area and coordinates.

I'm still not quite clear about what exactly you're looking for though.

mad

chemdog
03-06-2004, 01:37 AM
Yes, you can use barycentric cooordinates to determine any point in the universe. The cool thing about barycentric coordinates is that all of them are positive when inside the object.

gator
03-06-2004, 09:35 AM
Well, after spending a couple days searching, I gave up on it.

I guess I'm the only person out there who wants negative weights. Everyone else wants them positive. http://www.opengl.org/discussion_boards/ubb/smile.gif