MCPcopy
hub / github.com/golang/geo / Region

Interface Region

s2/region.go:22–59  ·  view source on GitHub ↗

A Region represents a two-dimensional region on the unit sphere. The purpose of this interface is to allow complex regions to be approximated as simpler regions. The interface is restricted to methods that are useful for computing approximations.

Source from the content-addressed store, hash-verified

20// approximated as simpler regions. The interface is restricted to methods
21// that are useful for computing approximations.
22type Region interface {
23 // CapBound returns a bounding spherical cap. This is not guaranteed to be exact.
24 CapBound() Cap
25
26 // RectBound returns a bounding latitude-longitude rectangle that contains
27 // the region. The bounds are not guaranteed to be tight.
28 RectBound() Rect
29
30 // ContainsCell reports whether the region completely contains the given region.
31 // It returns false if containment could not be determined.
32 ContainsCell(c Cell) bool
33
34 // IntersectsCell reports whether the region intersects the given cell or
35 // if intersection could not be determined. It returns false if the region
36 // does not intersect.
37 IntersectsCell(c Cell) bool
38
39 // ContainsPoint reports whether the region contains the given point or not.
40 // The point should be unit length, although some implementations may relax
41 // this restriction.
42 ContainsPoint(p Point) bool
43
44 // CellUnionBound returns a small collection of CellIDs whose union covers
45 // the region. The cells are not sorted, may have redundancies (such as cells
46 // that contain other cells), and may cover much more area than necessary.
47 //
48 // This method is not intended for direct use by client code. Clients
49 // should typically use Covering, which has options to control the size and
50 // accuracy of the covering. Alternatively, if you want a fast covering and
51 // don't care about accuracy, consider calling FastCovering (which returns a
52 // cleaned-up version of the covering computed by this method).
53 //
54 // CellUnionBound implementations should attempt to return a small
55 // covering (ideally 4 cells or fewer) that covers the region and can be
56 // computed quickly. The result is used by RegionCoverer as a starting
57 // point for further refinement.
58 CellUnionBound() []CellID
59}
60
61// Enforce Region interface satisfaction.
62var (

Callers 2

TestCovererRandomCellsFunction · 0.85
TestCovererRandomCapsFunction · 0.85

Implementers 6

Cells2/cell.go
Caps2/cap.go
Loops2/loop.go
Polygons2/polygon.go
Points2/point.go
Rects2/rect.go

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…