From 4ba99c1bb08709fc7e0106d626af0f9e3c95fee9 Mon Sep 17 00:00:00 2001 From: Malcolm Tyrrell Date: Wed, 20 Oct 2021 16:15:00 +0100 Subject: [PATCH] Comments --- test/unit/Common/utSpatialSort.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/unit/Common/utSpatialSort.cpp b/test/unit/Common/utSpatialSort.cpp index ba411d99f..8ebae76e8 100644 --- a/test/unit/Common/utSpatialSort.cpp +++ b/test/unit/Common/utSpatialSort.cpp @@ -84,8 +84,10 @@ TEST_F(utSpatialSort, findPositionsTest) { } TEST_F(utSpatialSort, highlyDisplacedPositionsTest) { + // Make a cube of positions, and then query it using the SpatialSort object. constexpr unsigned int verticesPerAxis = 10; constexpr ai_real step = 0.001f; + // Note the large constant offset here. constexpr ai_real offset = 5000.0f - (0.5f * verticesPerAxis * step); constexpr unsigned int totalNumPositions = verticesPerAxis * verticesPerAxis * verticesPerAxis; aiVector3D* positions = new aiVector3D[totalNumPositions]; @@ -101,10 +103,10 @@ TEST_F(utSpatialSort, highlyDisplacedPositionsTest) { SpatialSort sSort; sSort.Fill(positions, totalNumPositions, sizeof(aiVector3D)); - // Enough to pick up the neighboring vertices, but not the neighbors' neighbors. + // Enough to pick up a point and its 6 immediate neighbors, but not any other point. const ai_real epsilon = 1.1f * step; std::vector indices; - // Iterate through the interior points of the cube. + // Iterate through the _interior_ points of the cube. for (unsigned int x = 1; x < verticesPerAxis - 1; ++x) { for (unsigned int y = 1; y < verticesPerAxis - 1; ++y) { for (unsigned int z = 1; z < verticesPerAxis - 1; ++z) {