If you build a triangular grid, then you need to make a selection for each triangle and not draw the edges of the triangles with the reverse. You calculate the normal value as the transverse product of two consecutive edges in a triangle.
If you want to build only a contour, you will draw only the edges that go between the triangle with the front surface and the triangle with the reverse.
Or you use OpenGL, turn on the depth buffer and forget about all the basic maths :-)
Jon watte
source
share