Remember each triangle as a contour consisting of three vectors going counterclockwise into a chain.
<--^
| /
|/
V
So, for all the triangles in your shape, take the union of their contour vectors. If two contour vectors in the union are identical, but go in opposite directions, they cancel each other and are removed from the union.
For example, for two triangles that are side by side, the union is 6 vectors
<--^^
|
|
VV-->
which comes down to 4 vectors, because the two diagonal vectors in the middle cancel, because they are identical, but work in opposite directions:
<--^
| |
| |
V-->
, . , . , .
<-----<-----<-----^
| |
| |
V ^-----> ^
| | | |
| | | |
V <-----V ^
| |
| |
V----->----->----->