Skip to main content

axiolid_hidden_lines/
lib.rs

1#![forbid(unsafe_code)]
2//! Exact orthographic and perspective hidden-line drawings of triangle meshes
3//! (ADR 0090, 0107).
4//!
5//! [`ScalarHiddenLines`] implements
6//! [`MeshHiddenLines`](axiolid_mesh_hidden_lines_contract::MeshHiddenLines).
7//! Visibility is decided exactly in the view's affine frame: the image of a
8//! vertex is an exact polynomial of the binary64 inputs and the frame, every
9//! visibility question along an edge is an affine function of the edge
10//! parameter, and each sign is decided by the interval filter and, when that
11//! cannot decide, by dyadic big-integer arithmetic (`axiolid-exact`). Nothing
12//! is rounded before a decision; only the endpoints of the output pieces are,
13//! each the exact point rounded once to the nearest binary64. With
14//! `EdgeSelection::group_boundary` it also draws the edges between face
15//! groups, and `FaceGroups::Planar` derives the groups exactly (ADR 0106).
16//!
17//! A perspective view (ADR 0107) is a pinhole at the frame origin: the image
18//! of `(U, V, W)` is `(U / -W, V / -W)`. Every sign question is then an exact
19//! determinant of view-space vectors from the eye (`recipe`), affine in the
20//! edge parameter as before, so nothing divides before it is decided and a
21//! triangle behind the eye needs no case of its own (an edge-on triangle
22//! that contains the eye is decided exactly and its fibre starts at the eye,
23//! see `occlusion`); the endpoints are the exact
24//! rationals rounded once, and a near-plane cap is decided by ray parity along
25//! the eye ray (`caps`). The visible-face provider below is orthographic only.
26//! A vertex at or behind the eye plane (`W >= 0`) has no finite image, so a
27//! triangle beside or behind the eye makes the broad phase search the whole
28//! scene with the linear scan, as `ScanHiddenLines` does; the pairs, and so
29//! the drawing, are the same, and only the candidate search is slower.
30//!
31//! [`ScalarVisibleFaces`] implements
32//! [`MeshVisibleFaces`](axiolid_mesh_hidden_lines_contract::MeshVisibleFaces)
33//! (ADR 0094) on the same view: the regions of the image where a face group
34//! (or the cap of a solid cut by the near plane) is frontmost. It cuts the
35//! image with an exact arrangement (`axiolid-exact-arrangement`) of the
36//! visible edge pieces, clip segments, cross-sections of interpenetrating
37//! triangles and the crop box, labels each side of each piece exactly, and
38//! snap-rounds the regions to the binary64 grid (ADR 0100): where no edge
39//! passes through the rounding cell of another vertex, each region vertex is
40//! the exact point rounded once and equals the hidden-line endpoint of the
41//! same point.
42//!
43//! Module map: `view` (the affine map), `recipe` (the sign questions),
44//! `param` (parameters along an edge and their interval algebra), `edges`
45//! (topology and edge kinds), `groups` (face groups, planar ones derived), `broad` (candidate triangles from a BVH), `occlusion` (one edge against the triangles), `caps` (the cross-sections
46//! of solids a near plane cuts),
47//! `output` (correctly rounded endpoints), `prepare` (request validation and the
48//! scene shared with the visible-face operation), `provider` (the hidden-line
49//! provider itself), `faces` (the visible-face provider; its module docs give
50//! the algorithm).
51
52mod broad;
53mod caps;
54mod decide;
55mod edges;
56mod faces;
57mod groups;
58mod occlusion;
59mod output;
60mod param;
61mod prepare;
62mod provider;
63mod recipe;
64mod view;
65
66pub use faces::ScalarVisibleFaces;
67#[doc(hidden)]
68pub use faces::{ScanVisibleFaces, UnprunedVisibleFaces};
69pub use provider::ScalarHiddenLines;
70#[doc(hidden)]
71pub use provider::ScanHiddenLines;