delaunay

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package delaunay implements 2d Delaunay triangulation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Point

type Point r2.Point

Point is a float64 2d point used in Delaunay triangulation.

func ConvexHull

func ConvexHull(points []Point) []Point

ConvexHull returns the convex hull of the provided points.

type Triangulation

type Triangulation struct {
	Points     []Point
	ConvexHull []Point
	Triangles  []int
	Halfedges  []int
}

Triangulation stores the points, convex hull, triangles and half edges from a Delaunay triangulation.

func Triangulate

func Triangulate(points []Point) (*Triangulation, error)

Triangulate returns a Delaunay triangulation of the provided points.

func (*Triangulation) GetTriangles

func (t *Triangulation) GetTriangles(pts3d []r3.Vector) [][]r3.Vector

GetTriangles returns a slice that has triangle ID as index, and points IDs as value.

func (*Triangulation) GetTrianglesPointsMap

func (t *Triangulation) GetTrianglesPointsMap() map[int][]int

GetTrianglesPointsMap returns a map that had triangle ID as key, and points IDs as value.

func (*Triangulation) Validate

func (t *Triangulation) Validate() error

Validate performs several sanity checks on the Triangulation to check for potential errors. Returns nil if no issues were found. You normally shouldn't need to call this function but it can be useful for debugging.

Jump to

Keyboard shortcuts

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