I wasn't very clear on why we get barycentric coordinates out of the half-plane tests that we use for checking whether a point lies within a triangle, so I thought about it a bit and the best explanation I could come up with was that the Point-in-triangle equations from this slide somehow gives us the distance (or a quantity related to the distance) between x and one side of the triangle, which we can use to compute the area of the sub-triangle and therefore find the proportion of the area of the whole triangle that the sub-triangle takes up?
ChrisZzh
I don't really understand the sentence "Importantly, these same three values fall out of the half-plane tests used for triangle rasterization!" and why is that the case. Can someone give an explanation? Thanks!
abiagioli
@ChrisZzh @jzhanson We can indeed find the barycentric coordinates from the point-in-triangle equation terms. Check out this slide:
Correction: The second bullet in the above should say "Divide by distance of b from line ca (height)".
Notice, now that the first bullet (distance from x to line {ca,ab,bc}) is precisely the term given by the term $E_{a / b / c}(x)$ from the half plane test.
This is why the half plane test is useful here!
HelloWorld
Can this be generalized to other polygons? It seems like it should work fairly well for squares.
keenan
@HelloWorld Great question. The answer is "yes, sort of": there are many different ways to generalize barycentric coordinates to n-gons, each with its own pros and cons. Also, some of these generalizations work well for convex but not nonconvex polygons, etc. There's a surprising amount to say about this problem; so much, in fact, that someone ran a whole workshop on Generalized Barycentric Coordinates (with lots of good slides and other pointers).
I wasn't very clear on why we get barycentric coordinates out of the half-plane tests that we use for checking whether a point lies within a triangle, so I thought about it a bit and the best explanation I could come up with was that the Point-in-triangle equations from this slide somehow gives us the distance (or a quantity related to the distance) between x and one side of the triangle, which we can use to compute the area of the sub-triangle and therefore find the proportion of the area of the whole triangle that the sub-triangle takes up?
I don't really understand the sentence "Importantly, these same three values fall out of the half-plane tests used for triangle rasterization!" and why is that the case. Can someone give an explanation? Thanks!
@ChrisZzh @jzhanson We can indeed find the barycentric coordinates from the point-in-triangle equation terms. Check out this slide:
Correction: The second bullet in the above should say "Divide by distance of b from line ca (height)".
Notice, now that the first bullet (distance from x to line {ca,ab,bc}) is precisely the term given by the term $E_{a / b / c}(x)$ from the half plane test.
This is why the half plane test is useful here!
Can this be generalized to other polygons? It seems like it should work fairly well for squares.
@HelloWorld Great question. The answer is "yes, sort of": there are many different ways to generalize barycentric coordinates to n-gons, each with its own pros and cons. Also, some of these generalizations work well for convex but not nonconvex polygons, etc. There's a surprising amount to say about this problem; so much, in fact, that someone ran a whole workshop on Generalized Barycentric Coordinates (with lots of good slides and other pointers).