updated the sample to the voronoi processing renaming
This commit is contained in:
parent
2744e1330f
commit
f4fde23bb2
|
@ -20,24 +20,13 @@
|
||||||
* for more details. *
|
* for more details. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include<QtGlobal>
|
|
||||||
|
|
||||||
#include<vcg/simplex/vertex/base.h>
|
|
||||||
#include<vcg/simplex/vertex/component.h>
|
|
||||||
#include<vcg/simplex/vertex/component_ocf.h>
|
|
||||||
|
|
||||||
#include<vcg/simplex/face/base.h>
|
|
||||||
#include<vcg/simplex/face/component.h>
|
|
||||||
#include<vcg/simplex/face/component_ocf.h>
|
|
||||||
|
|
||||||
#include<vcg/complex/complex.h>
|
#include<vcg/complex/complex.h>
|
||||||
#include<vcg/complex/algorithms/create/platonic.h>
|
#include<vcg/complex/algorithms/create/platonic.h>
|
||||||
#include<vcg/complex/append.h>
|
|
||||||
|
|
||||||
#include<wrap/io_trimesh/import_ply.h>
|
#include<wrap/io_trimesh/import_ply.h>
|
||||||
#include<wrap/io_trimesh/export_ply.h>
|
#include<wrap/io_trimesh/export_ply.h>
|
||||||
#include<vcg/complex/algorithms/parametrization/voronoi_atlas.h>
|
#include<vcg/complex/algorithms/parametrization/voronoi_atlas.h>
|
||||||
#include<vcg/space/poly_packer.h>
|
#include<vcg/space/outline2_packer.h>
|
||||||
|
|
||||||
using namespace vcg;
|
using namespace vcg;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -1,16 +1,3 @@
|
||||||
#DEFINES += VCG_USE_EIGEN
|
include(../common.pri)
|
||||||
|
TARGET = trimesh_voronoiatlas
|
||||||
TARGET = trimesh_voroatlas
|
SOURCES += trimesh_voronoiatlas.cpp ../../../wrap/ply/plylib.cpp
|
||||||
DEPENDPATH += . ../../..
|
|
||||||
|
|
||||||
INCLUDEPATH += . ../../..
|
|
||||||
|
|
||||||
CONFIG += console stl
|
|
||||||
TEMPLATE = app
|
|
||||||
SOURCES += trimesh_voroatlas.cpp ../../../wrap/ply/plylib.cpp
|
|
||||||
HEADERS += ../../../vcg/complex/algorithms/parametrization/voronoi_atlas.h
|
|
||||||
|
|
||||||
# Mac specific Config required to avoid to make application bundles
|
|
||||||
CONFIG -= app_bundle
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include<wrap/io_trimesh/import_ply.h>
|
#include<wrap/io_trimesh/import_ply.h>
|
||||||
#include<wrap/io_trimesh/export_ply.h>
|
#include<wrap/io_trimesh/export_ply.h>
|
||||||
#include<vcg/complex/algorithms/point_sampling.h>
|
#include<vcg/complex/algorithms/point_sampling.h>
|
||||||
#include<vcg/complex/algorithms/voronoi_clustering.h>
|
#include<vcg/complex/algorithms/voronoi_processing.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace vcg;
|
using namespace vcg;
|
||||||
|
@ -67,12 +67,14 @@ int main( int argc, char **argv )
|
||||||
int randSeed=time(0);
|
int randSeed=time(0);
|
||||||
tri::UpdateTopology<MyMesh>::VertexFace(baseMesh);
|
tri::UpdateTopology<MyMesh>::VertexFace(baseMesh);
|
||||||
std::vector<MyVertex *> seedVec;
|
std::vector<MyVertex *> seedVec;
|
||||||
vcg::tri::ClusteringSampler<MyMesh> cs(seedVec);
|
tri::ClusteringSampler<MyMesh> cs(seedVec);
|
||||||
vcg::tri::SurfaceSampling<MyMesh, vcg::tri::ClusteringSampler<MyMesh> >::SamplingRandomGenerator().initialize(randSeed);
|
tri::SurfaceSampling<MyMesh, vcg::tri::ClusteringSampler<MyMesh> >::SamplingRandomGenerator().initialize(randSeed);
|
||||||
vcg::tri::SurfaceSampling<MyMesh, vcg::tri::ClusteringSampler<MyMesh> >::VertexUniform(baseMesh,cs,seed);
|
tri::SurfaceSampling<MyMesh, vcg::tri::ClusteringSampler<MyMesh> >::VertexUniform(baseMesh,cs,seed);
|
||||||
vcg::tri::VoronoiProcessing<MyMesh>::VoronoiRelaxing(baseMesh, seedVec, iterNum,0);
|
tri::VoronoiProcessingParameter vpp;
|
||||||
vcg::tri::VoronoiProcessing<MyMesh>::TopologicalVertexColoring(baseMesh, seedVec);
|
tri::EuclideanDistance<MyMesh> df;
|
||||||
tri::VoronoiProcessing<MyMesh>::VoronoiClustering(baseMesh,clusteredMesh,seedVec);
|
tri::VoronoiProcessing<MyMesh>::VoronoiRelaxing(baseMesh, seedVec, iterNum, df, vpp);
|
||||||
|
tri::VoronoiProcessing<MyMesh>::TopologicalVertexColoring(baseMesh, seedVec);
|
||||||
|
tri::VoronoiProcessing<MyMesh>::ConvertDelaunayTriangulationToMesh(baseMesh,clusteredMesh,seedVec);
|
||||||
|
|
||||||
tri::io::ExporterPLY<MyMesh>::Save(baseMesh,"base.ply",tri::io::Mask::IOM_VERTCOLOR );
|
tri::io::ExporterPLY<MyMesh>::Save(baseMesh,"base.ply",tri::io::Mask::IOM_VERTCOLOR );
|
||||||
tri::io::ExporterPLY<MyMesh>::Save(clusteredMesh,"clustered.ply");
|
tri::io::ExporterPLY<MyMesh>::Save(clusteredMesh,"clustered.ply");
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include<wrap/io_trimesh/export_ply.h>
|
#include<wrap/io_trimesh/export_ply.h>
|
||||||
#include<wrap/io_trimesh/export_dxf.h>
|
#include<wrap/io_trimesh/export_dxf.h>
|
||||||
#include<vcg/complex/algorithms/point_sampling.h>
|
#include<vcg/complex/algorithms/point_sampling.h>
|
||||||
#include<vcg/complex/algorithms/voronoi_clustering.h>
|
#include<vcg/complex/algorithms/voronoi_processing.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace vcg;
|
using namespace vcg;
|
||||||
|
@ -43,7 +43,6 @@ struct MyUsedTypes : public UsedTypes< Use<MyVertex> ::AsVertexType,
|
||||||
|
|
||||||
class MyVertex : public Vertex<MyUsedTypes, vertex::Coord3f, vertex::Normal3f, vertex::VFAdj, vertex::Qualityf, vertex::Color4b, vertex::BitFlags >{};
|
class MyVertex : public Vertex<MyUsedTypes, vertex::Coord3f, vertex::Normal3f, vertex::VFAdj, vertex::Qualityf, vertex::Color4b, vertex::BitFlags >{};
|
||||||
class MyFace : public Face< MyUsedTypes, face::VertexRef, face::Normal3f, face::BitFlags, face::VFAdj, face::FFAdj > {};
|
class MyFace : public Face< MyUsedTypes, face::VertexRef, face::Normal3f, face::BitFlags, face::VFAdj, face::FFAdj > {};
|
||||||
//class MyEdge : public Edge< MyUsedTypes> {};
|
|
||||||
class MyEdge : public Edge< MyUsedTypes, edge::VertexRef, edge::BitFlags>{};
|
class MyEdge : public Edge< MyUsedTypes, edge::VertexRef, edge::BitFlags>{};
|
||||||
class MyMesh : public tri::TriMesh< vector<MyVertex>, vector<MyEdge>, vector<MyFace> > {};
|
class MyMesh : public tri::TriMesh< vector<MyVertex>, vector<MyEdge>, vector<MyFace> > {};
|
||||||
|
|
||||||
|
@ -57,7 +56,6 @@ struct EmUsedTypes : public UsedTypes< Use<EmVertex> ::AsVertexType,
|
||||||
class EmVertex : public Vertex<EmUsedTypes, vertex::Coord3f, vertex::Normal3f, vertex::VFAdj , vertex::Qualityf, vertex::Color4b, vertex::BitFlags >{};
|
class EmVertex : public Vertex<EmUsedTypes, vertex::Coord3f, vertex::Normal3f, vertex::VFAdj , vertex::Qualityf, vertex::Color4b, vertex::BitFlags >{};
|
||||||
class EmFace : public Face< EmUsedTypes, face::VertexRef, face::BitFlags, face::VFAdj > {};
|
class EmFace : public Face< EmUsedTypes, face::VertexRef, face::BitFlags, face::VFAdj > {};
|
||||||
class EmEdge : public Edge< EmUsedTypes, edge::VertexRef> {};
|
class EmEdge : public Edge< EmUsedTypes, edge::VertexRef> {};
|
||||||
//class EmEdge : public Edge< EmUsedTypes, edge::VertexRef, edge::BitFlags>{};
|
|
||||||
class EmMesh : public tri::TriMesh< vector<EmVertex>, vector<EmEdge>, vector<EmFace> > {};
|
class EmMesh : public tri::TriMesh< vector<EmVertex>, vector<EmEdge>, vector<EmFace> > {};
|
||||||
|
|
||||||
|
|
||||||
|
@ -157,7 +155,6 @@ int main( int argc, char **argv )
|
||||||
|
|
||||||
vpp.deleteUnreachedRegionFlag=true;
|
vpp.deleteUnreachedRegionFlag=true;
|
||||||
vpp.triangulateRegion = true;
|
vpp.triangulateRegion = true;
|
||||||
vpp.triangulateRegion = false;
|
|
||||||
vpp.geodesicRelaxFlag=false;
|
vpp.geodesicRelaxFlag=false;
|
||||||
vpp.constrainSelectedSeed=true;
|
vpp.constrainSelectedSeed=true;
|
||||||
|
|
||||||
|
@ -169,12 +166,12 @@ int main( int argc, char **argv )
|
||||||
|
|
||||||
MyMesh voroMesh, voroPoly, delaMesh;
|
MyMesh voroMesh, voroPoly, delaMesh;
|
||||||
// Get the result in some pleasant form converting it to a real voronoi diagram.
|
// Get the result in some pleasant form converting it to a real voronoi diagram.
|
||||||
tri::VoronoiProcessing<MyMesh, tri::EuclideanDistance<MyMesh> >::ConvertVoronoiDiagramToMesh(baseMesh,voroMesh,voroPoly, seedVec, dd, vpp);
|
tri::VoronoiProcessing<MyMesh, tri::EuclideanDistance<MyMesh> >::ConvertVoronoiDiagramToMesh(baseMesh,voroMesh,voroPoly, seedVec, vpp);
|
||||||
tri::io::ExporterPLY<MyMesh>::Save(baseMesh,"base.ply",tri::io::Mask::IOM_VERTCOLOR + tri::io::Mask::IOM_VERTQUALITY );
|
tri::io::ExporterPLY<MyMesh>::Save(baseMesh,"base.ply",tri::io::Mask::IOM_VERTCOLOR + tri::io::Mask::IOM_VERTQUALITY );
|
||||||
tri::io::ExporterPLY<MyMesh>::Save(voroMesh,"voroMesh.ply",tri::io::Mask::IOM_VERTCOLOR + tri::io::Mask::IOM_FLAGS );
|
tri::io::ExporterPLY<MyMesh>::Save(voroMesh,"voroMesh.ply",tri::io::Mask::IOM_VERTCOLOR + tri::io::Mask::IOM_FLAGS );
|
||||||
tri::io::ExporterPLY<MyMesh>::Save(voroPoly,"voroPoly.ply",tri::io::Mask::IOM_VERTCOLOR| tri::io::Mask::IOM_EDGEINDEX ,false);
|
tri::io::ExporterPLY<MyMesh>::Save(voroPoly,"voroPoly.ply",tri::io::Mask::IOM_VERTCOLOR| tri::io::Mask::IOM_EDGEINDEX ,false);
|
||||||
|
|
||||||
tri::VoronoiProcessing<MyMesh, tri::EuclideanDistance<MyMesh> >::ConvertDelaunayTriangulationToMesh(baseMesh,delaMesh, seedVec, dd, vpp);
|
tri::VoronoiProcessing<MyMesh>::ConvertDelaunayTriangulationToMesh(baseMesh,delaMesh, seedVec);
|
||||||
tri::io::ExporterPLY<MyMesh>::Save(delaMesh,"delaMesh.ply",tri::io::Mask::IOM_VERTCOLOR + tri::io::Mask::IOM_VERTQUALITY );
|
tri::io::ExporterPLY<MyMesh>::Save(delaMesh,"delaMesh.ply",tri::io::Mask::IOM_VERTCOLOR + tri::io::Mask::IOM_VERTQUALITY );
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue