Expand description
Turn a Model into sampled geometry — rasterize: a point per
vertex, a polyline per edge, triangles per face, each tagged with the
entity it came from — to draw it, pick in it, write it as STL (stl),
or render it for debugging (debug).
Every edge is sampled once ([sample_curve]), and every face — trimmed
or not — has its outer boundary (and any holes) made of those samples,
placed in its (u, v) (see [mesh::boundary]), then triangulated by
[grid::triangulate_face]: a curvature-sized (u, v) grid with every
cell clipped exactly against the trim (see that module’s doc comment),
so a flat patch renders as a couple of triangles and a curved one gets
whatever resolution its own curvature actually needs — mapped through
surface.evaluate, the rendered mesh always both respects the face’s
real trim and follows its true curvature. The faces’ meshes are then
joined along their edges (see [mesh]): the mesh of a solid is closed.
Modules§
- debug
- Rendering a model for a person to look at while debugging: a
PrimitiveSceneof points, lines, triangles and labels, saved as an interactive HTML file — the shape as rasterized (RasterizedModel::scene) or its raw topology, every entity labelled (rasterize_topology). - stl
- STL export: a
RasterizedModel’s faces as a triangle mesh file.
Structs§
- Rasterized
Model - A
Modelrasterized once, with every sampled point/polyline/triangle kept alongside the id of the entity it came from. - Rasterizer
- Rasterizes models one after another, meshing a face on its own only
once while it stays the same: the part before a step and the part with
it share the faces the step left as they were, and those are not
meshed again. The faces are joined along their edges anew each time,
so what it makes of a model is what
rasterizemakes of it.
Functions§
- face_
triangles_ uv face‘s trimmed region triangulated in(u, v)space, by a grid sized by the face’s curvature and clipped to its trim (see [grid::triangulate_face]), each triangle by its corners — and the trim it covers: its loops as the polygons of its edges’ samples, the outer first.- faces_
meshed - How many faces this thread has meshed on its own ever: what a
Rasterizerdoes not do again for a face that stayed the same — so a test bounds it by counting these, not by timing it. - rasterize
- Sample every vertex/edge/face of
modelinto aRasterizedModel.nis a quality: how finely a curve or surface that actually curves is approximated (see [sample_curve] and [grid::triangulate_face]), not a fixed sample count — a straight edge or flat face stays cheap. - triangulate_
polygon - The region inside the simple polygon
outerand outside every one ofholes, as triangles: the grid’s own clipping on one cell, the polygon’s bounding box — no bridge joins a hole to the outline (see the module doc). None for a polygon that encloses nothing.
Type Aliases§
- Triangle2
- A triangle in a plane, by its corners.