Still improving doxygen base docs and samples...

This commit is contained in:
Paolo Cignoni 2012-10-19 11:48:33 +00:00
parent b1a1b36260
commit d81d14189c
10 changed files with 127 additions and 84 deletions

View File

@ -5,10 +5,11 @@ SUBDIRS = trimesh_base \
trimesh_ball_pivoting \ trimesh_ball_pivoting \
trimesh_closest \ trimesh_closest \
trimesh_copy \ trimesh_copy \
trimesh_color \
trimesh_curvature \ trimesh_curvature \
trimesh_clustering \ trimesh_clustering \
trimesh_edge \ trimesh_edge \
trimesh_ext_mc \ # trimesh_ext_mc \
trimesh_hole \ trimesh_hole \
trimesh_inertia \ trimesh_inertia \
trimesh_intersection \ trimesh_intersection \
@ -20,6 +21,7 @@ SUBDIRS = trimesh_base \
trimesh_refine \ trimesh_refine \
trimesh_sampling \ trimesh_sampling \
trimesh_smooth \ trimesh_smooth \
trimesh_split_vertex \
trimesh_topology \ trimesh_topology \
polygonmesh_base \ polygonmesh_base \
aabb_binary_tree aabb_binary_tree

View File

@ -1,15 +1,10 @@
// stuff to define the mesh // stuff to define the mesh
#include <vcg/simplex/vertex/base.h>
#include <vcg/simplex/vertex/component_ocf.h>
#include <vcg/simplex/face/base.h>
#include <vcg/simplex/face/component_rt.h>
#include <vcg/simplex/edge/base.h>
#include <vcg/complex/complex.h> #include <vcg/complex/complex.h>
#include <vcg/complex/append.h> #include <vcg/simplex/face/component_ep.h>
#include <vcg/complex/algorithms/point_sampling.h> #include <vcg/complex/algorithms/point_sampling.h>
#include <vcg/complex/algorithms/update/edges.h> #include <vcg/complex/algorithms/update/component_ep.h>
#include <vcg/complex/algorithms/update/normal.h>
// io // io
#include <wrap/io_trimesh/import.h> #include <wrap/io_trimesh/import.h>
@ -34,13 +29,11 @@ class BaseVertex : public vcg::Vertex< BaseUsedTypes,
class BaseEdge : public vcg::Edge< BaseUsedTypes> {}; class BaseEdge : public vcg::Edge< BaseUsedTypes> {};
class BaseFace : public vcg::Face< BaseUsedTypes, class BaseFace : public vcg::Face< BaseUsedTypes,
vcg::face::Normal3f, vcg::face::VertexRef, vcg::face::BitFlags, vcg::face::Mark, vcg::face::EdgePlaneEmpty > {}; vcg::face::Normal3f, vcg::face::VertexRef, vcg::face::BitFlags, vcg::face::Mark, vcg::face::EmptyEdgePlane > {};
class BaseMesh : public vcg::tri::TriMesh<std::vector<BaseVertex>, std::vector<BaseFace> > {}; class BaseMesh : public vcg::tri::TriMesh<std::vector<BaseVertex>, std::vector<BaseFace> > {};
class RTVertex; class RTVertex;
class RTEdge; class RTEdge;
class RTFace; class RTFace;
@ -85,7 +78,7 @@ bool UnitTest_Closest(const char *filename1, int sampleNum, float dispPerc, std:
int err=vcg::tri::io::Importer<MeshType>::Open(mr,filename1); int err=vcg::tri::io::Importer<MeshType>::Open(mr,filename1);
tri::UpdateBounding<MeshType>::Box(mr); tri::UpdateBounding<MeshType>::Box(mr);
// tri::UpdateNormals<MeshType>::PerFaceNormalized(mr); // tri::UpdateNormals<MeshType>::PerFaceNormalized(mr);
tri::UpdateNormals<MeshType>::PerFace(mr); tri::UpdateNormal<MeshType>::PerFace(mr);
float dispAbs = mr.bbox.Diag()*dispPerc; float dispAbs = mr.bbox.Diag()*dispPerc;
if(err) if(err)
{ {
@ -129,7 +122,7 @@ bool UnitTest_Closest(const char *filename1, int sampleNum, float dispPerc, std:
} }
if(useEdge) if(useEdge)
tri::UpdateEdges<MeshType>::Set(mr); tri::UpdateComponentEP<MeshType>::Set(mr);
int endGridInit = clock(); int endGridInit = clock();
printf("Grid Init %6.3f - ",float(endGridInit-startGridInit)/CLOCKS_PER_SEC); printf("Grid Init %6.3f - ",float(endGridInit-startGridInit)/CLOCKS_PER_SEC);
@ -211,11 +204,11 @@ int main(int argc ,char**argv)
for(size_t i=0;i<resultVecRT11.size();++i) for(size_t i=0;i<resultVecRT11.size();++i)
{ {
if(resultVecRT11[i]!=resultVecRT01[i]) printf("%i is diff",i); if(resultVecRT11[i]!=resultVecRT01[i]) printf("%lu is diff",i);
if(resultVecRT11[i]!=resultVecRT00[i]) printf("%i is diff",i); if(resultVecRT11[i]!=resultVecRT00[i]) printf("%lu is diff",i);
if(resultVecRT11[i]!=resultVecRT10[i]) printf("%i is diff",i); if(resultVecRT11[i]!=resultVecRT10[i]) printf("%lu is diff",i);
if(resultVecRT11[i]!=resultVecBS00[i]) printf("%i is diff",i); if(resultVecRT11[i]!=resultVecBS00[i]) printf("%lu is diff",i);
if(resultVecRT11[i]!=resultVecBS01[i]) printf("%i is diff",i); if(resultVecRT11[i]!=resultVecBS01[i]) printf("%lu is diff",i);
} }
return 0; return 0;
} }

