Skip to content

Commit

Permalink
fix octree merge
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanmaierhofer committed Oct 4, 2023
1 parent 3498aca commit a6983b7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Aardvark.Geometry.PointSet/Octrees/Merge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,12 @@ private static IPointCloudNode InjectPointsIntoTree(
var nss = ns != null ? new List<V3f>[8] : null;
var iss = js != null ? new List<int>[8] : null;
var kss = ks != null ? new List<byte>[8] : null;

#if DEBUG
var bb = cell.BoundingBox;
if (!psAbsolute.All(bb.Contains)) Debugger.Break();
#endif

for (var i = 0; i < psAbsolute.Count; i++)
{
var j = a.GetSubIndex(psAbsolute[i]);
Expand All @@ -979,13 +985,14 @@ private static IPointCloudNode InjectPointsIntoTree(
for (var j = 0; j < 8; j++)
{
var x = a.Subnodes![j]?.Value;
if (x != null) //if (pss[j] != null)
if (pss[j] != null)
{
if (x == null) throw new InvalidOperationException("Invariant 6afc7ca3-30da-4cb5-9a02-7572085e89bb.");
subcells[j] = InjectPointsIntoTree(pss[j], css?[j], nss?[j], iss?[j], kss?[j], x, cell.GetOctant(j), config);
}
else
{
subcells[j] = null; // x;
subcells[j] = x;
}
}

Expand Down

0 comments on commit a6983b7

Please sign in to comment.