2012-10-09 12:25:00 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* VCGLib o o *
|
|
|
|
* Visual and Computer Graphics Library o o *
|
|
|
|
* _ O _ *
|
2016-06-13 07:29:25 +02:00
|
|
|
* Copyright(C) 2004-2016 \/)\/ *
|
2012-10-09 12:25:00 +02:00
|
|
|
* Visual Computing Lab /\/| *
|
|
|
|
* ISTI - Italian National Research Council | *
|
|
|
|
* \ *
|
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
|
|
|
* for more details. *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
2012-10-16 11:08:19 +02:00
|
|
|
/*! \file trimesh_curvature.cpp
|
|
|
|
\ingroup code_sample
|
|
|
|
|
|
|
|
\brief an example showing the various techniques for computing curvatures
|
|
|
|
|
|
|
|
This file contain a minimal example of the library
|
|
|
|
|
|
|
|
*/
|
2017-03-14 07:49:15 +01:00
|
|
|
#include <vcg/complex/complex.h>
|
2012-10-09 12:25:00 +02:00
|
|
|
|
2012-10-15 09:52:40 +02:00
|
|
|
#include <vcg/complex/algorithms/create/platonic.h>
|
2017-03-14 07:49:15 +01:00
|
|
|
#include <vcg/complex/algorithms/update/curvature.h>
|
2012-10-09 12:25:00 +02:00
|
|
|
|
2017-03-14 07:49:15 +01:00
|
|
|
#include<wrap/io_trimesh/export_off.h>
|
2012-10-09 12:25:00 +02:00
|
|
|
|
|
|
|
class MyEdge;
|
|
|
|
class MyFace;
|
|
|
|
class MyVertex;
|
2012-10-16 11:08:19 +02:00
|
|
|
struct MyUsedTypes : public vcg::UsedTypes< vcg::Use<MyVertex> ::AsVertexType,
|
|
|
|
vcg::Use<MyEdge> ::AsEdgeType,
|
|
|
|
vcg::Use<MyFace> ::AsFaceType>{};
|
2012-10-09 12:25:00 +02:00
|
|
|
|
2012-10-16 11:08:19 +02:00
|
|
|
class MyVertex : public vcg::Vertex<MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::BitFlags >{};
|
|
|
|
class MyFace : public vcg::Face< MyUsedTypes, vcg::face::FFAdj, vcg::face::VertexRef, vcg::face::BitFlags > {};
|
|
|
|
class MyEdge : public vcg::Edge<MyUsedTypes>{};
|
2012-10-15 16:09:24 +02:00
|
|
|
class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> , std::vector<MyEdge> > {};
|
2012-10-09 12:25:00 +02:00
|
|
|
|
2012-11-10 17:57:26 +01:00
|
|
|
int main( int /*argc*/, char **/*argv*/ )
|
2012-10-09 12:25:00 +02:00
|
|
|
{
|
|
|
|
MyMesh m;
|
2012-10-15 16:09:24 +02:00
|
|
|
vcg::tri::Torus(m,30,10);
|
|
|
|
vcg::tri::io::ExporterOFF<MyMesh>::Save(m,"torus.off");
|
2012-10-09 12:25:00 +02:00
|
|
|
|
2012-10-15 16:09:24 +02:00
|
|
|
vcg::tri::UpdateTopology<MyMesh>::FaceFace(m);
|
2013-01-30 18:18:55 +01:00
|
|
|
// vcg::tri::UpdateCurvature<MyMesh>::VertexCurvature(m);
|
2012-10-15 16:09:24 +02:00
|
|
|
vcg::tri::UpdateCurvature<MyMesh>::MeanAndGaussian(m);
|
|
|
|
vcg::tri::UpdateCurvature<MyMesh>::PrincipalDirections(m);
|
2013-01-30 18:18:55 +01:00
|
|
|
//vcg::tri::UpdateCurvature<MyMesh>::PrincipalDirectionsNormalCycles(m);
|
2012-10-15 16:09:24 +02:00
|
|
|
vcg::tri::UpdateCurvature<MyMesh>::PrincipalDirectionsPCA(m,m.bbox.Diag()/100);
|
2012-10-11 12:40:07 +02:00
|
|
|
|
2012-10-15 16:09:24 +02:00
|
|
|
vcg::tri::UpdateNormal<MyMesh>::PerVertexNormalized(m);
|
2012-10-09 12:25:00 +02:00
|
|
|
printf("Input mesh vn:%i fn:%i\n",m.VN(),m.FN());
|
|
|
|
printf( "Mesh has %i vert and %i faces\n", m.VN(), m.FN() );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|