View File

@ -1,12 +1,3 @@
include(../common.pri)
TARGET = trimesh_closest TARGET = trimesh_closest
DEPENDPATH += ../../..
INCLUDEPATH += . ../../..
CONFIG += console stl
TEMPLATE = app
HEADERS +=
SOURCES += trimesh_closest.cpp ../../../wrap/ply/plylib.cpp SOURCES += trimesh_closest.cpp ../../../wrap/ply/plylib.cpp
release {DEFINES += NDEBUG}
# Mac specific Config required to avoid to make application bundles
CONFIG -= app_bundle

View File

@ -0,0 +1,64 @@
/****************************************************************************
* VCGLib o o *
* Visual and Computer Graphics Library o o *
* _ O _ *
* Copyright(C) 2004-2012 \/)\/ *
* 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. *
* *
****************************************************************************/
/*! \file trimesh_color.cpp
\ingroup code_sample
\brief a brief overview of the various color oriented functionalities
*/
#include<vcg/complex/complex.h>
#include <vcg/complex/algorithms/update/bounding.h>
#include <vcg/complex/algorithms/update/color.h>
#include <vcg/complex/algorithms/update/normal.h>
#include <vcg/complex/algorithms/update/flag.h>
#include <vcg/complex/algorithms/clustering.h>
// input output
#include <wrap/io_trimesh/import.h>
#include <wrap/io_trimesh/export.h>
class MyFace;
class MyVertex;
struct MyUsedTypes : public vcg::UsedTypes< vcg::Use<MyVertex>::AsVertexType, vcg::Use<MyFace>::AsFaceType>{};
class MyVertex : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::Color4b, vcg::vertex::BitFlags >{};
class MyFace : public vcg::Face < MyUsedTypes, vcg::face::VertexRef, vcg::face::Normal3f, vcg::face::Color4b, vcg::face::BitFlags > {};
class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> > {};
int main(int argc, char **argv)
{
MyMesh m;
vcg::tri::UpdateColor<MyMesh>::PerVertexConstant(m, vcg::Color4b::LightGray);
vcg::tri::UpdateColor<MyMesh>::PerFaceConstant(m, vcg::Color4b::LightGray);
vcg::tri::UpdateColor<MyMesh>::PerVertexPerlinNoise(m, vcg::Color4b::LightGray);
vcg::tri::UpdateColor<MyMesh>::PerFaceFromVertex(m, vcg::Color4b::LightGray);
vcg::tri::io::ExporterPLY<MyMesh>::Save(m,argv[2]);
return 0;
}

View File

@ -0,0 +1,3 @@
include(../common.pri)
TARGET = trimesh_color
SOURCES += trimesh_color.cpp ../../../wrap/ply/plylib.cpp

View File

