Enhance test for marching cubes

This commit is contained in:
Théophile Bastian 2018-02-12 00:56:35 +01:00
parent c527ecc611
commit d1d2811978

View file

@ -12,12 +12,14 @@ int main(int argc, char** argv) {
GlutRender& render = GlutRender::get_instance(); GlutRender& render = GlutRender::get_instance();
render.init(&argc, argv, 640, 480, "Bouncing stuff"); render.init(&argc, argv, 640, 480, "Bouncing stuff");
TestImplicitSphere sph1(Point(2.5, -1, 0), 1); TestImplicitSphere sph1(Point(0, 0, 0), 1);
TestImplicitSphere sph2(Point(-4, 0.5, 0), 1.4); TestImplicitSphere sph2(Point(0, 0, 0), 1.6);
Mesh m_sph1 = MarchingCubes(sph1, Mesh m_sph1 = MarchingCubes(sph1,
Cuboid(Point(1, -2, -2), Point(3, 0, 2)))(); Cuboid(Point(-2.2, -2.2, -2.2), Point(2.2, 2.2, 2.2)))();
Mesh m_sph2 = MarchingCubes(sph2, Mesh m_sph2 = MarchingCubes(sph2,
Cuboid(Point(-6, -2, -2), Point(2, 3, 2)))(); Cuboid(Point(-2.2, -2.2, -2.2), Point(2.2, 2.2, 2.2)))();
m_sph1.translate(Point(-2, 0, 0));
m_sph2.translate(Point(2, 0, 1));
render.add_mesh(&m_sph1); render.add_mesh(&m_sph1);
render.add_mesh(&m_sph2); render.add_mesh(&m_sph2);
@ -26,6 +28,9 @@ int main(int argc, char** argv) {
printf("Sph1 has %ld vertices, %ld faces.\n", printf("Sph1 has %ld vertices, %ld faces.\n",
m_sph1.get_vertices().size(), m_sph1.get_vertices().size(),
m_sph1.get_faces().size()); m_sph1.get_faces().size());
printf("Sph2 has %ld vertices, %ld faces.\n",
m_sph2.get_vertices().size(),
m_sph2.get_faces().size());
render.run(); render.run();