# How to obtain generalized barycentric coordinates for n-sided polygon?

Quadrilateral linear basis functions(generalized barycentric coordinates) are defined as:

What are the steps to calculate the above functions?

Is it possible to obtain basis functions for a 5 sided polygon(pentagon) or in general n-sided polygon?

Quadrilateral basis functions can be calculated using an outer product of the basis of two linear functions (1-r, r) and (1-s, s). The same thing does not apply for arbitrary $n$-sided domains. For this we use generalised barycentric coordinates. Wachspress coordinates are arguably the simplest generalised barycentric coordinates available, are fast to evaluate and are defined for arbitrary $n$.

For a point $p$ on a planar convex polygon defined by vertices $v_1, v_2, \ldots, v_n$, ordered counter-clockwise, you can find weights

$$w_i(p) = \frac{A(v_{i-1}, v_i, v_{i+1})}{A(v_{i-1}, v_i, p)A(v_{i}, v_{i+1}, p)}.$$

Here, $A(v_1, v_2, v_3)$ denotes the signed triangle area. The coordinate functions $\phi_i$ can then be found be normalising the weights $w_i(p)$

$$\phi_i(p) = \frac{w_i(p)}{\sum_{j=1}^n w_j(p)}.$$

Now, the coordinate functions correctly parametrise the point (linear reproduction property)

$$p = \sum_{i=1}^n v_i \phi_i(p).$$

At vertices the coordinates satisfy the Lagrange property $\phi_i(v_j) = \delta_{ij},$ where $\delta_{ij}$ is the Kronecker delta, meaning that the corresponding coordinate function evaluates to 1 at its vertex and linearly interpolate on the edges. It is also important to notice that the coordinate partition unity $\sum_{i=1}^n \phi_i(p) = 1.$

For, non-convex polygons you could use mean value coordinates.

• Thanks for the answer. What happens to the weight function if p is one of the polygon vertices. The Ai triangle becomes a line with zero area? Also what do you mean by signed area? – ali Jan 24 '18 at 20:30
• I added a paragraph explaining what to do at the boundaries. For the signed triangle area consult this. – Reynolds Jan 24 '18 at 20:59