Oh boy... you're right, there's still another bug. Please be patient, I'll track it down.

What coordinate system are you using? x=right, y=up, z=back (standard)? x=right, y=up, z=far (flipped - probably not)? or maybe x=right, y=far, z=up (the best imho but nobody uses it)?

What I'm using. We know that two vertices have the same direction if their inner product is positive, the opposite direction if it's negative, zero if they form a right angle. Ie. if they form a 45 deg angle, x1*x2+y1*y2+z1*z2>=0, whereas for 120 deg it's <0.

So, if we take the vectors starting at the midways and ending at the corners, a point has to be 'in front of them' to be inside the triangle.

See the pic for an example. The dot inside the triangle is in front of all the sides, so the inner product with the red vectors will be positive in all cases. Instead, the blue dot outside is in front of the left and the down sides, but the right side looks the other way, so the inner product with its red vector will be negative.

Of course all vectors have to be relative to the midway before calculation (the second bug I corrected).