comparison 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
comparison
equal deleted inserted replaced
4541:53b55f811666 4542:56f4e8cbfab7
625 binary.Write(buf, binary.LittleEndian, math.Float64bits(p.Y)) 625 binary.Write(buf, binary.LittleEndian, math.Float64bits(p.Y))
626 } 626 }
627 } 627 }
628 628
629 return buf.Bytes() 629 return buf.Bytes()
630 }
631
632 func (ls LineStringZ) CCW() bool {
633 var sum float64
634 for i, v1 := range ls {
635 v2 := ls[(i+1)%len(ls)]
636 sum += (v2.X - v1.X) * (v2.Y + v1.Y)
637 }
638 return sum > 0
630 } 639 }
631 640
632 // Join joins two lines leaving the first of the second out. 641 // Join joins two lines leaving the first of the second out.
633 func (ls LineStringZ) Join(other LineStringZ) LineStringZ { 642 func (ls LineStringZ) Join(other LineStringZ) LineStringZ {
634 nline := make(LineStringZ, len(ls)+len(other)-1) 643 nline := make(LineStringZ, len(ls)+len(other)-1)