Skip to content

surface3d

Mojo module 🡭

surface3d

Mark.SURFACE3D, Mark.WIRE3D and Mark.TRISURF3D: a height field drawn as shaded faces, as a wireframe, or over scattered points (#345).

Step 4 of #345. All three project through Frame3D like the point marks, and differ in what they build from the projected vertices: two triangles per grid cell, the grid’s edges as lines, or the triangles a Delaunay triangulation gives over scattered (x, y).

The faces go to fill_mesh, not to one fill each. Two antialiased fills sharing an edge each blend their partial coverage against the background rather than against each other, so a surface drawn a quad at a time carries a pale grid along every shared edge – measured upstream at 52 bad pixels along a 60-pixel edge. Only a call that sees all the faces can fix it, which is what fill_mesh is for.

Depth sorting is a centroid sort, and it has a known-wrong case. Faces are handed over farthest first, and fill_mesh composites in the order given, so a nearer face covers a farther one. That is right for the surfaces a height field produces, where faces meet edge to edge and never interpenetrate. It is wrong for geometry that crosses itself or for long thin faces seen edge-on: there is no single correct order, and the fix is splitting faces at their crossings or a depth buffer, neither of which exists here.

Functions