Module sight

Source
Expand description

Certified line of sight from an eye point to a mesh past blockers (#185).

§Visible: one ray, checked exactly

A ray from the eye through a point p is a witness when it crosses the interior of a target triangle strictly before it meets any blocker triangle – touching a blocker’s edge counts as meeting it. Where a ray meets a plane is a ratio of two exact orient3d values, so which comes first is an exact comparison. Candidate rays aim at points spread over each target triangle; the first that checks out is returned.

§Hidden: every ray, by cones

Every target triangle is cut into sub-triangles whose corners are exact dyadic points on it (midpoints of dyadic points are dyadic, so they stay on the triangle exactly). A sub-triangle is hidden when one blocker piece covers it: its three corners’ rays pass strictly inside the piece’s cone from the eye – so every ray through the sub-triangle does, the cone being convex – and a plane of the piece has the eye strictly on one side and the sub-triangle strictly on the other, so every such ray meets the piece before the target. A piece is a blocker triangle, two coplanar triangles forming a convex quadrilateral (a wall), or a whole closed convex blocker (a column). When every sub-triangle of every target triangle is covered, the target is hidden, and the blockers used are named.

§Undecided

Neither argument may be available: a target just grazed, or covered only by several pieces together, so that some sub-cone straddles a seam between them at every depth. Then the answer is undecided, never a guess.

Enums§

Sight
What can be proven about the view from an eye to a target.
SightError
Why the question was not asked.

Constants§

MAX_SIGHT_CELLS
Sub-triangles the hidden argument examines at most.

Functions§

line_of_sight
Whether any part of target is in view from eye, past blockers.
line_of_sight_within
line_of_sight with a caller-chosen budget of sub-triangles.