trimesh_base.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-2012                                           \/)\/    *
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 ****************************************************************************/
00032 #include<vcg/complex/complex.h>
00033 #include<wrap/io_trimesh/import_off.h>
00034 #include<vcg/complex/algorithms/update/topology.h>
00035 #include<vcg/complex/algorithms/update/normal.h>
00036 
00037 class MyVertex; class MyEdge; class MyFace;
00038 struct MyUsedTypes : public vcg::UsedTypes<vcg::Use<MyVertex>   ::AsVertexType,
00039                                            vcg::Use<MyEdge>     ::AsEdgeType,
00040                                            vcg::Use<MyFace>     ::AsFaceType>{};
00041 
00042 class MyVertex  : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::BitFlags  >{};
00043 class MyFace    : public vcg::Face<   MyUsedTypes, vcg::face::FFAdj,  vcg::face::VertexRef, vcg::face::BitFlags > {};
00044 class MyEdge    : public vcg::Edge<   MyUsedTypes> {};
00045 
00046 class MyMesh    : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> , std::vector<MyEdge>  > {};
00047 
00048 class MyVertex0  : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::BitFlags  >{};
00049 class MyVertex1  : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::BitFlags  >{};
00050 class MyVertex2  : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Color4b, vcg::vertex::CurvatureDirf,
00051                                                     vcg::vertex::Qualityf, vcg::vertex::Normal3f, vcg::vertex::BitFlags  >{};
00052 
00053 
00054 int main( int argc, char **argv )
00055 {
00056   if(argc<2)
00057   {
00058     printf("Usage trimesh_base <meshfilename.obj>\n");
00059     return -1;
00060   }
00063   MyMesh m;
00064 
00065   if(vcg::tri::io::ImporterOFF<MyMesh>::Open(m,argv[1])!=vcg::tri::io::ImporterOFF<MyMesh>::NoError)
00066   {
00067     printf("Error reading file  %s\n",argv[1]);
00068     exit(0);
00069   }
00070 
00071   vcg::tri::RequirePerVertexNormal(m);
00072   vcg::tri::UpdateNormal<MyMesh>::PerVertexNormalized(m);
00073   printf("Input mesh  vn:%i fn:%i\n",m.VN(),m.FN());
00074   printf( "Mesh has %i vert and %i faces\n", m.VN(), m.FN() );
00075 
00076   return 0;
00077 }


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