comparison pkg/octree/vertex.go @ 3646:810b28f59b8b single-beam

Generate random points for second mesh.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 12 Jun 2019 17:30:20 +0200
parents 2a4216c81e7b
children 01ce3ba9b0d0
comparison
equal deleted inserted replaced
3640:10471aa73ad8 3646:810b28f59b8b
430 Y2: max.Y, 430 Y2: max.Y,
431 } 431 }
432 } 432 }
433 433
434 func (ls LineStringZ) Area() float64 { 434 func (ls LineStringZ) Area() float64 {
435 var result float64 435 return polygonArea(ls)
436 for i := 0; i < len(ls); i += 3 {
437 p0 := ls[i+0]
438 p1 := ls[i+1]
439 p2 := ls[i+2]
440 result += area(p0, p1, p2)
441 }
442 return result / 2
443 } 436 }
444 437
445 func (ls LineStringZ) Reverse() { 438 func (ls LineStringZ) Reverse() {
446 for i, j := 0, len(ls)-1; i < j; i, j = i+1, j-1 { 439 for i, j := 0, len(ls)-1; i < j; i, j = i+1, j-1 {
447 ls[i], ls[j] = ls[j], ls[i] 440 ls[i], ls[j] = ls[j], ls[i]