00001 #include <stdio.h>
00002 #include <wrap/io_trimesh/export_ply.h>
00003 #include "Definitions.h"
00004 #include "Volume.h"
00005 #include "Walker.h"
00006 #include <vcg/complex/trimesh/create/marching_cubes.h>
00007 #include <vcg/complex/trimesh/create/extended_marching_cubes.h>
00008
00009 int main(int argc, char *argv[])
00010 {
00011 BoundingBox bbox(vcg::Point3i(-20, -20, -20), vcg::Point3i(20, 20, 20));
00012 vcg::Point3i resolution(40, 40, 40);
00013
00014 Volume volume;
00015 Walker walker(bbox, resolution);
00016
00017 typedef vcg::tri::MarchingCubes<Mesh, Walker> MarchingCubes;
00018 typedef vcg::tri::ExtendedMarchingCubes<Mesh, Walker> ExtendedMarchingCubes;
00019
00020
00021
00022
00023 Mesh mc_mesh;
00024 printf("[MARCHING CUBES] Building mesh...");
00025 MarchingCubes mc(mc_mesh, walker);
00026 walker.BuildMesh<MarchingCubes>(mc_mesh, volume, mc);
00027 vcg::tri::io::ExporterPLY<Mesh>::Save( mc_mesh, "marching_cubes.ply");
00028 printf("OK!\n");
00029
00030
00031 Mesh emc_mesh;
00032 printf("[EXTENDED MARCHING CUBES] Building mesh...");
00033 ExtendedMarchingCubes emc(emc_mesh, walker, 30);
00034 walker.BuildMesh<ExtendedMarchingCubes>(emc_mesh, volume, emc);
00035 vcg::tri::io::ExporterPLY<Mesh>::Save( emc_mesh, "extended_marching_cubes.ply");
00036 printf("OK!\n");
00037 };