those three points define a plane, in this case, the xy plane... the normal to the plane is what you want which is NOT on the plane, but perpendicular to it...
remember, 3 points define a plane
i mean, if you have any point, (xy), on the xy plane, any line parallel to the z axis through said point would be normal to the xy plane...
the problem is more interesting if the triangle is NOT parallel to any of the xy, yz, xz planes... 3 vertices (x1,y1,z2), (x2,y2,z2), (x3,y3,z3)... if you find the determinant of the following matrix (the cross product):
| i j k |
| x1 y1 z1 |
| x2 y2 z2 |
where i,j,k are unit vectors in the x, y, and z directions respectively
you will find a normal to that triangle, of course what points you choose are arbitrary as long as those points are on the plane defined by that "triangle"
if you only consider a "triangle" that's on the xy plane, notice that z1 and z2 are 0, which means that there are no, i or j components, which means only a vector parallel to the z axis...
the said normal vector also defines a plane. where the tail of the vector is on the plane, and the plane is perpendicular to normal vector...