Skip to main content

Module hlr

Module hlr 

Source
Expand description

The ANALYTIC hidden-line pass: what a sheet draws of the model, computed from the B-rep rather than from the display mesh.

§The algorithm

  1. Candidate curves. Every non-degenerate B-rep edge, sampled on its own curve, and the SILHOUETTE of every curved face — the locus on the exact surface where the viewing direction is tangent to it: two generator lines of a cylinder or cone (closed form), one great circle of a sphere (closed form), and for a torus, a general revolution or a fitted surface the zero set of n(u, v) · d traced over the face’s parameter box and solved onto the surface through its own evaluator. Each silhouette is trimmed to its face. An edge is INKED when its two faces meet at a crease past EDGE_ANGLE_DEG (the rule the mesh pass used, read here off the exact normals), when it is a TANGENT LINE — a smooth edge between two surfaces, a round’s or a blend’s, told from a split of one surface by the jump in curvature across it (one_surface) — when it bounds only one face, or when more than two share it; a smooth edge between two fragments of one surface is kept as a SPLITTER only, and a seam (one face on both sides) is neither.
  2. Splitting. Every candidate is split where its projection crosses another’s, and where another’s END lands on it — the only places the number of surfaces in front of a line can change. The crossing test is the kernel’s own segment_intersection over the sampled paper chords.
  3. Visibility. Each piece is decided at its MIDPOINT, evaluated on the exact curve (a chord’s midpoint sits inside a curved surface, and the ray from there to the eye can cross the very surface it bounds): the view ray from that point toward the eye is intersected with every face whose paper box holds the point — a plane in closed form, anything else through the kernel’s intersect_curve_surface on the exact carrier — and the piece is hidden when a hit inside that face’s trim is nearer the eye than the piece by more than the depth floor.
  4. Runs. Consecutive visible pieces of one candidate are one run, so a straight edge a hidden line crosses still comes back as its two ends, and edge runs chain through a vertex exactly two inked edges share.

§The two floors

Both are the B-rep’s own agreement bar, KernelTolerances::pcurve_consistency (the largest disagreement a valid in-memory B-rep allows between an edge’s curve and the carriers it lies on), carried to the paper at the view’s scale:

  • the depth floor — a face must be nearer the eye than the piece by more than that bar to hide it, because an edge’s own curve may sit that far off the face it bounds;
  • the crossing floor — two projected curves closer than that bar touch, and two split points closer than it along a curve are one. A touch is measured against a CHORD, so it also admits the chord’s own sag, CHORD_MM.

Visibility is exact to those floors: no raster cell, no bias, no dropped fringe. What it does not see is what the SAMPLING does not: a trim notch or a silhouette loop smaller than one chord.

§Before the B-rep arrives

Steps 2 to 4 also run on a DISPLAY (visible_mesh_lines): the display edges and the mesh’s silhouettes as candidates, the display triangles as what hides them. It is what a placement draws while its solids’ topology is not in the scene, and the drawing says so — a stated approximation, the tessellation’s chords in place of the exact curves.

Structs§

Floors
The floors of one placement, see the module docs.
HalfLine
A HALF section’s second plane, perpendicular to the cutting plane and so edge-on to the section view: a line on the paper. In view units, normal is its unit normal in the view’s (right, up) and offset its distance from the view’s target; the side the normal points to is kept whole.
HlrResult
The exact result of one placement: the visible runs on the paper, plus what the A/B comparison and the tests read.
MeshEdge
One display edge of a MeshSolid: its polyline, and the topology vertices it starts and ends on — where runs chain, as the exact pass chains through the B-rep’s own start_vertex_id / end_vertex_id. None when either end is not recoverably one vertex.
MeshSolid
One solid’s DISPLAY, in world coordinates: what a placement is drawn from while its B-rep has not reached the scene.
SolidTrims
What a pass learns about every trim of one solid that no camera, scale or clip changes: each face’s TrimTests, [shell][face]. The projection cache keeps one per solid it draws (crate::sheets::project), so a re-projection — another scale, a section or a detail of the same part — asks nothing a previous one built.

Enums§

Clip
What the drawn model is restricted to before anything is decided.

Constants§

CHORD_MM
How far a sampled paper polyline may sit off its exact curve, paper millimetres. The comparand is the model line’s own stroke, EDGE_WIDTH = 0.35 mm: seventy times finer, so no printed or zoomed drawing can show the chord.

Functions§

inside_region
Even-odd crossing count of a paper point against a set of polylines — the cut region of a section.
section_curves
The exact section of solids by the view’s target plane (the camera looks along its normal): per face, the plane’s intersection with the carrier — the kernel’s closed forms for a plane against a cylinder, cone, sphere or torus (intersect_analytic_pair), marched for a fitted surface (intersect_surfaces), and for a plane against a plane the line their two equations share, which the kernel’s analytic lane leaves to its iso path on purpose — trimmed to the face where its boundary edges cross the plane.
section_curves_with
section_curves with each solid’s SolidTrims kept from before.
visible_edges
The visible model lines of solids through frame at placed’s scale, restricted to clip.
visible_edges_with
visible_edges with each solid’s SolidTrims kept from before.
visible_mesh_lines
The model lines of meshes through frame at placed’s scale, restricted to clip — the STATED APPROXIMATION a placement draws while the exact solids are not in the scene (their topology request is in flight, or the registry could not clone a handle). It is the analytic pass’s own split, visibility and run code on different inputs:

Type Aliases§

CutCurve
One cut curve of a section on the paper, ORIENTED so the cut region lies to its left as the section camera sees it (the region’s outward normal is toward the eye): a whole set of them sums to the region’s signed area.