TEST(TriangleMesh3, BoundingBox) { std::string objStr = getCubeTriMesh3x3x3Obj(); std::istringstream objStream(objStr); TriangleMesh3 mesh; mesh.readObj(&objStream); EXPECT_BOUNDING_BOX3_EQ( BoundingBox3D({-0.5, -0.5, -0.5}, {0.5, 0.5, 0.5}), mesh.boundingBox()); }
TEST(TriangleMesh3, IsInside) { std::string objStr = getCubeTriMesh3x3x3Obj(); std::istringstream objStream(objStr); TriangleMesh3 mesh; mesh.readObj(&objStream); size_t numSamples = getNumberOfSamplePoints3(); for (size_t i = 0; i < numSamples; ++i) { Vector3D p = getSamplePoints3()[i]; auto actual = mesh.isInside(p); auto expected = mesh.boundingBox().contains(p); EXPECT_EQ(expected, actual); } }