# Right way to label the vertices in local bases using finite elements

I'm having a problem using local coordinates basis in my finite elements code, depending how i label the vertices, my results goes completly wrong, results of integral doesn't match and functions are not $0$ or $1$ on their vertices. and the book don't tell the right way to do that. I searched over internet and found nothing.

Let $V_1=(x_1,y_1),V_2=(x_2,y_2)$ and $V_3=(x_3,y_3)$ being vertex of a triangle and $A$ it's area, then, the local coordinates are giving by this matrix product:

$\begin{bmatrix} L_{1} \\ L_{2} \\ L_{3} \end{bmatrix} = \frac{1}{2A}\begin{bmatrix} x_2y_3 - x_3y_2 & y_2 - y_3 & x_{3} - x_{2} \\ x_3y_1 - x_1y_3 & y_3 - y_1 & x_{1} - x_{3} \\ x_1y_2 - x_2y_1 & y_1 - y_2 & x_{2} - x_{1} \end{bmatrix} \begin{bmatrix} 1 \\ x \\ y \end{bmatrix}$

If i choose the vertex $V_1=(0,1),V_2=(1/2,0),V_3=(-1/2,0)$, the result is right, but if i change $V_2$ and $V_3$, it's came completly wrong, since my mesh is big i can't check every element to know the right way to label it. How should i proceed? There's any way for me to know the right way to label it? There's another base that i could use that won't lead me to this problem?