Skip to main content

Module hidden_lines

Module hidden_lines 

Source
Expand description

Hidden-line removal: a part’s edges and silhouettes, projected onto the paper, each piece of them classified visible or hidden.

What a view draws is the edges where faces meet at an angle (tangent edges, where they meet smoothly, only if asked), and the silhouettes of curved faces (see crate::silhouette). Along such a curve, what is in front of it changes only where its projection meets the projection of another — passing behind an edge or a silhouette — or turns back on itself, where the curve runs along the line of sight. So:

  1. every curve is projected (exactly: the projection is linear, so a NURBS curve projects to a NURBS curve with the same knots);
  2. each is cut wherever its projection crosses or runs along another’s (curve_curve_overlaps_and_crossings) and wherever it is stationary along the paper’s axes (NurbCurve::stationary_parameters), which holds every point where it turns back — and leaves every piece monotone along both axes, so the pieces’ ends span the view;
  3. one point of each piece decides it: a ray from there towards the eye either crosses a face first (hidden) or does not (visible).

A ray crossing a face’s trim right at its boundary has met an edge in front, whose projection the piece then runs along: the piece is drawn by that edge already, and is classified hidden, so that the last step drops it with every other piece lying on one already drawn — a hidden line under a visible one is never drawn, nor any line twice.

Structs§

ProjectedView
A part seen from one direction.
ViewLine
A piece of a line of a view, visible or hidden throughout.
ViewOptions
What to draw.

Enums§

LineKind
What a line of a view shows.

Functions§

project_view
The lines of the faces faces of model seen through frame, each piece visible or hidden. Every face both draws and hides.