Splitting a quadrilateral into two triangles if it has a vertex with an inner angle bigger than 180º I'm trying to write an app in which I need to test if a 3D quadrilateral has some angle equal or bigger to 180 degrees, Ie., it is a degenerated or concave quadrilateral. If this is true, I have to split it into two triangles.
I have no problem on dividing the quadrilateral in two but don't know how to solve the test condition.
Thanks in advance for your help.
Edit:
I only know the coordinates of the  vertices
 A: Let's assume you have a quadrilateral in 3D, defined by four vertices
$$\begin{array}{l}
\vec{v}_1 = ( x_1 , y_1 , z_1 ) \\
\vec{v}_2 = ( x_2 , y_2 , z_2 ) \\
\vec{v}_3 = ( x_3 , y_3 , z_3 ) \\
\vec{v}_4 = ( x_4 , y_4 , z_4 ) \end{array}$$
If one of the vertices is not in the same plane as the other three, the quadrilateral is non-planar, or skew quadrilateral. There are typically more than one way to interpret the surface -- or rather, which vertex is the one that is non-planar with the other three, since any three (that are not collinear) can define a plane -- so we need further information than just the vertex coordinates to make the decision in such cases.
Because of this, I shall assume the quadrilateral is planar, and that the surface unit normal vector of the quadrilateral is $\hat{n}$.
If we compute four vector cross products between each pair of consecutive edge vectors,
$$\begin{array}{l}
\vec{c}_1 = \left ( \vec{v}_4 - \vec{v}_1 \right ) \times \left ( \vec{v}_2 - \vec{v}_1 \right ) \\
\vec{c}_2 = \left ( \vec{v}_1 - \vec{v}_2 \right ) \times \left ( \vec{v}_3 - \vec{v}_2 \right ) \\
\vec{c}_3 = \left ( \vec{v}_2 - \vec{v}_3 \right ) \times \left ( \vec{v}_4 - \vec{v}_3 \right ) \\
\vec{c}_4 = \left ( \vec{v}_3 - \vec{v}_4 \right ) \times \left ( \vec{v}_1 - \vec{v}_4 \right ) \end{array}$$
and the quadrilateral is convex, then all the cross product vectors are in the same half-space as the surface normal vector:
$$\begin{cases}
\vec{v}_1 \cdot \hat{n} \ge 0 \\
\vec{v}_2 \cdot \hat{n} \ge 0 \\
\vec{v}_3 \cdot \hat{n} \ge 0 \\
\vec{v}_4 \cdot \hat{n} \ge 0
\end{cases}$$
The equal case in the above occurs only when consecutive edge vectors are parallel, for example if $\vec{v}_3 = \lambda \vec{v}_2$, $\lambda \in \mathbb{R}$.
In fact, all of the cross products should be parallel to the surface unit normal, and you can even use the above to calculate the surface normal:
$$\hat{n} = \frac{\vec{v}_1}{\lVert\vec{v}_1\rVert} = \frac{\vec{v}_2}{\lVert\vec{v}_2\rVert} = \frac{\vec{v}_3}{\lVert\vec{v}_3\rVert} = \frac{\vec{v}_4}{\lVert\vec{v}_4\rVert}$$
In practice, you might wish to use the longest one for numerical stability.
If you find that, for example,
$$\vec{v}_2 \cdot \hat{n} \lt 0$$
it means the inner angle at vertex $\vec{v}_2$ is greater than 180°.
A: Firstly, since you haven't provided any information on the data that you already possess, I'm going to assume that:


*

*You know the values of the other 3 angles. In this case, the test condition is easy to solve:
$$
\text{Consider a quadrilateral ABCD, whose 4 angles are }
\angle A, \angle B, \angle C \text{ and } \angle D.
\\\text{If }\angle A+\angle B+\angle C=180^\circ,\text{then } \angle D=180^\circ
$$

*You know the coordinates of the 4 vertices. In this case, the test condition is satisfied if:
$$
\text{Consider a quadrilateral ABCD, with the coordinates of its 4 points as }\\A(x_a,y_a,z_a), B(x_b,y_b,z_b), C(x_c,y_c,z_c), \text{and } D(x_d,y_d,z_d).
\\\text{Use the distance formula to calculate AB, BC, CA, AD, diagonals AC and BD.}\\\text{Now, if any two sides add up to a diagonal, you have the angle between those 2 sides as }180^\circ\\
\text{For your information, the distance formula is}\\\bbox[5px,border:2px solid red] {D(P_1,P_2)=\sqrt {(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2},}\\\text{where } P_1=(x_1,y_1,z_1), \text{and }P_2=(x_2,y_2,z_2)
$$


I hope this answers your question, and I suggest that if it didn't answer your question, please clearly state exactly what data you are facilitated with.
