It is often need to draw triangular mesh using gnuplot
.
Only way I currently see is to make "wireframe" using with lines
option and double newlines between closed chains of lines (first and last point are the same) for each facet:
$wireframe <<EOD
0 1 1 p1
1 -1 1 p2
-1 -1 1 p3
0 1 1
2 1 0 p4
0 1 1
1 -1 1
2 1 0
0 -2 0 p5
1 -1 1
-1 -1 1
0 -2 0
-2 1 0 p6
-1 -1 1
0 1 1
-2 1 0
EOD
splot '$wireframe' with lines notitle, '' with labels offset character 0, character 1 notitle
This is the 4 triangles: 1 at center (p1, p2, p3) and 3 are adjacent to its legs.
There is many duplication for some ways to define a mesh. Sometimes it is more appropriate way to define the mesh as a triangle strip or triangle fan.
Another issue is to fill the interior of the 3D triangles by some color. Currently I only can draw wireframe using different colors (from palette) for different chained lines. But they overlap.
Say, I want to draw icosahedron. It is closed solid, constrained by a triangle faces.