Skip to content

Commit f36f070

Browse files
fix sample position
1 parent 4f2b129 commit f36f070

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

src/Aardvark.Geometry.Quadtree/Query.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,9 @@ module Sample =
680680
let gs = positions |> Array.groupBy getQuadrant
681681
for (qi, ps) in gs do
682682
if ps.Length > 0 then
683-
yield! PositionsWithBounds config ps (Box2d(ps)) (n.SubNodes.[qi])
683+
match n.SubNodes.[qi] with
684+
| NoNode -> ()
685+
| subnode -> yield! PositionsWithBounds config ps (Box2d(ps)) subnode
684686

685687
| LinkedNode n -> yield! PositionsWithBounds config positions positionsBounds n.Target
686688

src/Scratch/Program.fs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1575,10 +1575,50 @@ let cp_20240821_query_quadtreetest () =
15751575

15761576
()
15771577

1578+
let bug_20241210 () =
1579+
1580+
let path = @"W:\Datasets\Vgm\Data\2024-12-10_bugreport\quadtree";
1581+
1582+
printfn "path = %s" path
1583+
1584+
let options = SerializationOptions.NewInMemoryStore(verbose = false)
1585+
1586+
let idFile = Guid(File.ReadAllText(@"W:\Datasets\Vgm\Data\2024-12-10_bugreport\quadtree\builder.20241211102935.638695097756085960.key.txt"))
1587+
let builderReloadedFile = Builder.Import(path, idFile)
1588+
match builderReloadedFile with
1589+
| None -> printfn "reloaded from file = None"
1590+
| Some x ->
1591+
printfn "reloaded from file, %d patches" (x.GetPatches() |> Seq.length)
1592+
1593+
let sw = Stopwatch.StartNew()
1594+
let buildConfig = { BuildConfig.Default with Verbose = false; SplitLimitPowerOfTwo = 8 }
1595+
let maybeQuadtree = x.Build2 buildConfig
1596+
sw.Stop()
1597+
printfn "[TIMING] build: %A" sw.Elapsed
1598+
1599+
match maybeQuadtree with
1600+
| None -> failwith "build failed"
1601+
| Some qtree ->
1602+
1603+
let maybeResult = qtree |> Sample.Position Query.Config.Default (V2d(72461.87, 266019.70))
1604+
1605+
match maybeResult with
1606+
| None -> failwith "query failed"
1607+
| Some result ->
1608+
1609+
printfn "%A" result
1610+
1611+
()
1612+
1613+
1614+
()
1615+
15781616
[<EntryPoint>]
15791617
let main argv =
15801618

1581-
cp_20240821_query_quadtreetest ()
1619+
bug_20241210 ()
1620+
1621+
//cp_20240821_query_quadtreetest ()
15821622

15831623
//cp_20240311_quadtree_exception ()
15841624

0 commit comments

Comments
 (0)