# How to evaluate the average value of a polynomial inside the triangle area in finite volume sense?

Consider we have a linear bivariate polynomial: $$p(x,y)=ax+by+c.$$

To construct the linear polynomial using least square method, we need to evaluate the value of the average polynomial $$p$$ in at least in three cells that approximately must be equal to the average of conservative variable $$\bar{\psi}$$. $$\frac{1}{\Delta_i}\int_{\Delta_i}{p(x,y)}\,dx\,dy = \bar{\psi}_i.$$

My question are:

1. How should I define the limit of integration?
2. How to evaluate the integral of the polynomial?

If $$(x_i,y_i)$$ is the centroid of the triangle, then $$\frac{1}{\Delta_i}\int_{\Delta_i}{p(x,y)}\,dx\,dy = p(x_i,y_i) = \bar{\psi}_i$$ This is mid-point quadrature, which is exact for an affine function. The centroid of a triangle is the arithmetic average of its three vertices. Note that $$x_i = \frac{1}{\Delta_i} \int_{\Delta_i} x dx dy = \frac{1}{3}\sum_{vert} x_{vert}$$ and similarly for $$y_i$$. This suggests to reparametrize $$p$$ as $$p = \bar{\psi}_i + a (x-x_i) + b(y-y_i)$$ which automatically satisfies the average condition.