# HG changeset patch # User Sascha L. Teichmann # Date 1569835361 -7200 # Node ID befb94e3a953615669a17a33e4fe7097820f6d98 # Parent 6247f5a4222658eb01378dae76cc35e90aff0928 More debug output. diff -r 6247f5a42226 -r befb94e3a953 cmd/isoareas/main.go --- a/cmd/isoareas/main.go Fri Sep 27 18:20:13 2019 +0200 +++ b/cmd/isoareas/main.go Mon Sep 30 11:22:41 2019 +0200 @@ -23,6 +23,7 @@ "math/bits" "math/rand" "os" + "sort" "strconv" "strings" "time" @@ -248,11 +249,25 @@ if len(cut) >= 2 { arc := int32(len(arcs)) arcs = append(arcs, cut) - cuts[j] = append(cuts[j], indexedArc{arc, i / 3}) + cuts[j] = append(cuts[j], indexedArc{arc: arc, index: i / 3}) } } } + for l, c := range classes { + sorted := sort.SliceIsSorted(c, func(i, j int) bool { + return c[i] < c[j] + }) + log.Printf("class[%d] sorted: %t\n", l, sorted) + } + + for l, c := range cuts { + sorted := sort.SliceIsSorted(c, func(i, j int) bool { + return c[i].index < c[j].index + }) + log.Printf("cut[%d] sorted: %t\n", l, sorted) + } + // connect the arcs in a cut list to longer arcs. for _, c := range cuts { @@ -269,7 +284,7 @@ usedArcs := map[int32]struct{}{} var dupes int - var isolated, inside int + var isolated, inside, found int allInClass: for _, idx := range c { ns := neighbors(tri, idx) @@ -291,10 +306,7 @@ default: ti := tri.Triangles[idx*3 : idx*3+3] for j := 0; j < 3; j++ { - if mask&(1<= len(cuts) { continue } - arcIdx := findArc(ns[j], cuts[l]) + arcIdx := findArc(ns[j]/3, cuts[l]) if arcIdx == -1 { continue } + found++ aIdx := cuts[l][arcIdx].arc if _, already := usedArcs[aIdx]; already { dupes++ @@ -348,8 +361,15 @@ } } - log.Printf("\t%d: inside: %d / isolated: %d open: %d closed: %d dupes: %d\n", - i, inside, isolated, pb.open.Len(), len(pb.polygons), dupes) + log.Printf("\t%d: inside: %d / isolated: %d open: %d closed: %d dupes: %d found: %d\n", + i, inside, isolated, pb.open.Len(), len(pb.polygons), dupes, found) + + /* + for e := pb.open.Front(); e != nil; e = e.Next() { + line := e.Value.(octree.LineStringZ) + pb.polygons = append(pb.polygons, line) + } + */ result[i] = pb.polygons }