@ -1,12 +1,3 @@
include(../common.pri)
TARGET = trimeshcopy TARGET = trimesh_copy
DEPENDPATH += ../../.. SOURCES += trimesh_copy.cpp ../../../wrap/ply/plylib.cpp
INCLUDEPATH += . ../../..
CONFIG += console stl
TEMPLATE = app
HEADERS +=
SOURCES += trimeshcopy.cpp ../../../wrap/ply/plylib.cpp
#DEFINES += N_DEBUG
# Mac specific Config required to avoid to make application bundles
CONFIG -= app_bundle

View File

@ -28,8 +28,11 @@
#include<vcg/complex/algorithms/update/flag.h> #include<vcg/complex/algorithms/update/flag.h>
#include<vcg/complex/algorithms/update/normal.h> #include<vcg/complex/algorithms/update/normal.h>
#include<vcg/complex/algorithms/update/bounding.h> #include<vcg/complex/algorithms/update/bounding.h>
#include<vcg/complex/algorithms/update/curvature.h>
#include <vcg/complex/algorithms/refine.h> #include <vcg/complex/algorithms/refine.h>
#include <vcg/complex/algorithms/refine_loop.h>
#include <wrap/io_trimesh/export_off.h>
#include <wrap/io_trimesh/export_off.h>
class CFace; class CFace;
class CFaceOcf; class CFaceOcf;
@ -43,8 +46,11 @@ struct MyUsedTypesOcf: public vcg::UsedTypes<vcg::Use<CVertexOcf>::AsVertexType,
// OCF Optional Component Fast // OCF Optional Component Fast
// OCC Optional Component Compact // OCC Optional Component Compact
class CVertex : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::BitFlags,vcg::vertex::Normal3f >{}; class CVertex : public vcg::Vertex< MyUsedTypes,
class CVertexOcf : public vcg::Vertex< MyUsedTypesOcf,vcg::vertex::InfoOcf,vcg::vertex::Coord3f,vcg::vertex::QualityfOcf, vcg::vertex::BitFlags,vcg::vertex::Normal3f,vcg::vertex::RadiusfOcf >{}; vcg::vertex::Coord3f, vcg::vertex::BitFlags,vcg::vertex::Normal3f >{};
class CVertexOcf : public vcg::Vertex< MyUsedTypesOcf,
vcg::vertex::InfoOcf, vcg::vertex::Coord3f, vcg::vertex::QualityfOcf,vcg::vertex::Color4b,
vcg::vertex::BitFlags, vcg::vertex::Normal3f,vcg::vertex::RadiusfOcf, vcg::vertex::CurvatureDirfOcf, vcg::vertex::CurvaturefOcf >{};
class CFace : public vcg::Face< MyUsedTypes, vcg::face::FFAdj, vcg::face::VertexRef, vcg::face::BitFlags, vcg::face::Normal3f > {}; class CFace : public vcg::Face< MyUsedTypes, vcg::face::FFAdj, vcg::face::VertexRef, vcg::face::BitFlags, vcg::face::Normal3f > {};
class CFaceOcf : public vcg::Face< MyUsedTypesOcf, vcg::face::InfoOcf, vcg::face::FFAdjOcf, vcg::face::VertexRef, vcg::face::BitFlags, vcg::face::Normal3fOcf > {}; class CFaceOcf : public vcg::Face< MyUsedTypesOcf, vcg::face::InfoOcf, vcg::face::FFAdjOcf, vcg::face::VertexRef, vcg::face::BitFlags, vcg::face::Normal3fOcf > {};
@ -79,36 +85,45 @@ int main(int , char **)
cmof.face.EnableNormal(); // if you remove this the next line will throw an exception for a missing 'normal' component cmof.face.EnableNormal(); // if you remove this the next line will throw an exception for a missing 'normal' component
tri::UpdateNormal<CMeshOcf>::PerVertexPerFace(cmof); tri::UpdateNormal<CMeshOcf>::PerVertexPerFace(cmof);
cmof.vert.EnableCurvature();
cmof.vert.EnableCurvatureDir();
cmof.vert.EnableQuality();
tri::UpdateColor<CMeshOcf>::PerVertexConstant(cmof,Color4b::LightGray);
cmof.vert[0].C()=Color4b::Red;
printf("Normal of face 0 is %f %f %f\n\n",cm.face[0].N()[0],cm.face[0].N()[1],cm.face[0].N()[2]); printf("Normal of face 0 is %f %f %f\n\n",cm.face[0].N()[0],cm.face[0].N()[1],cm.face[0].N()[2]);
int t0=0,t1=0,t2=0; int t0=0,t1=0,t2=0;
while(float(t1-t0)/CLOCKS_PER_SEC < 0.5) while(float(t1-t0)/CLOCKS_PER_SEC < 0.0025)
{ {
t0=clock(); t0=clock();
tri::Refine(cm,tri::MidPointButterfly<CMesh>(cm),0); // tri::Refine(cm,tri::MidPointButterfly<CMesh>(cm),0);
// tri::UpdateCurvature<CMeshOcf>::MeanAndGaussian(cmof);
// tri::UpdateQuality<CMeshOcf>::VertexFromGaussianCurvature(cmof);
tri::RefineOddEven<CMesh> (cm, tri::OddPointLoop<CMesh>(cm), tri::EvenPointLoop<CMesh>(), 0);
tri::Refine(cmof,tri::MidPoint<CMeshOcf>(&cmof),0);
t1=clock(); t1=clock();
tri::Refine(cmof,tri::MidPointButterfly<CMeshOcf>(cmof),0); tri::RefineOddEven<CMesh> (cm, tri::OddPointLoop<CMesh>(cm), tri::EvenPointLoop<CMesh>(), 0);
t2=clock(); t2=clock();
} }
printf("Last Iteration: Refined a tetra up to a mesh of %i faces in %5.2f %5.2f sec\n",cm.FN(),float(t1-t0)/CLOCKS_PER_SEC,float(t2-t1)/CLOCKS_PER_SEC); printf("Last Iteration: Refined a tetra up to a mesh of %i faces in %5.2f %5.2f sec\n",cm.FN(),float(t1-t0)/CLOCKS_PER_SEC,float(t2-t1)/CLOCKS_PER_SEC);
cmof.vert.EnableRadius(); tri::io::ExporterOFF<CMeshOcf>::Save(cmof,"test.off",tri::io::Mask::IOM_VERTCOLOR);
cmof.vert.EnableQuality();
unsigned int hh = 0; unsigned int hh = 0;
for(CMeshOcf::VertexIterator vi = cmof.vert.begin(); vi!=cmof.vert.end();++vi,++hh){ for(CMeshOcf::VertexIterator vi = cmof.vert.begin(); vi!=cmof.vert.end();++vi,++hh){
if(hh%3==0) if(hh%3==0)
vcg::tri::Allocator<CMeshOcf>::DeleteVertex(cmof,*vi); vcg::tri::Allocator<CMeshOcf>::DeleteVertex(cmof,*vi);
} }
cmof.vert.EnableRadius();
// return 0;
for(CMeshOcf::VertexIterator vi = cmof.vert.begin(); vi!=cmof.vert.end();++vi) for(CMeshOcf::VertexIterator vi = cmof.vert.begin(); vi!=cmof.vert.end();++vi)
if(!(*vi).IsD())
{ {
if(!(*vi).IsD()) vi->Q() = tri::Index(cmof,*vi);
{ vi->R() = vi->P()[0];
float q =vi->Q();
float r =vi->R();
assert(q==r);
} }
}
tri::Allocator<CMeshOcf>::CompactVertexVector(cmof); tri::Allocator<CMeshOcf>::CompactVertexVector(cmof);
tri::UpdateBounding<CMeshOcf>::Box(cmof); tri::UpdateBounding<CMeshOcf>::Box(cmof);
@ -118,7 +133,6 @@ int main(int , char **)
{ {
float q =vi->Q(); float q =vi->Q();
float r =vi->R(); float r =vi->R();
assert(q==r);
} }
} }

