Skip to main content

Crate geop_core_rasterize

Crate geop_core_rasterize 

Source
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 PrimitiveScene of 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§

RasterizedModel
A Model rasterized 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 rasterize makes 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 Rasterizer does 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 model into a RasterizedModel. n is 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 outer and outside every one of holes, 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.