Hey guys, so I'm trying to create a quad renderer that renderers quads using 4 half space functions instead of rendering 2 triangles. I was previously following ryg's (https://fgiesen.wordpress.com/2013/02/10/optimizing-the-basic-rasterizer/) tutorial on triangle rasterization and he uses barycentric coordinates to interpolate values as well as see if the point is inside all of the edges. This works great for triangles but I know some people previously made quad rasterizers and I found this paper (http://geometry.caltech.edu/pubs/MHBD02.pdf) about generalized barycentric coordinates for n-sided polygons. Now this is my first ever attempt at understanding a mathematical paper so I'm probably not understanding a lot of basic principles here.
They use a couple variables, q1->qn are the vertices, Q is the polygon, p is a point inside the polygon and alpha1->alphan are the coefficients for each vertice (a percent saying how much percent of each vertex weight applies to that point), and w1->wn which is the actual weight. They have 3 properties that they are trying to gain in their generalized barycentric coords: affine combination, smoothness and convex combination.
For affine combination, the first summation is a bit confusing. They're saying if you sum all coefficients multiplied by the vertices then you get the point p but I'm not entirely sure what that is achieving. They're also saying all the coefficients add up to 1 which makes sense since the coefficients are percents so they have to reach a total of 100% or 1. After they state the properties, they then say you can rewrite the affine summations as the summation of each wj(qj - p) which equals to 0. Now I thought I'd do a example with a triangle and see if this works.
My vertices would be (0,0), (0.5, 1), (1, 0) with p being (0.5, 0.5) and my weights being 5, 4 and 3. Applying the formula I would get:
5(0.5 - 0.5, 1 - 0.5) + 4(0 - 0.5, 0 - 0.5) + 3(1 - 0.5, 0 - 0.5)
= (-0.5, -1)
First off, I don't get how the vector value is supposed to equal to 0 unless its the vector 0. Second, I don't get why this example doesn't work. Is there something wrong with the vertices I chose or am I missing some step in between? Thanks in advance.