View File

@ -3,12 +3,9 @@
using namespace std; using namespace std;
// VCG headers for triangular mesh processing // VCG headers for triangular mesh processing
#include<vcg/simplex/edge/base.h>
#include<vcg/simplex/vertex/base.h>
#include<vcg/simplex/face/base.h>
#include <vcg/complex/complex.h> #include <vcg/complex/complex.h>
#include <vcg/complex/algorithms/update/topology.h> #include <vcg/complex/algorithms/update/topology.h>
#include <vcg/complex/algorithms/update/edges.h> #include <vcg/complex/algorithms/update/component_ep.h>
#include <vcg/complex/algorithms/update/bounding.h> #include <vcg/complex/algorithms/update/bounding.h>
#include <vcg/complex/algorithms/update/quality.h> #include <vcg/complex/algorithms/update/quality.h>
#include <vcg/complex/algorithms/update/color.h> #include <vcg/complex/algorithms/update/color.h>
@ -89,9 +86,9 @@ int main(int argc,char ** argv)
// updating // updating
tri::UpdateBounding<MyMesh>::Box(m); tri::UpdateBounding<MyMesh>::Box(m);
tri::UpdateNormals<MyMesh>::PerFaceNormalized(m); tri::UpdateNormal<MyMesh>::PerFaceNormalized(m);
tri::UpdateNormals<MyMesh>::PerVertexAngleWeighted(m); tri::UpdateNormal<MyMesh>::PerVertexAngleWeighted(m);
tri::UpdateNormals<MyMesh>::NormalizeVertex(m); tri::UpdateNormal<MyMesh>::NormalizePerVertex(m);
// Create a static grid (for fast indexing) and fill it // Create a static grid (for fast indexing) and fill it
TriMeshGrid static_grid; TriMeshGrid static_grid;
static_grid.Set(m.face.begin(), m.face.end()); static_grid.Set(m.face.begin(), m.face.end());
@ -143,7 +140,7 @@ int main(int argc,char ** argv)
} }
} }
int t2 = clock(); int t2 = clock();
tri::UpdateColor<MyMesh>::VertexQualityRamp(m); tri::UpdateColor<MyMesh>::PerVertexQualityRamp(m);
tri::io::ExporterPLY<MyMesh>::Save(m,"SDF.ply",tri::io::Mask::IOM_VERTCOLOR+tri::io::Mask::IOM_VERTQUALITY); tri::io::ExporterPLY<MyMesh>::Save(m,"SDF.ply",tri::io::Mask::IOM_VERTCOLOR+tri::io::Mask::IOM_VERTQUALITY);
printf("Initializated in %i msec\n",t1-t0); printf("Initializated in %i msec\n",t1-t0);

