trimesh_voronoiatlas.cpp
Go to the documentation of this file.
00001 /****************************************************************************
00002 * VCGLib                                                            o o     *
00003 * Visual and Computer Graphics Library                            o     o   *
00004 *                                                                _   O  _   *
00005 * Copyright(C) 2004-2009                                           \/)\/    *
00006 * Visual Computing Lab                                            /\/|      *
00007 * ISTI - Italian National Research Council                           |      *
00008 *                                                                    \      *
00009 * All rights reserved.                                                      *
00010 *                                                                           *
00011 * This program is free software; you can redistribute it and/or modify      *
00012 * it under the terms of the GNU General Public License as published by      *
00013 * the Free Software Foundation; either version 2 of the License, or         *
00014 * (at your option) any later version.                                       *
00015 *                                                                           *
00016 * This program is distributed in the hope that it will be useful,           *
00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
00019 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)          *
00020 * for more details.                                                         *
00021 *                                                                           *
00022 ****************************************************************************/
00023 #include<vcg/complex/complex.h>
00024 #include<vcg/complex/algorithms/create/platonic.h>
00025 
00026 #include<wrap/io_trimesh/import_ply.h>
00027 #include<wrap/io_trimesh/export_ply.h>
00028 #include<vcg/complex/algorithms/parametrization/voronoi_atlas.h>
00029 #include<vcg/space/outline2_packer.h>
00030 
00031 using namespace vcg;
00032 using namespace std;
00033 
00034 class MyEdge;
00035 class MyFace;
00036 class MyVertex;
00037 struct MyUsedTypes : public UsedTypes<  Use<MyVertex>   ::AsVertexType,
00038                                         Use<MyEdge>     ::AsEdgeType,
00039                                         Use<MyFace>     ::AsFaceType>{};
00040 
00041 class MyVertex  : public Vertex<MyUsedTypes, vertex::InfoOcf, vertex::Coord3f, vertex::Normal3f, vertex::TexCoord2f, vertex::VFAdj , vertex::Qualityf, vertex::Color4b, vertex::BitFlags  >{};
00042 class MyFace    : public Face< MyUsedTypes, face::InfoOcf, face::VertexRef, face::CurvatureDirf, face::BitFlags, face::FFAdjOcf ,face::VFAdj , face::WedgeTexCoord2f> {};
00043 class MyEdge    : public Edge< MyUsedTypes>{};
00044 class MyMesh    : public tri::TriMesh< vertex::vector_ocf<MyVertex>, face::vector_ocf<MyFace> , vector<MyEdge>  > {};
00045 
00046 
00047 
00048 int main( int argc, char **argv )
00049 {
00050   MyMesh startMesh;
00051   if(argc < 3 )
00052   {
00053     printf("Usage trimesh_voro mesh region_num\n");
00054      return -1;
00055   }
00056   int sampleNum =atoi(argv[2]);
00057   printf("Reading %s and sampling %i \n",argv[1],sampleNum);
00058   int ret= tri::io::ImporterPLY<MyMesh>::Open(startMesh,argv[1]);
00059   if(ret!=0)
00060   {
00061     printf("Unable to open %s for '%s'\n",argv[1],tri::io::ImporterPLY<MyMesh>::ErrorMsg(ret));
00062     return -1;
00063   }
00064 
00065   MyMesh paraMesh;
00066   tri::VoronoiAtlas<MyMesh>::VoronoiAtlasParam pp;
00067   pp.sampleNum =sampleNum;
00068   pp.overlap=false;
00069 
00070   tri::VoronoiAtlas<MyMesh>::Build(startMesh,paraMesh,pp);
00071 
00072   tri::io::ExporterPLY<MyMesh>::Save(paraMesh,"Full.ply",tri::io::Mask::IOM_VERTCOLOR|tri::io::Mask::IOM_WEDGTEXCOORD );
00073   return 0;
00074 }


shape_reconstruction
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:38:26