Skip to main content

Module shadow

Module shadow 

Source
Expand description

The shadow a triangle mesh casts on a plane: the outline of everything it covers seen along the plane’s normal, with its holes.

The shadow is the union of the triangles projected onto the plane. A pocket or a dent in a face seen from above is covered by the face around it and leaves no mark; an indentation in the outline itself stays; a hole through the part, which no triangle covers, is a hole. A triangle seen edge on covers no area and adds nothing, so a sheet seen edge on casts no shadow.

The vertices are projected and snapped to the grid of planar once each, and every triangle’s orientation is read from those grid points exactly. Each triangle, turned to run counter-clockwise, adds its three edges to a chain, and the edges two triangles share in opposite directions cancel: those are the edges with a triangle either side of them in the projection, which bound nothing. What is left is the outline the mesh shows seen along the normal, its folds and its open edges, and only that goes on to the region tracing: the points covered by at least one triangle.

The tracing runs in two rounds. The triangles are dealt to square tiles of some thousands each by their first corner, and each tile’s union is traced on its own, in parallel: the folds a noisy scan has all over its faces are covered within their tile and go no further. The tiles’ outlines are then traced together, the edges two tiles share cancelling as before.

Functions§

shadow
The shadow of a mesh on a plane, seen along its normal.