Documentation
¶
Index ¶
- type Coords
- func (p *Coords[V]) Add(point orb.Pointer) error
- func (p *Coords[V]) Closest(x, y float64) (V, bool)
- func (p *Coords[V]) Get(point orb.Pointer, fn quadtree.FilterFunc) V
- func (p *Coords[V]) Has(point orb.Pointer, fn quadtree.FilterFunc) bool
- func (p *Coords[V]) KNearest(point orb.Point, max int, fn quadtree.FilterFunc, maxDistance float64) []orb.Pointer
- func (p *Coords[V]) Remove(point orb.Pointer, fn quadtree.FilterFunc) bool
- func (p *Coords[V]) Replace(point orb.Pointer, fn quadtree.FilterFunc, equalFn CoordsEqualFn) error
- type CoordsEqualFn
- type CoordsRO
- func (p *CoordsRO[V]) Closest(x, y float64) (V, bool)
- func (p *CoordsRO[V]) Get(point orb.Pointer, fn quadtree.FilterFunc) V
- func (p *CoordsRO[V]) Has(point orb.Pointer, fn quadtree.FilterFunc) bool
- func (p *CoordsRO[V]) KNearest(point orb.Pointer, max int, fn quadtree.FilterFunc, maxDistance float64) []orb.Pointer
- type ICoords
- type ICoordsRO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Coords ¶
type Coords[V orb.Pointer] struct { // Embeds the ICoords interface for generic spatial operations ICoords[V] // contains filtered or unexported fields }
Coords provides a thread-safe wrapper around a quadtree for storing and querying coordinates.
func NewWithBounds ¶
NewWithBounds creates a new Coords instance with the specified bounds.
func (*Coords[V]) Get ¶
func (p *Coords[V]) Get(point orb.Pointer, fn quadtree.FilterFunc) V
Get returns the value of a point matching the filter from the quadtree.
func (*Coords[V]) KNearest ¶
func (p *Coords[V]) KNearest(point orb.Point, max int, fn quadtree.FilterFunc, maxDistance float64) []orb.Pointer
KNearest returns up to max nearest points to the given point, filtered and within maxDistance.
func (*Coords[V]) Replace ¶
func (p *Coords[V]) Replace(point orb.Pointer, fn quadtree.FilterFunc, equalFn CoordsEqualFn) error
Replace removes a point if it exists (and is not equal according to equalFn), then adds the new point.
type CoordsEqualFn ¶
CoordsEqualFn must return true if both points are equal.
type CoordsRO ¶
type CoordsRO[V orb.Pointer] struct { // Embeds the ICoords interface for generic spatial operations ICoords[V] // contains filtered or unexported fields }
CoordsRO provides a read-only wrapper around a quadtree for spatial queries.
func NewReadOnly ¶
NewReadOnly creates a new read-only coordinate store from a slice of points. Returns an error if any point cannot be added to the quadtree.
func (*CoordsRO[V]) Get ¶
func (p *CoordsRO[V]) Get(point orb.Pointer, fn quadtree.FilterFunc) V
Get returns the value of a point matching the filter from the quadtree.