trimesh_curvature.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 ****************************************************************************/
00031 #include<vcg/complex/complex.h>
00032 
00033 #include<wrap/io_trimesh/export_off.h>
00034 #include <vcg/complex/algorithms/create/platonic.h>
00035 
00036 #include<vcg/complex/algorithms/update/curvature.h>
00037 #include<vcg/complex/algorithms/update/normal.h>
00038 
00039 class MyEdge;
00040 class MyFace;
00041 class MyVertex;
00042 struct MyUsedTypes : public vcg::UsedTypes<     vcg::Use<MyVertex>   ::AsVertexType,
00043                                             vcg::Use<MyEdge>     ::AsEdgeType,
00044                                             vcg::Use<MyFace>     ::AsFaceType>{};
00045 
00046 class MyVertex  : public vcg::Vertex<MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::BitFlags  >{};
00047 class MyFace    : public vcg::Face< MyUsedTypes, vcg::face::FFAdj,  vcg::face::VertexRef, vcg::face::BitFlags > {};
00048 class MyEdge    : public vcg::Edge<MyUsedTypes>{};
00049 class MyMesh    : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> , std::vector<MyEdge>  > {};
00050 
00051 int main( int /*argc*/, char **/*argv*/ )
00052 {
00053   MyMesh m;
00054   vcg::tri::Torus(m,30,10);
00055   vcg::tri::io::ExporterOFF<MyMesh>::Save(m,"torus.off");
00056 
00057   vcg::tri::UpdateTopology<MyMesh>::FaceFace(m);
00058 //  vcg::tri::UpdateCurvature<MyMesh>::VertexCurvature(m);
00059   vcg::tri::UpdateCurvature<MyMesh>::MeanAndGaussian(m);
00060   vcg::tri::UpdateCurvature<MyMesh>::PrincipalDirections(m);
00061   //vcg::tri::UpdateCurvature<MyMesh>::PrincipalDirectionsNormalCycles(m);
00062   vcg::tri::UpdateCurvature<MyMesh>::PrincipalDirectionsPCA(m,m.bbox.Diag()/100);
00063 
00064   vcg::tri::UpdateNormal<MyMesh>::PerVertexNormalized(m);
00065   printf("Input mesh  vn:%i fn:%i\n",m.VN(),m.FN());
00066   printf( "Mesh has %i vert and %i faces\n", m.VN(), m.FN() );
00067 
00068   return 0;
00069 }


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