#include <iostream>
#include "ConfigExamples.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/base/Common.h"
#include "DGtal/shapes/Mesh.h"
#include "DGtal/shapes/MeshVoxelizer.h"
#include "DGtal/io/boards/Board3D.h"
#include "DGtal/io/writers/MeshWriter.h"
using namespace std;
{
using namespace Z3i;
Mesh<Point> aMesh;
aMesh.addVertex(
Point(0,0,0));
aMesh.addVertex(
Point(1,0,0));
aMesh.addVertex(
Point(1,1,0));
aMesh.addVertex(
Point(0,1,0));
aMesh.addVertex(
Point(0,1,1));
aMesh.addVertex(
Point(1,1,1));
aMesh.addVertex(
Point(1,0,1));
aMesh.addVertex(
Point(0,0,1));
aMesh.addQuadFace(0,1,2,3);
aMesh.addQuadFace(1,2,5,6);
aMesh.addQuadFace(7,6,5,4);
aMesh.addQuadFace(3,2,5,4);
aMesh.addQuadFace(0,3,4,7);
aMesh.addQuadFace(0,1,6,7);
MeshVoxelizer<DigitalSet, 6> voxelizer;
voxelizer.voxelize(outputSet, aMesh, 15.0);
trace.
info()<<
"Got "<< outputSet.size() <<
" voxels."<<std::endl;
Board3D<> board;
for(auto voxel : outputSet)
board << voxel;
board.saveOBJ("voxelizedCube.obj");
return 0;
}
void beginBlock(const std::string &keyword="")
DGtal is the top-level namespace which contains all DGtal functions and types.
int main(int argc, char **argv)
HyperRectDomain< Space > Domain
Z2i::DigitalSet DigitalSet