Documentation

Index

Constants

View Source
const (

	// Experimental testing produced this result.
	// For finding the intersect we need higher precision.
	// Then geom.PrecisionLevelBigFloat
	PrecisionLevelBigFloat = 110
)
View Source
const Rad = math.Pi / 180

Rad is the factor to go from pi to radians

Variables

This section is empty.

Functions

func AreLinesColinear

func AreLinesColinear(l1, l2 geom.Line) bool

AreLinesColinear check if the two lines are colinear based on the slope formula

func DistanceToLineSegment

func DistanceToLineSegment(p geom.Pointer, v geom.Pointer, w geom.Pointer) float64

DistanceToLineSegment calculates the distance from point p to line segment v, w.

Taken from: https://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment

func IsPointOnLine

func IsPointOnLine(compare cmp.Compare, pt [2]float64, l1, l2 [2]float64) bool

IsPointOnLine checks if pt is on the lines l1, l2 by checking slope and intersect form

func IsPointOnLineSegment

func IsPointOnLineSegment(compare cmp.Compare, pt geom.Point, seg geom.Line) bool

IsPointOnLineSegment checks if pt is on the line segment (seg)

func LineIntersect

func LineIntersect(l1, l2 geom.Line) (pt [2]float64, ok bool)

LineIntersect find the intersection point (x,y) between two lines if there is one. Ok will be true if it found an interseciton point. ok being false, means there isn't just one intersection point, there could be zero, or more then one. ref: https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line

func LineIntersectBigFloat

func LineIntersectBigFloat(l1, l2 geom.Line) (pt [2]*big.Float, ok bool)

LineIntersectBigFloat find the intersection point (x,y) between two lines if there is one. Ok will be true if it found an interseciton point. Internally uses math/big ok being false, means there isn't just one intersection point, there could be zero, or more then one. ref: https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line

func NormalizeLines

func NormalizeLines(lines []geom.Line)

func NormalizeUniqueLines

func NormalizeUniqueLines(lines []geom.Line) []geom.Line

func PerpendicularDistance

func PerpendicularDistance(line [2][2]float64, point [2]float64) float64

PerpendicularDistance provides the distance between a line and a point in Euclidean space. ref: https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line#Line_defined_by_two_points

func PointDistance

func PointDistance(p1 geom.Pointer, p2 geom.Pointer) float64

PointDistance returns the euclidean distance between two points.

func PointDistance2

func PointDistance2(p1 geom.Pointer, p2 geom.Pointer) float64

PointDistance2 returns the euclidean distance between two points squared.

This can be a useful optimization in some routines where d^2 is good enough.

func PointOnLineAt

func PointOnLineAt(ln geom.Line, distance float64) geom.Point

PointOnLineAt will return a point on the given line at the distance from the origin of the line

func PointsCentriod

func PointsCentriod(pts ...[2]float64) (center [2]float64)

PointsCentriod returns the center of the given pts

func SegmentIntersect

func SegmentIntersect(l1, l2 geom.Line) (pt [2]float64, ok bool)

SegmentIntersect will find the intersection point (x,y) between two lines if there is one. Ok will be true if it found an intersection point and if the point is on both lines. ref: https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line

func Simplify

func Simplify(ctx context.Context, simplifer Simplifer, geometry geom.Geometry) (geom.Geometry, error)

Simplify will simplify the provided geometry using the provided simplifer. If the simplifer is nil, no simplification will be attempted.

func Slope

func Slope(line [2][2]float64) (m, b float64, defined bool)

Slope — finds the Slope of a line

Types

type Clipper

type Clipper interface {
	// Clip will take a valid geometry and a clipbox, returning a clipped version of the geometry to the clipbox, or an error
	Clip(ctx context.Context, geo geom.Geometry, clipbox *geom.Extent) (geometry geom.Geometry, err error)
}

type HitMapper

type HitMapper interface {
	LabelFor(pt [2]float64) Label
	Extent() [4]float64
	Area() float64
}

type Label

type Label uint8

Label is the the label for the triangle. Is in "inside" or "outside". TODO: gdey — would be make more sense to just have a bool here? IsInside or somthing like that?

const (
	// Unknown is the default if it cannot be determined in/outside
	Unknown Label = iota
	Outside
	Inside
)

func (Label) String

func (l Label) String() string

type LinesByLength

type LinesByLength []geom.Line

func (LinesByLength) Len

func (l LinesByLength) Len() int

func (LinesByLength) Less

func (l LinesByLength) Less(i, j int) bool

func (LinesByLength) Swap

func (l LinesByLength) Swap(i, j int)

type LinesByXY

type LinesByXY []geom.Line

func (LinesByXY) Len

func (l LinesByXY) Len() int

func (LinesByXY) Less

func (l LinesByXY) Less(i, j int) bool

func (LinesByXY) Swap

func (l LinesByXY) Swap(i, j int)

type MakeValider

type MakeValider interface {
	// Makevalid will take a possibility invalid geometry and an optional clipbox, returning a valid geometry, weather it clipped the geometry, or an error if one occured.
	Makevalid(ctx context.Context, geo geom.Geometry, clipbox *geom.Extent) (geometry geom.Geometry, didClip bool, err error)
}

type PointLineDistanceFunc

type PointLineDistanceFunc func(line [2][2]float64, point [2]float64) float64

PointLineDistanceFunc is the abstract method to get the distance from point to a line depending on projection

type Simplifer

type Simplifer interface {
	Simplify(ctx context.Context, linestring [][2]float64, isClosed bool) ([][2]float64, error)
}

Simplifer is an interface for Simplifying geometries.

Directories

Path Synopsis
clip
coord
coord/utm Package utm provides the ability to work with UTM coordinates References: https://stevedutch.net/FieldMethods/UTMSystem.htm https://gisgeography.com/central-meridian/
index/kdtree kdtree is a two dimensional kd-tree implementation
intersect
makevalid
makevalid/hitmap
makevalid/walker
simplify
triangulate
triangulate/delaunay
triangulate/delaunay/quadedge Package quadedge describes a quadedge object used to build up the triangulation A quadedge is made up of four directional edges DO ^* || O*----++---->D L D<----++----*O R || *V OD O represents the Origin D represents the Destination
triangulate/delaunay/subdivision
triangulate/delaunay/subdivision/internal/phenix
triangulate/delaunay/subdivision/pseudopolygon
triangulate/delaunay/subdivision/testingtables