# Surface integral over triangle

Given a triangle: $\{(x_1,y_1,z_1),(x_2,y_2,z_2),(x_3,y_3,z_3)\}$.

How do I calculate the surface integral: $I=\int\int \vec{F}\vec{n}dS$ with $\vec{F} = [0,0,z]$, and where $\vec{n}$ is the plane normal?

Introducing the angle $\alpha$ between the normal and the vertical I guess the integral can be written as: $I=cos(\alpha)\int\int zdS$?

If I project the triangle down into the xy plane, am I correct in assuming that the area element becomes $dS'=cos(\alpha)dS$, in which case the integral becomes:

$I=\int\int zdS'$?

Should I then transform the problem to barycentric cordinates and how do I do this?

Introducing:

$x = ux_1 + vx_2 + (1-u-v)x_3$

$y = uy_1 + vy_2 + (1-u-v)y_3$

$x_u = x_1 - x_3$

$y_v = y_2 - y_3$

$x_v = x_2 - x_3$

$y_u = y_1 - y_3$

$J = (x_1 - x_3)*(y_2 - y_3) - (x_2 - x_3)*(y_1 - y_3)$

$I=\int_{u=0}^1\int_{v=0}^1 z(u,v)Jdudv = J\int_{u=0}^1\int_{v=0}^1 uz_1 + vz_2 + (1-u-v)z_3dudv$

$I=J\int_{u=0}^1\int_{v=0}^1 (z_1 - z_3)u + (z_2 - z_3)v + z_3dudv$

$I=J[(z_1 - z_3)\int_{u=0}^1udu+(z_2 - z_3)\int_{v=0}^1vdv + z_3]$

$I=J[(z_1 - z_3)*0.5+(z_2 - z_3)*0.5 + z_3]$

Is this correct?

Note that $\nabla\cdot \mathbf{F}=1$, so the divergence is simple which suggests an appeal to the Divergence Theorem may save us some labor.
Suppose we take the triangle $S$ and project it into the $xy$-plane as $S_0$. (For the present answer I'll assume that $z>0$ for all $\mathbf{x}\in S$; I'll try to remedy this defect later.) We can then construct a vertical triangular prism $D$ whose base is $S_0$ and whose whose top is cut off by a plane to make $S_0$ a slanted triangle face. We denote the remaining three side walls as the region $A$. Thus $\partial D=S+S_0+A$, and the divergence theorem implies that
$$\int_D (\nabla\cdot \mathbf{F})\,dV=\int_{\partial D} \mathbf{F}\cdot d\mathbf{S}=\int_{S} \mathbf{F}\cdot d\mathbf{S}+\int_{S_0} \mathbf{F}\cdot d\mathbf{S}+\int_{A} \mathbf{F}\cdot d\mathbf{S}$$ For the RHS, note that $\mathbf{F}=0$ in the $xy$-plane and $\mathbf{F}\cdot d\mathbf{S}=0$ for $x\in A$ since the local normal vector of $A$ is always in the $xy$-plane; consequently only the first flux integral is non-vanishing. But the divergence of $\mathbf{F}$ is zero, so $\int_{S}\mathbf{F}\cdot d\mathbf{S}$ must be identical to the volume of $D$. This is then purely a geometry problem which I'll leave to the reader (for now, at least.)