comparison cmd/octree2contour/octree.go @ 726:5af9ab39e715

Renamed a few types to uppercase names to prepare the move to the octree package.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sat, 22 Sep 2018 21:34:12 +0200
parents 9db4ae29ded9
children
comparison
equal deleted inserted replaced
725:e0437ec46798 726:5af9ab39e715
2 2
3 import ( 3 import (
4 "math" 4 "math"
5 ) 5 )
6 6
7 type octree struct { 7 type Octree struct {
8 epsg uint32 8 EPSG uint32
9 9
10 vertices []vertex 10 vertices []Vertex
11 triangles [][]int32 11 triangles [][]int32
12 index []int32 12 index []int32
13 13
14 min vertex 14 Min Vertex
15 max vertex 15 Max Vertex
16 } 16 }
17 17
18 func (ot *octree) horizontal(h float64, fn func(*triangle)) { 18 func (ot *Octree) Horizontal(h float64, fn func(*Triangle)) {
19 19
20 type frame struct { 20 type frame struct {
21 pos int32 21 pos int32
22 min float64 22 min float64
23 max float64 23 max float64
24 } 24 }
25 25
26 if h < ot.min.z || ot.max.z < h { 26 if h < ot.Min.z || ot.Max.z < h {
27 return 27 return
28 } 28 }
29 29
30 stack := []frame{{1, ot.min.z, ot.max.z}} 30 stack := []frame{{1, ot.Min.z, ot.Max.z}}
31 31
32 dupes := map[int32]struct{}{} 32 dupes := map[int32]struct{}{}
33 33
34 for len(stack) > 0 { 34 for len(stack) > 0 {
35 top := stack[len(stack)-1] 35 top := stack[len(stack)-1]
62 for _, idx := range indices { 62 for _, idx := range indices {
63 if _, found := dupes[idx]; found { 63 if _, found := dupes[idx]; found {
64 continue 64 continue
65 } 65 }
66 tri := ot.triangles[idx] 66 tri := ot.triangles[idx]
67 t := triangle{ 67 t := Triangle{
68 ot.vertices[tri[0]], 68 ot.vertices[tri[0]],
69 ot.vertices[tri[1]], 69 ot.vertices[tri[1]],
70 ot.vertices[tri[2]], 70 ot.vertices[tri[2]],
71 } 71 }
72 72