Package r1 implements types and functions for working with geometry in ℝ¹.
See ../s2 for a more detailed overview.
Interval represents a closed interval on ℝ. Zero-length intervals (where Lo == Hi) represent single points. If Lo > Hi then the interval is empty.
EmptyInterval returns an empty interval.
IntervalFromPoint returns an interval representing a single point.
AddPoint returns the interval expanded so that it contains the given point.
ApproxEqual reports whether the interval can be transformed into the given interval by moving each endpoint a small distance. The empty interval is considered to be positioned arbitrarily on the real line, so any interval with a small enough length will match the empty interval.
Center returns the midpoint of the interval. It is undefined for empty intervals.
ClampPoint returns the closest point in the interval to the given point "p". The interval must be non-empty.
Contains returns true iff the interval contains p.
ContainsInterval returns true iff the interval contains oi.
Equal returns true iff the interval contains the same points as oi.
Expanded returns an interval that has been expanded on each side by margin. If margin is negative, then the function shrinks the interval on each side by margin instead. The resulting interval may be empty. Any expansion of an empty interval remains empty.
InteriorContains returns true iff the the interval strictly contains p.
InteriorContainsInterval returns true iff the interval strictly contains oi.
InteriorIntersects returns true iff the interior of the interval contains any points in common with oi, including the latter's boundary.
Intersection returns the interval containing all points common to i and j.
Intersects returns true iff the interval contains any points in common with oi.
IsEmpty reports whether the interval is empty.
Length returns the length of the interval. The length of an empty interval is negative.
Union returns the smallest interval that contains this interval and the given interval.