Mercurial > gemma
comparison cmd/octree2contour/loader.go @ 682:b17e3ce53285 octree
octree: simplified cube indexing.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 19 Sep 2018 20:55:02 +0200 |
parents | a8d32a11b113 |
children | a31dc9486bd8 |
comparison
equal
deleted
inserted
replaced
681:a8d32a11b113 | 682:b17e3ce53285 |
---|---|
156 if pos == 0 { | 156 if pos == 0 { |
157 continue | 157 continue |
158 } | 158 } |
159 | 159 |
160 if pos > 0 { // node | 160 if pos > 0 { // node |
161 if mid := (max-min)*0.5 + min; h <= mid { | 161 var zbit int32 |
162 stack = append(stack, | 162 if mid := (max-min)*0.5 + min; h >= mid { |
163 frame{ot.index[pos+0], min, mid}, | 163 zbit = 4 |
164 frame{ot.index[pos+1], min, mid}, | 164 min = mid |
165 frame{ot.index[pos+3], min, mid}, | |
166 frame{ot.index[pos+5], min, mid}) | |
167 } else { | 165 } else { |
168 stack = append(stack, | 166 max = mid |
169 frame{ot.index[pos+4], mid, max}, | |
170 frame{ot.index[pos+5], mid, max}, | |
171 frame{ot.index[pos+6], mid, max}, | |
172 frame{ot.index[pos+7], mid, max}) | |
173 } | 167 } |
168 stack = append(stack, | |
169 frame{ot.index[pos+0+zbit], min, max}, | |
170 frame{ot.index[pos+1+zbit], min, max}, | |
171 frame{ot.index[pos+2+zbit], min, max}, | |
172 frame{ot.index[pos+3+zbit], min, max}) | |
174 } else { // leaf | 173 } else { // leaf |
175 pos = -pos - 1 | 174 pos = -pos - 1 |
176 n := ot.index[pos] | 175 n := ot.index[pos] |
177 //log.Printf("%d %d %d\n", pos, n, len(ot.index)) | 176 //log.Printf("%d %d %d\n", pos, n, len(ot.index)) |
178 indices := ot.index[pos+1 : pos+1+n] | 177 indices := ot.index[pos+1 : pos+1+n] |