Documentation ¶
Index ¶
- Variables
- type Geometry
- type IndexKind
- type IndexOptions
- type Line
- func (series *Line) Clockwise() bool
- func (series *Line) Closed() bool
- func (line *Line) ContainsLine(other *Line) bool
- func (line *Line) ContainsPoint(point Point) bool
- func (line *Line) ContainsPoly(poly *Poly) bool
- func (line *Line) ContainsRect(rect Rect) bool
- func (series *Line) Convex() bool
- func (series *Line) Empty() bool
- func (series *Line) Index() []byte
- func (line *Line) IntersectsLine(other *Line) bool
- func (line *Line) IntersectsPoint(point Point) bool
- func (line *Line) IntersectsPoly(poly *Poly) bool
- func (line *Line) IntersectsRect(rect Rect) bool
- func (line *Line) Move(deltaX, deltaY float64) *Line
- func (series *Line) NumPoints() int
- func (series *Line) NumSegments() int
- func (series *Line) PointAt(index int) Point
- func (series *Line) RawPoints() []Point
- func (series *Line) Rect() Rect
- func (series *Line) Search(rect Rect, iter func(seg Segment, idx int) bool)
- func (series *Line) SegmentAt(index int) Segment
- type Point
- func (point Point) ContainsLine(line *Line) bool
- func (point Point) ContainsPoint(other Point) bool
- func (point Point) ContainsPoly(poly *Poly) bool
- func (point Point) ContainsRect(rect Rect) bool
- func (point Point) Empty() bool
- func (point Point) IntersectsLine(line *Line) bool
- func (point Point) IntersectsPoint(other Point) bool
- func (point Point) IntersectsPoly(poly *Poly) bool
- func (point Point) IntersectsRect(rect Rect) bool
- func (point Point) Move(deltaX, deltaY float64) Point
- func (point Point) Rect() Rect
- type Poly
- func (poly *Poly) Clockwise() bool
- func (poly *Poly) ContainsLine(line *Line) bool
- func (poly *Poly) ContainsPoint(point Point) bool
- func (poly *Poly) ContainsPointEx(point Point) (contains bool, holeIndex int)
- func (poly *Poly) ContainsPoly(other *Poly) bool
- func (poly *Poly) ContainsRect(rect Rect) bool
- func (poly *Poly) Empty() bool
- func (poly *Poly) IntersectsLine(line *Line) bool
- func (poly *Poly) IntersectsPoint(point Point) bool
- func (poly *Poly) IntersectsPoly(other *Poly) bool
- func (poly *Poly) IntersectsRect(rect Rect) bool
- func (poly *Poly) Move(deltaX, deltaY float64) *Poly
- func (poly *Poly) Rect() Rect
- type RaycastResult
- type Rect
- func (rect Rect) Area() float64
- func (rect Rect) Center() Point
- func (rect Rect) Clockwise() bool
- func (rect Rect) Closed() bool
- func (rect Rect) ContainsLine(line *Line) bool
- func (rect Rect) ContainsPoint(point Point) bool
- func (rect Rect) ContainsPoly(poly *Poly) bool
- func (rect Rect) ContainsRect(other Rect) bool
- func (rect Rect) Convex() bool
- func (rect Rect) East() Segment
- func (rect Rect) Empty() bool
- func (rect Rect) Index() []byte
- func (rect Rect) IntersectsLine(line *Line) bool
- func (rect Rect) IntersectsPoint(point Point) bool
- func (rect Rect) IntersectsPoly(poly *Poly) bool
- func (rect Rect) IntersectsRect(other Rect) bool
- func (rect Rect) Move(deltaX, deltaY float64) Rect
- func (rect Rect) NE() Point
- func (rect Rect) NW() Point
- func (rect Rect) North() Segment
- func (rect Rect) NumPoints() int
- func (rect Rect) NumSegments() int
- func (rect Rect) PointAt(index int) Point
- func (rect Rect) RawPoints() []Point
- func (rect Rect) Rect() Rect
- func (rect Rect) SE() Point
- func (rect Rect) SW() Point
- func (rect Rect) Search(target Rect, iter func(seg Segment, idx int) bool)
- func (rect Rect) SegmentAt(index int) Segment
- func (rect Rect) South() Segment
- func (rect Rect) Union(other Rect) Rect
- func (rect Rect) West() Segment
- type Ring
- type Segment
- func (seg Segment) CollinearPoint(point Point) bool
- func (seg Segment) ContainsPoint(point Point) bool
- func (seg Segment) ContainsSegment(other Segment) bool
- func (seg Segment) IntersectsSegment(other Segment) bool
- func (seg Segment) Move(deltaX, deltaY float64) Segment
- func (seg Segment) Raycast(point Point) RaycastResult
- func (seg Segment) Rect() Rect
- type Series
Constants ¶
This section is empty.
Variables ¶
var ( DefaultIndexOptions = &IndexOptions{Kind: QuadTree, MinPoints: 64} NoIndexing = &IndexOptions{Kind: None, MinPoints: 0} )
var AZ = []Point{}/* 1582 elements not displayed */
var RI = []Point{}/* 214 elements not displayed */
var TX = []Point{}/* 12478 elements not displayed */
Functions ¶
This section is empty.
Types ¶
type Geometry ¶
type Geometry interface { Rect() Rect Empty() bool ContainsPoint(point Point) bool IntersectsPoint(point Point) bool ContainsRect(rect Rect) bool IntersectsRect(rect Rect) bool ContainsLine(line *Line) bool IntersectsLine(line *Line) bool ContainsPoly(poly *Poly) bool IntersectsPoly(poly *Poly) bool }
Geometry is a standard geometry
type IndexOptions ¶
IndexOptions are segment indexing options
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
Line is a open series of points
func (*Line) ContainsLine ¶
func (*Line) ContainsPoint ¶
func (*Line) ContainsPoly ¶
func (*Line) ContainsRect ¶
func (*Line) Convex ¶
func (series *Line) Convex() bool
Convex returns true if the points create a convex loop or linestring
func (*Line) Empty ¶
func (series *Line) Empty() bool
Empty returns true if the series does not take up space.
func (*Line) IntersectsLine ¶
func (*Line) IntersectsPoint ¶
func (*Line) IntersectsPoly ¶
func (*Line) IntersectsRect ¶
func (*Line) NumPoints ¶
func (series *Line) NumPoints() int
NumPoints returns the number of points in the series
func (*Line) NumSegments ¶
func (series *Line) NumSegments() int
type Point ¶
type Point struct {
X, Y float64
}
func (Point) ContainsLine ¶
func (Point) ContainsPoint ¶
func (Point) ContainsPoly ¶
func (Point) ContainsRect ¶
func (Point) IntersectsLine ¶
func (Point) IntersectsPoint ¶
func (Point) IntersectsPoly ¶
func (Point) IntersectsRect ¶
type Poly ¶
func (*Poly) ContainsLine ¶
func (*Poly) ContainsPoint ¶
func (*Poly) ContainsPointEx ¶
ContainsPointEx returns true if the polygon contains a point. Returns the index of the hole that contains the point, or -1 if the point is not inside of a hole.
func (*Poly) ContainsPoly ¶
func (*Poly) ContainsRect ¶
func (*Poly) IntersectsLine ¶
func (*Poly) IntersectsPoint ¶
func (*Poly) IntersectsPoly ¶
func (*Poly) IntersectsRect ¶
type RaycastResult ¶
RaycastResult holds the results of the Raycast operation
type Rect ¶
type Rect struct {
Min, Max Point
}
func (Rect) ContainsLine ¶
func (Rect) ContainsPoint ¶
func (Rect) ContainsPoly ¶
func (Rect) ContainsRect ¶
func (Rect) IntersectsLine ¶
func (Rect) IntersectsPoint ¶
func (Rect) IntersectsPoly ¶
func (Rect) IntersectsRect ¶
func (Rect) NumSegments ¶
type Segment ¶
type Segment struct {
A, B Point
}
Segment is a two point line
func DistanceToSeries ¶
func DistanceToSeries( series Series, distToRect func(rect Rect) float64, distToSegment func(seg Segment) float64, ) (seg Segment, idx int, dist float64)
DistanceToSeries returns an arbritary distance to a Series. All the calculations are performed within two functions, that must be provided by the caller: - distToRect to calculate a distance to a Rectangle. - distToSegment to calculate a distance to a Segment. Returns NaN if the series is empty.
func (Segment) CollinearPoint ¶
func (Segment) ContainsPoint ¶
func (Segment) ContainsSegment ¶
ContainsSegment returns true if segment contains other segment
func (Segment) IntersectsSegment ¶
IntersectsSegment detects if segment intersects with other segment
func (Segment) Raycast ¶
func (seg Segment) Raycast(point Point) RaycastResult
Raycast performs the raycast operation
type Series ¶
type Series interface { Rect() Rect Empty() bool Convex() bool Clockwise() bool NumPoints() int NumSegments() int PointAt(index int) Point SegmentAt(index int) Segment Index() []byte RawPoints() []Point Closed() bool Search(rect Rect, iter func(seg Segment, index int) bool) }
Series is just a series of points with utilities for efficiently accessing segments from rectangle queries, making stuff like point-in-polygon lookups very quick.