Skip to content

Commit

Permalink
[Test] PointsNearObject; prerelease0007
Browse files Browse the repository at this point in the history
  • Loading branch information
aszabo314 committed Nov 29, 2023
1 parent bb24265 commit aa5115e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 5.3.0-prerelease007
- structured point clouds query (prerelease, for testing only)

### 5.3.0-prerelease006
- structured point clouds delete (prerelease, for testing only)

Expand Down
24 changes: 23 additions & 1 deletion src/Aardvark.Algodat.Tests/QueryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ You should have received a copy of the GNU Affero General Public License
using System.Diagnostics;
using System.IO;
using System.Linq;
using static Aardvark.Base.MultimethodTest;

namespace Aardvark.Geometry.Tests
{
Expand Down Expand Up @@ -118,7 +119,6 @@ public void CanQueryPointsNearDirectedRay3d()
foreach (var x in pointset.QueryPointsNearRay(new Ray3d(new V3d(0.5, -1.0, 0.5), V3d.OIO), 0.2, 1.0, 2.0)) count1 += x.Positions.Count;
foreach (var x in pointset.QueryPointsNearRay(new Ray3d(new V3d(0.5, -1.0, 0.5), V3d.OIO), 0.2, 1.5, 2.0)) count2 += x.Positions.Count;
foreach (var x in pointset.QueryPointsNearRay(new Ray3d(new V3d(0.5, 0.75, 0.5), V3d.OIO), 0.2, 0.0, 1.0)) count3 += x.Positions.Count;

Assert.IsTrue(count1 > count2);
Assert.IsTrue(count2 > count3);
}
Expand Down Expand Up @@ -1178,5 +1178,27 @@ public void EnumerateCells_Kernel_2()
#endregion


[Test]
public void CanQueryPointsWithAttributes()
{
var r = new Random(0);
var ps = new V3d[50000];
for (var i = 0; i < 50000; i++) ps[i] = new V3d(r.NextDouble(), r.NextDouble(), r.NextDouble());
var config = ImportConfig.Default
.WithStorage(PointCloud.CreateInMemoryStore(cache: default))
.WithKey("test")
.WithOctreeSplitLimit(50000)
;
var chunk = new Chunk(ps);
var pis = new int[50000];
for (var i = 0; i < 50000; i++) pis[i] = r.Next(4);
var pir = new Range1i(pis);
chunk = chunk.WithPartIndices(pis, pir);
var pointset = PointCloud.Chunks(chunk, config);

var q = pointset.QueryPointsNearPoint(V3d.Zero, 1.0, 5);
Assert.IsTrue(q.PartIndices != null);
Assert.IsTrue(q.PartIndices.All(x => x >= 0 && x <= 3));
}
}
}

0 comments on commit aa5115e

Please sign in to comment.