Mercurial > gemma
comparison cmd/octreediff/main.go @ 2516:1ec4c5633eb6 octree-diff
Clip STR tree and not Octree.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 05 Mar 2019 17:08:16 +0100 |
parents | 1534df518201 |
children | 7686c7c23506 |
comparison
equal
deleted
inserted
replaced
2515:6bcaa8bf2603 | 2516:1ec4c5633eb6 |
---|---|
393 log.Printf("triangulation took %v\n", now.Sub(last)) | 393 log.Printf("triangulation took %v\n", now.Sub(last)) |
394 last = now | 394 last = now |
395 | 395 |
396 var str octree.STRTree | 396 var str octree.STRTree |
397 | 397 |
398 str.Build(tri) | 398 tin := tri.Tin() |
399 | |
400 str.Build(tin) | |
399 | 401 |
400 now = time.Now() | 402 now = time.Now() |
401 log.Printf("building STR tree took %v\n", now.Sub(last)) | 403 log.Printf("building STR tree took %v\n", now.Sub(last)) |
402 last = now | 404 last = now |
403 | 405 |
404 builder := octree.NewBuilder(tri.Tin()) | 406 removed := str.Clip(&clippingPolygon) |
405 builder.Build() | 407 now = time.Now() |
408 log.Printf("clipping STR tree took %v\n", now.Sub(last)) | |
409 last = now | |
410 | |
411 log.Printf("Number of triangles to clip: %d\n", len(removed)) | |
412 | |
413 builder := octree.NewBuilder(tin) | |
414 builder.Build(removed) | |
406 | 415 |
407 now = time.Now() | 416 now = time.Now() |
408 log.Printf("building octree took %v\n", now.Sub(last)) | 417 log.Printf("building octree took %v\n", now.Sub(last)) |
409 last = now | 418 last = now |
410 | 419 |
411 tree := builder.Tree() | 420 tree := builder.Tree() |
412 tree.Clip(&clippingPolygon) | |
413 //tree.Dump() | |
414 | |
415 now = time.Now() | |
416 log.Printf("clipping octree took %v\n", now.Sub(last)) | |
417 last = now | |
418 | 421 |
419 log.Printf("min/max: %f %f\n", tree.Min.Z, tree.Max.Z) | 422 log.Printf("min/max: %f %f\n", tree.Min.Z, tree.Max.Z) |
420 | 423 |
421 var heights []float64 | 424 var heights []float64 |
422 | 425 |