hitmap

package
v0.0.0-...-3cd2f5a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2022 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNew

func MustNew(clipbox *geom.Extent, geo geom.Geometry) planar.HitMapper

func New

func New(clipbox *geom.Extent, geo geom.Geometry) (planar.HitMapper, error)

NewHitMap will return a Polygon Hit map, a Ordered Hit Map, or a nil Hit map based on the geomtry type.

Types

type Always

type Always planar.Label

always will return the label for the point.

const (
	Inside  Always = Always(planar.Inside)
	Outside Always = Always(planar.Outside)
)

func (Always) Area

func (a Always) Area() float64

func (Always) Extent

func (a Always) Extent() [4]float64

func (Always) LabelFor

func (a Always) LabelFor(_ [2]float64) planar.Label

type ByAreaDec

type ByAreaDec []planar.HitMapper

PolygonHMSliceByAreaDec will allow you to sort a slice of PolygonHM in decending order

func (ByAreaDec) Len

func (hm ByAreaDec) Len() int

func (ByAreaDec) Less

func (hm ByAreaDec) Less(i, j int) bool

func (ByAreaDec) Swap

func (hm ByAreaDec) Swap(i, j int)

type OrderedHM

type OrderedHM []planar.HitMapper

OrderedHM will iterate through a set of HitMaps looking for the first one to return inside, if none of the hitmaps return inside it will return outside.

func NewOrderedHM

func NewOrderedHM(hms ...planar.HitMapper) OrderedHM

NewOrderdHM will add the provided hitmaps in reverse order so that the last hit map is always tried first.

func (OrderedHM) Area

func (hms OrderedHM) Area() float64

Area returns the area of the total extent of the hitmaps that are contain in the slice.

func (OrderedHM) Extent

func (hms OrderedHM) Extent() [4]float64

Extent is the accumlative extent of all the extens in the slice.

func (OrderedHM) LabelFor

func (hms OrderedHM) LabelFor(pt [2]float64) planar.Label

type PolygonHM

type PolygonHM struct {
	// contains filtered or unexported fields
}

PolygonHM implements a basic hit map that gives the label for a point based on the order of the rings.

func MustNewFromPolygons

func MustNewFromPolygons(clipbox *geom.Extent, plys ...[][][2]float64) *PolygonHM

MustNewFromPolygons is like NewFromPolygons except on error it will panic.

func NewFromPolygons

func NewFromPolygons(clipbox *geom.Extent, plys ...[][][2]float64) (*PolygonHM, error)

NewFromPolygons assumes that the outer ring of each polygon is inside, and each inner ring is inside.

func (*PolygonHM) Area

func (hm *PolygonHM) Area() float64

Area returns the area covered by the hitmap.

func (*PolygonHM) Extent

func (hm *PolygonHM) Extent() [4]float64

Extent returns the extent of the hitmap.

func (*PolygonHM) LabelFor

func (hm *PolygonHM) LabelFor(pt [2]float64) planar.Label

LabelFor returns the label for the given point.

type Ring

type Ring struct {
	Label planar.Label
	// contains filtered or unexported fields
}

func NewRing

func NewRing(ring [][2]float64, label planar.Label) *Ring

func (Ring) ContainsPoint

func (r Ring) ContainsPoint(pt [2]float64) bool

Contains returns weather the point is contained by the ring, if the point is on the border it is considered not contained.

func (*Ring) MaxX

func (r *Ring) MaxX() float64

func (*Ring) MaxY

func (r *Ring) MaxY() float64

func (*Ring) MinX

func (r *Ring) MinX() float64

func (*Ring) MinY

func (r *Ring) MinY() float64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL