triangulation

package
v0.0.0-...-ae1d368 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEars

func GetEars(polygon []geometry.Point) ([][]geometry.Point, error)

GetEars Returns polygon ears by using the ear cutting algorithm (n^2)

func NewTriangulatedPolygonFromPoints

func NewTriangulatedPolygonFromPoints(points []geometry.Point) (geometry.Polygon, error)

NewTriangulatedPolygonFromPoints creates a fully triangulated Polygon from a list of points

func TriangulateByEarCut

func TriangulateByEarCut(polygon []geometry.Point) ([][]geometry.Point, error)

TriangulateByEarCut Triangulates a list of points returning a list of triangles of Point2d

func TriangulateGeoJSONFeatureCollectionToShapes

func TriangulateGeoJSONFeatureCollectionToShapes(featureCollection *geojson.FeatureCollection, mapProjection gj.MapProjection) ([]geometry.Shape, error)

TriangulateGeoJSONFeatureCollectionToShapes takes a GeoJSON FeatureCollection and returns it as a list of shapes. You need to provide a MapProjection so we know which MapProjection the provided dataset has.

func TriangulateGeoJSONFeatureToShape

func TriangulateGeoJSONFeatureToShape(feature *geojson.Feature, mapProjection gj.MapProjection) (geometry.Shape, error)

TriangulateGeoJSONFeatureToShape takes a GeoJSON Feature as input and triangulates it to a shape.

func TriangulatePoints

func TriangulatePoints(points []geometry.Point) ([][]geometry.Point, error)

TriangulatePoints initiates a triangulation based on a single dimensioned polygon Returns a double dimensioned array consisting of triangles

func TriangulateShapesFromFile

func TriangulateShapesFromFile(filePath, fileName string, fileType file.InputType, mapProjection gj.MapProjection) ([]geometry.Shape, error)

TriangulateShapesFromFile tries to fetch shapes from a GeoJSON file. The shapes will be triangulated if necesssary, cached, and saved besides the file in a gob-format. The next load will use the cached entries.

Types

type Error

type Error struct {
	// Description short description of error
	Description string
	// Ears ears of the triangulation when it failed
	Ears [][]geometry.Point
	// PolygonWhenError The failing polygon upon failure
	PolygonWhenError []geometry.Point
}

Error contains information about the state when a triangulation happened

func (Error) Error

func (e Error) Error() string

Jump to

Keyboard shortcuts

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