Created
April 18, 2021 13:41
-
-
Save VergilUa/fbaba1b4b560bc220fa40815300b6905 to your computer and use it in GitHub Desktop.
Single Element test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void TestQueryOne() { | |
// Tree bounds: | |
AABB treeBounds = new AABB | |
{ | |
Center = new float3(-53.25f, -44.4f, -19.9f), | |
Extents = new float3(14.01591f, 14.01591f, 14.01591f) | |
}; | |
NativeArray<OctElement<int>> elements = new NativeArray<OctElement<int>>(1, Allocator.TempJob); | |
elements[0] = new OctElement<int> | |
{ | |
pos = new float3(-53.25f, -44.4f, -19.9f), | |
}; | |
var octree = new NativeOctree<int>(treeBounds, Allocator.TempJob); | |
octree.ClearAndBulkInsert(elements); | |
var queryJob = new OctreeJobs.RangeQueryJob<int> | |
{ | |
Octree = octree, | |
Bounds = new AABB {Center = new float3(-60.28234f, -43.33581f, -24.49575f), Extents = new float3(7f, 7f, 7f)}, | |
Results = new NativeList<OctElement<int>>(1000, Allocator.TempJob) | |
}; | |
queryJob.Run(); | |
NativeList<OctElement<int>> results = queryJob.Results; | |
int result = results.Length; | |
octree.Dispose(); | |
elements.Dispose(); | |
queryJob.Results.Dispose(); | |
Assert.Greater(result, 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment