Documentation ¶
Overview ¶
Package r1 implements types and functions for working with geometry in ℝ¹.
See ../s2 for a more detailed overview.
Index ¶
- type Interval
- func (i Interval) AddPoint(p float64) Interval
- func (i Interval) ApproxEqual(other Interval) bool
- func (i Interval) Center() float64
- func (i Interval) ClampPoint(p float64) float64
- func (i Interval) Contains(p float64) bool
- func (i Interval) ContainsInterval(oi Interval) bool
- func (i Interval) Equal(oi Interval) bool
- func (i Interval) Expanded(margin float64) Interval
- func (i Interval) InteriorContains(p float64) bool
- func (i Interval) InteriorContainsInterval(oi Interval) bool
- func (i Interval) InteriorIntersects(oi Interval) bool
- func (i Interval) Intersection(j Interval) Interval
- func (i Interval) Intersects(oi Interval) bool
- func (i Interval) IsEmpty() bool
- func (i Interval) Length() float64
- func (i Interval) String() string
- func (i Interval) Union(other Interval) Interval
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interval ¶
type Interval struct {
Lo, Hi float64
}
Interval represents a closed interval on ℝ. Zero-length intervals (where Lo == Hi) represent single points. If Lo > Hi then the interval is empty.
func IntervalFromPoint ¶
IntervalFromPoint returns an interval representing a single point.
func (Interval) AddPoint ¶
AddPoint returns the interval expanded so that it contains the given point.
func (Interval) ApproxEqual ¶
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.
func (Interval) Center ¶
Center returns the midpoint of the interval. It is undefined for empty intervals.
func (Interval) ClampPoint ¶
ClampPoint returns the closest point in the interval to the given point "p". The interval must be non-empty.
func (Interval) ContainsInterval ¶
ContainsInterval returns true iff the interval contains oi.
func (Interval) Expanded ¶
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.
func (Interval) InteriorContains ¶
InteriorContains returns true iff the the interval strictly contains p.
func (Interval) InteriorContainsInterval ¶
InteriorContainsInterval returns true iff the interval strictly contains oi.
func (Interval) InteriorIntersects ¶
InteriorIntersects returns true iff the interior of the interval contains any points in common with oi, including the latter's boundary.
func (Interval) Intersection ¶
Intersection returns the interval containing all points common to i and j.
func (Interval) Intersects ¶
Intersects returns true iff the interval contains any points in common with oi.