package planar
import "github.com/paulmach/orb/planar"
Package planar computes properties on geometries assuming they are in 2d euclidean space.
Index ¶
- func Area(g orb.Geometry) float64
- func CentroidArea(g orb.Geometry) (orb.Point, float64)
- func Distance(p1, p2 orb.Point) float64
- func DistanceFrom(g orb.Geometry, p orb.Point) float64
- func DistanceFromSegment(a, b, point orb.Point) float64
- func DistanceFromSegmentSquared(a, b, point orb.Point) float64
- func DistanceFromWithIndex(g orb.Geometry, p orb.Point) (float64, int)
- func DistanceSquared(p1, p2 orb.Point) float64
- func Length(g orb.Geometry) float64
- func MultiPolygonContains(mp orb.MultiPolygon, point orb.Point) bool
- func PolygonContains(p orb.Polygon, point orb.Point) bool
- func RingContains(r orb.Ring, point orb.Point) bool
Examples ¶
Functions ¶
func Area ¶
Area returns the area of the geometry in the 2d plane.
func CentroidArea ¶
CentroidArea returns both the centroid and the area in the 2d plane. Since the area is need for the centroid, return both. Polygon area will always be >= zero. Ring area my be negative if it has a clockwise winding orider.
func Distance ¶
Distance returns the distance between two points in 2d euclidean geometry.
func DistanceFrom ¶
DistanceFrom returns the distance from the boundary of the geometry in the units of the geometry.
func DistanceFromSegment ¶
DistanceFromSegment returns the point's distance from the segment [a, b].
func DistanceFromSegmentSquared ¶
DistanceFromSegmentSquared returns point's squared distance from the segement [a, b].
func DistanceFromWithIndex ¶
DistanceFromWithIndex returns the minimum euclidean distance from the boundary of the geometry plus the index of the sub-geometry that was the match.
func DistanceSquared ¶
DistanceSquared returns the square of the distance between two points in 2d euclidean geometry.
func Length ¶
Length returns the length of the boundary of the geometry using 2d euclidean geometry.
func MultiPolygonContains ¶
func MultiPolygonContains(mp orb.MultiPolygon, point orb.Point) bool
MultiPolygonContains checks if the point is within the multi-polygon. Points on the boundary are considered in.
func PolygonContains ¶
PolygonContains checks if the point is within the polygon. Points on the boundary are considered in.
func RingContains ¶
RingContains returns true if the point is inside the ring. Points on the boundary are considered in.
Source Files ¶
area.go contains.go distance.go distance_from.go length.go
- Version
- v0.11.1 (latest)
- Published
- Jan 29, 2024
- Platform
- js/wasm
- Imports
- 4 packages
- Last checked
- 1 day ago –
Tools for package owners.