Mercurial > gemma
diff pkg/octree/vertex.go @ 4542:56f4e8cbfab7 iso-areas
Sew together triangles that totally inside a single class.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 26 Sep 2019 18:11:38 +0200 |
parents | 4233570de212 |
children | aa2d0006e742 |
line wrap: on
line diff
--- a/pkg/octree/vertex.go Thu Sep 26 15:37:56 2019 +0200 +++ b/pkg/octree/vertex.go Thu Sep 26 18:11:38 2019 +0200 @@ -629,6 +629,15 @@ return buf.Bytes() } +func (ls LineStringZ) CCW() bool { + var sum float64 + for i, v1 := range ls { + v2 := ls[(i+1)%len(ls)] + sum += (v2.X - v1.X) * (v2.Y + v1.Y) + } + return sum > 0 +} + // Join joins two lines leaving the first of the second out. func (ls LineStringZ) Join(other LineStringZ) LineStringZ { nline := make(LineStringZ, len(ls)+len(other)-1)