Coverage

Frame a thumbnail from what was DRAWN, not from what the parameters were called.

In the namespace construct::ui. Declared in src/libs/libconstruct/construct/ui/ThumbnailFraming.hpp.

Detailed description

The camera distance used to be guessed from parameter NAMES: a definition whose parameters contained "diameter", "length", "chord" or "span" contributed to an estimated bounding radius, and everything else got 1.0. That is why the thumbnails are, in the owner's words, "OK-ish" — the guess is right often enough to look deliberate and wrong often enough to matter. A lattice's "cell size" says nothing about where its surface is, and a primitive whose extent lives in an unnamed parameter gets no vote at all.

This measures instead. The renderer already casts a ray per pixel and the readback already walks every pixel to check that something was drawn, so the coverage of the alpha channel IS the screen-space extent of the content and it costs nothing extra to record where it was rather than merely whether it existed.

The loop is: render, measure, solve for a distance that fills the frame, render again. Two or three passes converge, because the projected size of a bounded object is very nearly inversely proportional to the camera distance.

In this section