You can use the vector coross procuct.

Assume triangles have vertices at p1 (x1, y1, z1), p2 (x2, y2, z2) p3 (x3, y3, z3).

Build two vectors:

A = (x2 - x1)i + (y2 - y1)j + (z2 - z1)k = A1i + A2j + A3k

B = (x3 - x1)i + (y3 - y1)j + (z3 - z1)k = B1i + B2j + B3k

C = A X B = (A2B3 - A3B2)i + (A3B1 - A1B3)j + (A1B2 - A2B1)k

C is perpendicular (normal) to the plane of the triangle.

Assume triangles have vertices at p1 (x1, y1, z1), p2 (x2, y2, z2) p3 (x3, y3, z3).

Build two vectors:

A = (x2 - x1)i + (y2 - y1)j + (z2 - z1)k = A1i + A2j + A3k

B = (x3 - x1)i + (y3 - y1)j + (z3 - z1)k = B1i + B2j + B3k

C = A X B = (A2B3 - A3B2)i + (A3B1 - A1B3)j + (A1B2 - A2B1)k

C is perpendicular (normal) to the plane of the triangle.