View File

@ -670,7 +670,11 @@ INPUT = . \
../../apps/sample/trimesh_base \ ../../apps/sample/trimesh_base \
../../apps/sample/trimesh_attribute \ ../../apps/sample/trimesh_attribute \
../../apps/sample/trimesh_smooth \ ../../apps/sample/trimesh_smooth \
../../apps/sample/trimesh_refine ../../apps/sample/trimesh_refine \
../../vcg/complex/allocate.h \
../../vcg/complex/algorithms/inertia.h \
../../vcg/complex/algorithms/clean.h \
../../apps/sample/trimesh_inertia
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is

View File

@ -12,6 +12,7 @@ This module contains the documentation for the types and the functions used for
/** \defgroup simplex Simplexes /** \defgroup simplex Simplexes
The module containing the various simplicial complexes The module containing the various simplicial complexes
*/ */
//@{ //@{
/** \defgroup vertex Vertexes /** \defgroup vertex Vertexes
Vertex of edge, triangular and tetrahedral meshes Vertex of edge, triangular and tetrahedral meshes
@ -20,29 +21,12 @@ This module contains the documentation for the types and the functions used for
/** \defgroup face Faces /** \defgroup face Faces
Face of a triangular or a tetrahedral mesh Face of a triangular or a tetrahedral mesh
*/ */
//@} //@}
/** \defgroup complex Complexes
The module containing the various simplicial complexes
*/
//@{
/** \defgroup edgemesh Edge Meshes (i.e. PolyLines)
This module contains the documentation for the types and the functions used for representing and managing generic polylines, or in other words \b edge\b meshes.
*/
/** \defgroup trimesh Triangular Meshes /** \defgroup trimesh Triangular Meshes
This module contains the documentation for the types and the functions used for representing and managing generic \b triangular \b meshes. This module contains the documentation for the types and the functions used for representing and managing generic \b triangular \b meshes.
*/ */
/** \defgroup tetramesh Tetrahedral Meshes
This module contains the documentation for the types and the functions used for representing and managing generic tetrahedral of meshes.
*/
//@}
/** \defgroup code_sample Code Examples /** \defgroup code_sample Code Examples
\brief This module contains a number of small examples to explain the library features \brief This module contains a number of small examples to explain the library features