Mercurial > gemma
diff pkg/mesh/triangulation.go @ 5601:1222b777f51f
Made golint finally happy.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sat, 06 Aug 2022 02:09:57 +0200 |
parents | 5f47eeea988d |
children |
line wrap: on
line diff
--- a/pkg/mesh/triangulation.go Sat Aug 06 00:46:21 2022 +0200 +++ b/pkg/mesh/triangulation.go Sat Aug 06 02:09:57 2022 +0200 @@ -26,6 +26,9 @@ "gonum.org/v1/gonum/stat" ) +// Triangulation represents a triangulation +// consisting of its vertices, the convex hull, +// the triangles and a half edge representation. type Triangulation struct { Points []Vertex ConvexHull []Vertex @@ -40,6 +43,12 @@ return &Triangulation{points, t.convexHull(), t.triangles, t.halfedges}, err } +// EstimateTooLong estimates an edge length which is too long +// to be a real triangle in the triangulation. +// It is assumed that the triangles in this mesh are +// more or less equally sized. If an edge length is more +// than the 3.5 of the standard dev of the medium length +// it is considered as too long. func (t *Triangulation) EstimateTooLong() float64 { num := len(t.Triangles) / 3 @@ -69,6 +78,9 @@ return 3.5 * std } +// ConcaveHull constructs a concave hull for this mesh, +// Triangles that are considered as too large based on +// the EstimateTooLong estimation are removed from the border. func (t *Triangulation) ConcaveHull(tooLong float64) (LineStringZ, map[int32]struct{}) { if tooLong <= 0 { @@ -239,6 +251,8 @@ return polygon, removed } +// TriangleSlices returns the indices of the triangles +// of the mesh as slices og length three. func (t *Triangulation) TriangleSlices() [][]int32 { sl := make([][]int32, len(t.Triangles)/3) var j int @@ -249,6 +263,7 @@ return sl } +// Tin creates a TIN out of this triangulation. func (t *Triangulation) Tin() *Tin { min := Vertex{math.MaxFloat64, math.MaxFloat64, math.MaxFloat64}