Merge branch 'master' into Artenuvielle-x3d_pugi_migration_artenuvielle
This commit is contained in:
@@ -82,3 +82,39 @@ TEST_F(utSpatialSort, findPositionsTest) {
|
||||
sSort.FindPositions(vecs[0], 0.01f, indices);
|
||||
EXPECT_EQ(1u, indices.size());
|
||||
}
|
||||
|
||||
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];
|
||||
for (unsigned int x = 0; x < verticesPerAxis; ++x) {
|
||||
for (unsigned int y = 0; y < verticesPerAxis; ++y) {
|
||||
for (unsigned int z = 0; z < verticesPerAxis; ++z) {
|
||||
const unsigned int index = (x * verticesPerAxis * verticesPerAxis) + (y * verticesPerAxis) + z;
|
||||
positions[index] = aiVector3D(offset + (x * step), offset + (y * step), offset + (z * step));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SpatialSort sSort;
|
||||
sSort.Fill(positions, totalNumPositions, sizeof(aiVector3D));
|
||||
|
||||
// Enough to find a point and its 6 immediate neighbors, but not any other point.
|
||||
const ai_real epsilon = 1.1f * step;
|
||||
std::vector<unsigned int> indices;
|
||||
// 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) {
|
||||
const unsigned int index = (x * verticesPerAxis * verticesPerAxis) + (y * verticesPerAxis) + z;
|
||||
sSort.FindPositions(positions[index], epsilon, indices);
|
||||
ASSERT_EQ(7u, indices.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
delete[] positions;
|
||||
}
|
||||
|
||||
@@ -44,16 +44,16 @@ class utVersion : public ::testing::Test {
|
||||
};
|
||||
|
||||
TEST_F( utVersion, aiGetLegalStringTest ) {
|
||||
const char *lv( aiGetLegalString() );
|
||||
const char *lv = aiGetLegalString();
|
||||
EXPECT_NE( lv, nullptr );
|
||||
std::string text( lv );
|
||||
|
||||
size_t pos( text.find( std::string( "2021" ) ) );
|
||||
size_t pos = text.find(std::string("2021"));
|
||||
EXPECT_NE( pos, std::string::npos );
|
||||
}
|
||||
|
||||
TEST_F( utVersion, aiGetVersionMinorTest ) {
|
||||
EXPECT_EQ( aiGetVersionMinor(), 0U );
|
||||
EXPECT_EQ( aiGetVersionMinor(), 1U );
|
||||
}
|
||||
|
||||
TEST_F( utVersion, aiGetVersionMajorTest ) {
|
||||
|
||||
Reference in New Issue
Block a user