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() interface{}
- 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) Rect() Rect
- func (series *Line) Search(rect Rect, iter func(seg Segment, idx int) bool)
- func (series *Line) SegmentAt(index int) Segment
- func (line *Line) Valid() bool
- 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
- func (point Point) Valid() bool
- type Poly
- func (poly *Poly) Clockwise() bool
- func (poly *Poly) ContainsLine(line *Line) bool
- func (poly *Poly) ContainsPoint(point Point) bool
- 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
- func (poly *Poly) Valid() bool
- type RaycastResult
- type Rect
- func (rect Rect) Area() float64
- func (rect Rect) Center() Point
- func (rect Rect) Clockwise() 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) Empty() bool
- func (rect Rect) Index() interface{}
- 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) NumPoints() int
- func (rect Rect) NumSegments() int
- func (rect Rect) PointAt(index int) Point
- func (rect Rect) Rect() Rect
- func (rect Rect) Search(target Rect, iter func(seg Segment, idx int) bool)
- func (rect Rect) SegmentAt(index int) Segment
- func (rect Rect) Valid() bool
- 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, }
DefaultIndexOptions ...
var WorldPolygon = NewPoly([]Point{ {-180, -90}, {-180, 90}, {180, 90}, {180, -90}, {-180, -90}, }, nil, &IndexOptions{})
WorldPolygon is the maximum bounds for any GeoPoint
Functions ¶
This section is empty.
Types ¶
type Geometry ¶
type Geometry interface { Rect() Rect Empty() bool Valid() 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) 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) IntersectsPoint ¶
IntersectsPoint ...
func (*Line) NumPoints ¶
func (series *Line) NumPoints() int
NumPoints returns the number of points in the series
type Point ¶
type Point struct {
X, Y float64
}
Point ...
func (Point) IntersectsPoint ¶
IntersectsPoint ...
type Poly ¶
Poly ...
func NewPoly ¶
func NewPoly(exterior []Point, holes [][]Point, opts *IndexOptions) *Poly
NewPoly ...
func (*Poly) IntersectsPoint ¶
IntersectsPoint ...
type RaycastResult ¶
RaycastResult holds the results of the Raycast operation
type Rect ¶
type Rect struct {
Min, Max Point
}
Rect ...
func (Rect) IntersectsPoint ¶
IntersectsPoint ...
type Segment ¶
type Segment struct {
A, B Point
}
Segment is a two point line
func (Segment) CollinearPoint ¶
CollinearPoint ...
func (Segment) ContainsSegment ¶
ContainsSegment returns true if segment contains other segment
func (Segment) IntersectsSegment ¶
IntersectsSegment detects if segment intersects with other segement
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 Search(rect Rect, iter func(seg Segment, index int) bool) Index() interface{} Valid() 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.