Mercurial > gemma
view cmd/octree2contour/main.go @ 678:7bb961d750b6 octree
octree: traverse horizontally over tree to find out which triangles to process.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 19 Sep 2018 17:34:19 +0200 |
parents | 120a82bd9953 |
children | c79c7be29a7a |
line wrap: on
line source
package main import ( "flag" "log" "time" ) var ( one = flag.Bool("o", false, "create only a single contour") step = flag.Float64("s", 0.5, "step with") max = flag.Float64("m", 10, "max height from lowest poiint") ) func process(tree *octree) { if *one { var triangles int tree.horizontal(*step, func([]int32) { triangles++ }) log.Printf("num triangles: %d\n", triangles) } else { } } func main() { flag.Parse() for _, fname := range flag.Args() { log.Printf("processing %s\n", fname) start := time.Now() tree, err := loadOctree(fname) if err != nil { log.Printf("error: %v\n", err) continue } log.Printf("loading took: %v\n", time.Since(start)) process(tree) } }