From aa5115e5a74e65152f95d556fe69130423dc7f88 Mon Sep 17 00:00:00 2001 From: aszabo314 Date: Wed, 29 Nov 2023 11:35:20 +0100 Subject: [PATCH] [Test] PointsNearObject; prerelease0007 --- RELEASE_NOTES.md | 3 +++ src/Aardvark.Algodat.Tests/QueryTests.cs | 24 +++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 9fd63525..8089a951 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -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) diff --git a/src/Aardvark.Algodat.Tests/QueryTests.cs b/src/Aardvark.Algodat.Tests/QueryTests.cs index 812150fb..c583b8b0 100644 --- a/src/Aardvark.Algodat.Tests/QueryTests.cs +++ b/src/Aardvark.Algodat.Tests/QueryTests.cs @@ -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 { @@ -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); } @@ -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)); + } } }