Skip to content

Commit 15b4108

Browse files
fixed special case in query merge code
vrvis-rmdata/Vgm.Api#84
1 parent 2cb5679 commit 15b4108

File tree

3 files changed

+70
-3
lines changed

3 files changed

+70
-3
lines changed

RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### 0.5.9
2+
- fixed special case in query merge code
3+
14
### 0.5.8
25
- [builder] add build logic for yet more cases
36

src/Aardvark.Geometry.Quadtree/Query.fs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,14 @@ module Query =
286286

287287
match aSub, bSub with
288288
| NoNode, NoNode -> ()
289-
| NoNode, _ -> failwith "Invariant 8f6fbd3d-658e-422b-9643-c4916f48c208."
290-
| _ , NoNode -> failwith "Invariant 43f654ad-a1cc-490a-9902-b0b218da6a95."
289+
| NoNode, _ ->
290+
if config.Verbose then printfn "[QUADRANTS %d] NoNode %A" i bSub.ExactBoundingBox
291+
let r = generic bSub |> Seq.toList
292+
if r.Length > 0 then yield! r
293+
| _ , NoNode ->
294+
if config.Verbose then printfn "[QUADRANTS %d] %A NoNode" i aSub.ExactBoundingBox
295+
let r = generic aSub |> Seq.toList
296+
if r.Length > 0 then yield! r
291297
| _ ->
292298
if config.Verbose then printfn "[QUADRANTS %d] %A %A" i aSub.ExactBoundingBox bSub.ExactBoundingBox
293299
let r = recurse aSub bSub |> Seq.toList

src/Scratch/Program.fs

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1519,10 +1519,68 @@ let cp_20240311_quadtree_exception () =
15191519

15201520
()
15211521

1522+
let cp_20240821_query_quadtreetest () =
1523+
1524+
let path = @"W:\Datasets\Vgm\Quadtree\20240821_query_quadtreetest";
1525+
1526+
printfn "path = %s" path
1527+
1528+
let options = SerializationOptions.NewInMemoryStore(verbose = false)
1529+
1530+
let idFile = Guid(File.ReadAllText(@"W:\Datasets\Vgm\Quadtree\20240821_query_quadtreetest\builder.20240821101057.638598318576754995.key.txt"))
1531+
let builderReloadedFile = Builder.Import(path, idFile)
1532+
match builderReloadedFile with
1533+
| None -> printfn "reloaded from file = None"
1534+
| Some x ->
1535+
printfn "reloaded from file, %d patches" (x.GetPatches() |> Seq.length)
1536+
1537+
let sw = Stopwatch.StartNew()
1538+
let buildConfig = { BuildConfig.Default with Verbose = false; SplitLimitPowerOfTwo = 8 }
1539+
let maybeQuadtree = x.Build2 buildConfig
1540+
sw.Stop()
1541+
printfn "[TIMING] build: %A" sw.Elapsed
1542+
1543+
match maybeQuadtree with
1544+
| None -> failwith "build failed"
1545+
| Some qtree ->
1546+
1547+
let makeReturnValOfQueryResults (resultChunk : seq<Query.Result>) (def : Aardvark.Data.Durable.Def) =
1548+
1549+
let samples =
1550+
resultChunk
1551+
|> Seq.collect (fun chunk -> chunk.GetSamples<V4f> def)
1552+
|> Seq.toList
1553+
1554+
samples
1555+
1556+
let sw = Stopwatch.StartNew()
1557+
let config = Query.Config.Default //{ Query.Config.Default with Verbose = true }
1558+
let resultCells = qtree |> Query.All config |> Seq.toArray
1559+
let samples = makeReturnValOfQueryResults resultCells Defs.HeightsBilinear4f
1560+
let samplesLength = samples.Length
1561+
sw.Stop()
1562+
printfn "[TIMING] query all samples: %A" sw.Elapsed
1563+
1564+
printfn("SAMPLES: count=%d") samplesLength
1565+
let gs = samples
1566+
|> List.groupBy (fun (c, v) -> c.Exponent)
1567+
|> List.map (fun (e, xs) ->
1568+
let countNaN = xs |> Seq.filter(fun (_, x) -> x.IsNaN) |> Seq.length
1569+
(e, xs.Length, countNaN)
1570+
)
1571+
for (e, c, cNaN) in gs do
1572+
//printfn(" e=%d; count=%d; count NaN=%d") e c cNaN
1573+
()
1574+
1575+
1576+
()
1577+
15221578
[<EntryPoint>]
15231579
let main argv =
15241580

1525-
cp_20240311_quadtree_exception ()
1581+
cp_20240821_query_quadtreetest ()
1582+
1583+
//cp_20240311_quadtree_exception ()
15261584

15271585
//cp_20240219_quadtreetest ()
15281586

0 commit comments

Comments
 (0)