geo: github.com/golang/geo/r1 Index | Files

package r1

import "github.com/golang/geo/r1"

Package r1 implements types and functions for working with geometry in ℝ¹.

See ../s2 for a more detailed overview.

Index

Package Files

doc.go interval.go

type Interval Uses

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 EmptyInterval Uses

func EmptyInterval() Interval

EmptyInterval returns an empty interval.

func IntervalFromPoint Uses

func IntervalFromPoint(p float64) Interval

IntervalFromPoint returns an interval representing a single point.

func (Interval) AddPoint Uses

func (i Interval) AddPoint(p float64) Interval

AddPoint returns the interval expanded so that it contains the given point.

func (Interval) ApproxEqual Uses

func (i Interval) ApproxEqual(other Interval) bool

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 Uses

func (i Interval) Center() float64

Center returns the midpoint of the interval. It is undefined for empty intervals.

func (Interval) ClampPoint Uses

func (i Interval) ClampPoint(p float64) float64

ClampPoint returns the closest point in the interval to the given point "p". The interval must be non-empty.

func (Interval) Contains Uses

func (i Interval) Contains(p float64) bool

Contains returns true iff the interval contains p.

func (Interval) ContainsInterval Uses

func (i Interval) ContainsInterval(oi Interval) bool

ContainsInterval returns true iff the interval contains oi.

func (Interval) Equal Uses

func (i Interval) Equal(oi Interval) bool

Equal returns true iff the interval contains the same points as oi.

func (Interval) Expanded Uses

func (i Interval) Expanded(margin float64) Interval

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 Uses

func (i Interval) InteriorContains(p float64) bool

InteriorContains returns true iff the the interval strictly contains p.

func (Interval) InteriorContainsInterval Uses

func (i Interval) InteriorContainsInterval(oi Interval) bool

InteriorContainsInterval returns true iff the interval strictly contains oi.

func (Interval) InteriorIntersects Uses

func (i Interval) InteriorIntersects(oi Interval) bool

InteriorIntersects returns true iff the interior of the interval contains any points in common with oi, including the latter's boundary.

func (Interval) Intersection Uses

func (i Interval) Intersection(j Interval) Interval

Intersection returns the interval containing all points common to i and j.

func (Interval) Intersects Uses

func (i Interval) Intersects(oi Interval) bool

Intersects returns true iff the interval contains any points in common with oi.

func (Interval) IsEmpty Uses

func (i Interval) IsEmpty() bool

IsEmpty reports whether the interval is empty.

func (Interval) Length Uses

func (i Interval) Length() float64

Length returns the length of the interval. The length of an empty interval is negative.

func (Interval) String Uses

func (i Interval) String() string

func (Interval) Union Uses

func (i Interval) Union(other Interval) Interval

Union returns the smallest interval that contains this interval and the given interval.

Package r1 imports 2 packages (graph) and is imported by 8 packages. Updated 2016-10-10. Refresh now. Tools for package owners.