2005-01-19 16:37:11 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <wrap/io_trimesh/export_ply.h>
|
|
|
|
#include "Definitions.h"
|
|
|
|
#include "Volume.h"
|
|
|
|
#include "Walker.h"
|
|
|
|
#include <vcg/complex/trimesh/create/marching_cubes.h>
|
|
|
|
#include <vcg/complex/trimesh/create/extended_marching_cubes.h>
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
BoundingBox bbox(vcg::Point3i(-20, -20, -20), vcg::Point3i(20, 20, 20));
|
|
|
|
vcg::Point3i resolution(40, 40, 40);
|
|
|
|
|
|
|
|
Volume volume;
|
|
|
|
Walker walker(bbox, resolution);
|
|
|
|
|
|
|
|
typedef vcg::tri::MarchingCubes<Mesh, Walker> MarchingCubes;
|
|
|
|
typedef vcg::tri::ExtendedMarchingCubes<Mesh, Walker> ExtendedMarchingCubes;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// MARCHING CUBES
|
|
|
|
Mesh mc_mesh;
|
2005-01-25 18:05:06 +01:00
|
|
|
printf("[MARCHING CUBES] Building mesh...");
|
2005-01-19 16:37:11 +01:00
|
|
|
MarchingCubes mc(mc_mesh, walker);
|
|
|
|
walker.BuildMesh<MarchingCubes>(mc_mesh, volume, mc);
|
|
|
|
vcg::tri::io::ExporterPLY<Mesh>::Save( mc_mesh, "marching_cubes.ply");
|
2005-01-25 18:05:06 +01:00
|
|
|
printf("OK!\n");
|
2005-01-19 16:37:11 +01:00
|
|
|
|
|
|
|
// EXTENDED MARCHING CUBES
|
|
|
|
Mesh emc_mesh;
|
2005-01-25 18:05:06 +01:00
|
|
|
printf("[EXTENDED MARCHING CUBES] Building mesh...");
|
2005-01-19 16:37:11 +01:00
|
|
|
ExtendedMarchingCubes emc(emc_mesh, walker, 30);
|
|
|
|
walker.BuildMesh<ExtendedMarchingCubes>(emc_mesh, volume, emc);
|
|
|
|
vcg::tri::io::ExporterPLY<Mesh>::Save( emc_mesh, "extended_marching_cubes.ply");
|
2005-01-25 18:05:06 +01:00
|
|
|
printf("OK!\n");
|
2005-01-19 16:37:11 +01:00
|
|
|
};
|