Traces

Every diagram comes equipped with a trace. Intuitively, the
trace for a diagram is like a raytracer: given a line
(represented as a base point and a direction), the trace computes
the distance from the base point along the line to the first
intersection with the diagram. The distance can be negative if
the intersection is in the opposite direction from the base
point, or infinite if the ray never intersects the diagram.
Note: to obtain the distance to the furthest intersection
instead of the closest, just negate the direction vector and
then negate the result.

Note that the output should actually be interpreted not as an
absolute distance, but as a multiplier relative to the input
vector. That is, if the input vector is v and the returned
scalar is s, the distance from the base point to the
intersection is given by s * magnitude v.

The trace of a single point is the empty trace, i.e. the one
which returns positive infinity for every query. Arguably it
should return a finite distance for vectors aimed directly at the
given point and infinity for everything else, but due to
floating-point inaccuracy this is problematic. Note that the
envelope for a single point is not the empty envelope (see
Diagrams.Core.Envelope).