From d52126591c28f2f3b65f096b5e6f1259af12d1d5 Mon Sep 17 00:00:00 2001 From: ganovelli Date: Thu, 31 Mar 2011 15:47:27 +0000 Subject: [PATCH] minor corrections for recompiling all the samples and removal of some warnings: removed deprecated LIBPATH --- .../aabb_binary_tree/aabb_binary_tree.pro | 1 - apps/sample/polygonmesh_base/polygonmesh.cpp | 5 +- .../polygonmesh_base/polygonmesh_base.pro | 5 +- apps/sample/sample.pro | 3 +- .../trimesh_attribute/trimesh_attribute.pro | 3 +- .../trimesh_ball_pivoting.pro | 3 +- apps/sample/trimesh_base/trimesh_base.pro | 3 +- .../trimesh_clustering/trimesh_clustering.pro | 3 +- apps/sample/trimesh_hole/trimesh_hole.cpp | 7 +- apps/sample/trimesh_hole/trimesh_hole.pro | 3 +- .../trimesh_intersection.pro | 3 +- .../trimesh_isosurface/trimesh_isosurface.pro | 1 - apps/sample/trimesh_join/trimesh_join.pro | 3 +- .../sample/trimesh_optional/mesh_definition.h | 17 ++--- .../trimesh_optional/trimesh_optional.cpp | 65 ++++++++++++------- .../trimesh_optional/trimesh_optional.pro | 3 +- apps/sample/trimesh_refine/trimesh_refine.pro | 1 - apps/sample/trimesh_smooth/trimesh_smooth.pro | 3 +- .../trimesh_topology/trimesh_topology.pro | 5 +- 19 files changed, 65 insertions(+), 72 deletions(-) diff --git a/apps/sample/aabb_binary_tree/aabb_binary_tree.pro b/apps/sample/aabb_binary_tree/aabb_binary_tree.pro index 9c82efb8..6fbedf2e 100644 --- a/apps/sample/aabb_binary_tree/aabb_binary_tree.pro +++ b/apps/sample/aabb_binary_tree/aabb_binary_tree.pro @@ -3,7 +3,6 @@ ###################################################################### TARGET = aabb_binary_tree -LIBPATH += DEPENDPATH += . INCLUDEPATH += . ../../.. CONFIG += console diff --git a/apps/sample/polygonmesh_base/polygonmesh.cpp b/apps/sample/polygonmesh_base/polygonmesh.cpp index 458134e9..4c146c50 100644 --- a/apps/sample/polygonmesh_base/polygonmesh.cpp +++ b/apps/sample/polygonmesh_base/polygonmesh.cpp @@ -155,7 +155,7 @@ int main(int argc, char *argv[]) { vcg::tri::io::PlyInfo pi; // pm.hedge.reserve(100000); -if(false){ +if(true){ /* first way: 1) read a polygon mesh that will be automatically converted in a triangle mesh tagging @@ -163,7 +163,8 @@ if(false){ 2) make some cleaning 3) import the tagged triangle mesh in a polygon mesh */ - vcg::tri::io::ImporterOBJ::Open(mesh,argv[1],loadmask); +// vcg::tri::io::ImporterOBJ::Open(mesh,argv[1],loadmask); + vcg::tri::io::ImporterOFF::Open(mesh,argv[1],loadmask); vcg::tri::Clean::RemoveUnreferencedVertex(mesh); vcg::tri::Clean::RemoveZeroAreaFace(mesh); diff --git a/apps/sample/polygonmesh_base/polygonmesh_base.pro b/apps/sample/polygonmesh_base/polygonmesh_base.pro index 22f253b0..320a510d 100644 --- a/apps/sample/polygonmesh_base/polygonmesh_base.pro +++ b/apps/sample/polygonmesh_base/polygonmesh_base.pro @@ -2,10 +2,9 @@ # Automatically generated by qmake (2.00a) ven 24. giu 14:14:20 2005 ###################################################################### -TARGET = polygonmesh_base -LIBPATH += +TARGET = polygonmesh_base DEPENDPATH += . INCLUDEPATH += . ../../.. CONFIG += console stl TEMPLATE = app -SOURCES += polygonmesh.cpp ../../../wrap/ply/plylib.cpp \ No newline at end of file +SOURCES += polygonmesh.cpp ../../../wrap/ply/plylib.cpp diff --git a/apps/sample/sample.pro b/apps/sample/sample.pro index 335bc49f..efbb31d4 100644 --- a/apps/sample/sample.pro +++ b/apps/sample/sample.pro @@ -16,8 +16,7 @@ SUBDIRS = trimesh_base \ trimesh_hole \ polygonmesh_base \ aabb_binary_tree \ - edgemesh_grid \ - trimesh_attribute + trimesh_attribute sources.files = *.pro sources.path = . diff --git a/apps/sample/trimesh_attribute/trimesh_attribute.pro b/apps/sample/trimesh_attribute/trimesh_attribute.pro index 75627687..4c204169 100644 --- a/apps/sample/trimesh_attribute/trimesh_attribute.pro +++ b/apps/sample/trimesh_attribute/trimesh_attribute.pro @@ -5,9 +5,8 @@ # env MINGW_IN_SHELL=1 qmake -spec win32-g++ TARGET = trimesh_attribute -LIBPATH += DEPENDPATH += . INCLUDEPATH += . ../../.. CONFIG += console stl TEMPLATE = app -SOURCES += trimesh_attribute.cpp ../../../wrap/ply/plylib.cpp \ No newline at end of file +SOURCES += trimesh_attribute.cpp ../../../wrap/ply/plylib.cpp diff --git a/apps/sample/trimesh_ball_pivoting/trimesh_ball_pivoting.pro b/apps/sample/trimesh_ball_pivoting/trimesh_ball_pivoting.pro index d7d3bad6..2cf3fb21 100644 --- a/apps/sample/trimesh_ball_pivoting/trimesh_ball_pivoting.pro +++ b/apps/sample/trimesh_ball_pivoting/trimesh_ball_pivoting.pro @@ -5,9 +5,8 @@ # env MINGW_IN_SHELL=1 qmake -spec win32-g++ TARGET = trimesh_ball_pivoting -LIBPATH += DEPENDPATH += . INCLUDEPATH += . ../../.. CONFIG += console stl TEMPLATE = app -SOURCES += trimesh_ball_pivoting.cpp ../../../wrap/ply/plylib.cpp \ No newline at end of file +SOURCES += trimesh_ball_pivoting.cpp ../../../wrap/ply/plylib.cpp diff --git a/apps/sample/trimesh_base/trimesh_base.pro b/apps/sample/trimesh_base/trimesh_base.pro index 139ae774..dfea4efd 100644 --- a/apps/sample/trimesh_base/trimesh_base.pro +++ b/apps/sample/trimesh_base/trimesh_base.pro @@ -3,11 +3,10 @@ ###################################################################### TARGET = trimesh_base -LIBPATH += DEPENDPATH += . INCLUDEPATH += . ../../.. CONFIG += console stl TEMPLATE = app SOURCES += trimesh_base.cpp ../../../wrap/ply/plylib.cpp # Mac specific Config required to avoid to make application bundles -CONFIG -= app_bundle \ No newline at end of file +CONFIG -= app_bundle diff --git a/apps/sample/trimesh_clustering/trimesh_clustering.pro b/apps/sample/trimesh_clustering/trimesh_clustering.pro index e6768589..bde71b7d 100644 --- a/apps/sample/trimesh_clustering/trimesh_clustering.pro +++ b/apps/sample/trimesh_clustering/trimesh_clustering.pro @@ -5,9 +5,8 @@ # env MINGW_IN_SHELL=1 qmake -spec win32-g++ TARGET = trimesh_clustering -LIBPATH += DEPENDPATH += . INCLUDEPATH += . ../../.. CONFIG += console stl TEMPLATE = app -SOURCES += trimesh_clustering.cpp ../../../wrap/ply/plylib.cpp \ No newline at end of file +SOURCES += trimesh_clustering.cpp ../../../wrap/ply/plylib.cpp diff --git a/apps/sample/trimesh_hole/trimesh_hole.cpp b/apps/sample/trimesh_hole/trimesh_hole.cpp index 60af1995..e0208bce 100644 --- a/apps/sample/trimesh_hole/trimesh_hole.cpp +++ b/apps/sample/trimesh_hole/trimesh_hole.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include #include @@ -60,15 +61,14 @@ template bool NormalTest(typename face::Pos pos) { //giro intorno al vertice e controllo le normali - float accum=0; typename MESH::ScalarType thr = 0.0f; - typename MESH::CoordType NdP = Normal(*pos.f); + typename MESH::CoordType NdP = vcg::Normal(*pos.f); typename MESH::CoordType tmp, oop, soglia = typename MESH::CoordType(thr,thr,thr); face::Pos aux=pos; do{ aux.FlipF(); aux.FlipE(); - oop = Abs(tmp - Normal(*pos.f)); + oop = Abs(tmp - ::vcg::Normal(*pos.f)); if(oop < soglia )return false; }while(aux != pos && !aux.IsBorder()); @@ -128,7 +128,6 @@ int main(int argc,char ** argv){ } AVG=sumA/numA; - tri::Hole holeFiller; switch(algorithm) { case 1: tri::Hole::EarCuttingFill >(m,holeSize,false); break; diff --git a/apps/sample/trimesh_hole/trimesh_hole.pro b/apps/sample/trimesh_hole/trimesh_hole.pro index 18b46dbc..c795b904 100644 --- a/apps/sample/trimesh_hole/trimesh_hole.pro +++ b/apps/sample/trimesh_hole/trimesh_hole.pro @@ -3,10 +3,9 @@ ###################################################################### TARGET = trimesh_hole -LIBPATH += DEPENDPATH += . INCLUDEPATH += . ../../.. CONFIG += console stl TEMPLATE = app SOURCES += trimesh_hole.cpp ../../../wrap/ply/plylib.cpp -HEADERS += ../../../wrap/ply/plylib.h \ No newline at end of file +HEADERS += ../../../wrap/ply/plylib.h diff --git a/apps/sample/trimesh_intersection/trimesh_intersection.pro b/apps/sample/trimesh_intersection/trimesh_intersection.pro index 645d9366..fade31de 100644 --- a/apps/sample/trimesh_intersection/trimesh_intersection.pro +++ b/apps/sample/trimesh_intersection/trimesh_intersection.pro @@ -1,7 +1,6 @@ TARGET = trimesh_intersection -LIBPATH += DEPENDPATH += . INCLUDEPATH += . ../../.. CONFIG += console stl TEMPLATE = app -SOURCES += trimesh_intersection.cpp ../../../wrap/ply/plylib.cpp \ No newline at end of file +SOURCES += trimesh_intersection.cpp ../../../wrap/ply/plylib.cpp diff --git a/apps/sample/trimesh_isosurface/trimesh_isosurface.pro b/apps/sample/trimesh_isosurface/trimesh_isosurface.pro index 3b0bbe68..0fed9402 100644 --- a/apps/sample/trimesh_isosurface/trimesh_isosurface.pro +++ b/apps/sample/trimesh_isosurface/trimesh_isosurface.pro @@ -2,5 +2,4 @@ INCLUDEPATH += . ../../.. CONFIG += console stl TEMPLATE = app # Input -HEADERS += trivial_walker.h simple_volume.h SOURCES += trimesh_isosurface.cpp ../../../wrap/ply/plylib.cpp diff --git a/apps/sample/trimesh_join/trimesh_join.pro b/apps/sample/trimesh_join/trimesh_join.pro index 46b21cee..87aa5493 100644 --- a/apps/sample/trimesh_join/trimesh_join.pro +++ b/apps/sample/trimesh_join/trimesh_join.pro @@ -3,11 +3,10 @@ ###################################################################### TARGET = trimesh_join -LIBPATH += DEPENDPATH += . INCLUDEPATH += . ../../.. CONFIG += console stl TEMPLATE = app HEADERS += ../../../vcg/complex/trimesh/subset.h -SOURCES += trimesh_join.cpp ../../../wrap/ply/plylib.cpp \ No newline at end of file +SOURCES += trimesh_join.cpp ../../../wrap/ply/plylib.cpp diff --git a/apps/sample/trimesh_optional/mesh_definition.h b/apps/sample/trimesh_optional/mesh_definition.h index 2529198c..6959e843 100644 --- a/apps/sample/trimesh_optional/mesh_definition.h +++ b/apps/sample/trimesh_optional/mesh_definition.h @@ -1,6 +1,7 @@ #ifndef _MESH_DEF_ #define _MESH_DEF_ +#include #include #include #include @@ -8,36 +9,28 @@ #include #include -#include -#include -#include class CFace; class CFaceOcf; -class CFaceOcc; + class CVertex; class CVertexOcf; -class CVertexOcc; + struct MyUsedTypes: public vcg::UsedTypes::AsVertexType,vcg::Use::AsFaceType>{}; struct MyUsedTypesOcf: public vcg::UsedTypes::AsVertexType,vcg::Use::AsFaceType>{}; -struct MyUsedTypesOcc: public vcg::UsedTypes::AsVertexType,vcg::Use::AsFaceType>{}; // Optional stuff has two suffixes: // OCF Optional Component Fast // OCC Optional Component Compact class CVertex : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::BitFlags,vcg::vertex::Normal3f >{}; -class CVertexOcf : public vcg::Vertex< MyUsedTypesOcf,vcg::vertex::Coord3f, vcg::vertex::BitFlags,vcg::vertex::Normal3f,vcg::vertex::Radiusf >{}; -class CVertexOcc : public vcg::Vertex< MyUsedTypesOcc,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::BitFlags,vcg::vertex::Normal3f,vcg::vertex::RadiusfOcf >{}; 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 CFaceOcc : public vcg::Face< MyUsedTypesOcc, vcg::face::FFAdjOcc, vcg::face::VertexRef, vcg::face::BitFlags, vcg::face::Normal3fOcc > {}; class CMesh : public vcg::tri::TriMesh< std::vector, std::vector > {}; -class CMeshOcf : public vcg::tri::TriMesh< std::vector, vcg::face::vector_ocf > {}; -class CMeshOcc : public vcg::tri::TriMesh< vcg::vector_occ, vcg::vector_occ > {}; +class CMeshOcf : public vcg::tri::TriMesh< vcg::vertex::vector_ocf, vcg::face::vector_ocf > {}; #endif diff --git a/apps/sample/trimesh_optional/trimesh_optional.cpp b/apps/sample/trimesh_optional/trimesh_optional.cpp index 425135e5..3c5745bf 100644 --- a/apps/sample/trimesh_optional/trimesh_optional.cpp +++ b/apps/sample/trimesh_optional/trimesh_optional.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include using namespace vcg; @@ -21,59 +22,73 @@ int main(int , char **) CMesh cm; CMeshOcf cmof; - CMeshOcc cmoc; - - CMesh::VertexPointer v = cm.face[0].V(0); - - - cmoc.face.EnableAttribute(); - CMeshOcc::FaceIterator fi = vcg::tri::Allocator::AddFaces(cmoc,1); - (*fi).N() = vcg::Point3f(9,9,9); + tri::Tetrahedron(cm); tri::Tetrahedron(cmof); - tri::Tetrahedron(cmoc); printf("Generated mesh has %i vertices and %i triangular faces\n",cm.vn,cm.fn); /// Calculates both vertex and face normals. /// The normal of a vertex v is the weigthed average of the normals of the faces incident on v. /// normals are not normalized +cmof.face.EnableFFAdjacency(); - cmoc.face.EnableAttribute(); - cmof.face.EnableFFAdjacency(); - - - printf("Size of CFace %3i\n",sizeof(CFace)); - printf("Size of CFaceOcf %3i\n",sizeof(CFaceOcf)); - printf("Size of CFaceOcc %3i\n",sizeof(CFaceOcc)); - vcg::tri::UpdateTopology::FaceFace(cm); vcg::tri::UpdateTopology::FaceFace(cmof); - vcg::tri::UpdateTopology::FaceFace(cmoc); vcg::tri::UpdateFlags::FaceBorderFromFF(cm); vcg::tri::UpdateFlags::FaceBorderFromFF(cmof); - vcg::tri::UpdateFlags::FaceBorderFromFF(cmoc); vcg::tri::UpdateNormals::PerVertexNormalized(cm); vcg::tri::UpdateNormals::PerVertexNormalized(cmof); - vcg::tri::UpdateNormals::PerVertexNormalized(cmoc); 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,t3=0; - while(t3-t0<3000) + while(t1-t0<200) { t0=clock(); Refine(cm,MidPointButterfly(),0); t1=clock(); Refine(cmof,MidPointButterfly(),0); - t2=clock(); - Refine(cmoc,MidPointButterfly(),0); - t3=clock(); - printf("Mesh is %i %i in Std:%i Ocf:%i Occ:%i\n",cm.vn,cm.fn,t1-t0,t2-t1,t3-t2); } + + + cmof.vert.EnableRadius(); + cmof.vert.EnableQuality(); + + unsigned int hh = 0; + for(CMeshOcf::VertexIterator vi = cmof.vert.begin(); vi!=cmof.vert.end();++vi,++hh){ + if(hh%3==0) + vcg::tri::Allocator::DeleteVertex(cmof,*vi); + } + + for(CMeshOcf::VertexIterator vi = cmof.vert.begin(); vi!=cmof.vert.end();++vi) + { + if(!(*vi).IsD()) + { + float q =vi->Q(); + float r =vi->R(); + int ii = vi - cmof.vert.begin(); + assert(q==r); + } + } + + tri::Allocator::CompactVertexVector(cmof); + tri::UpdateBounding::Box(cmof); + for(CMeshOcf::VertexIterator vi = cmof.vert.begin(); vi!=cmof.vert.end();++vi) + { + if(!(*vi).IsD()) + { + float q =vi->Q(); + float r =vi->R(); + int ii = vi - cmof.vert.begin(); + assert(q==r); + } + } + + return 0; } diff --git a/apps/sample/trimesh_optional/trimesh_optional.pro b/apps/sample/trimesh_optional/trimesh_optional.pro index cd4b2e79..df3533d5 100644 --- a/apps/sample/trimesh_optional/trimesh_optional.pro +++ b/apps/sample/trimesh_optional/trimesh_optional.pro @@ -5,9 +5,8 @@ # env MINGW_IN_SHELL=1 qmake -spec win32-g++ TARGET = trimesh_optional -LIBPATH += DEPENDPATH += . INCLUDEPATH += . ../../.. CONFIG += console stl TEMPLATE = app -SOURCES += trimesh_optional.cpp ../../../wrap/ply/plylib.cpp \ No newline at end of file +SOURCES += trimesh_optional.cpp ../../../wrap/ply/plylib.cpp diff --git a/apps/sample/trimesh_refine/trimesh_refine.pro b/apps/sample/trimesh_refine/trimesh_refine.pro index 7aeb6e87..8a29b514 100644 --- a/apps/sample/trimesh_refine/trimesh_refine.pro +++ b/apps/sample/trimesh_refine/trimesh_refine.pro @@ -5,7 +5,6 @@ # env MINGW_IN_SHELL=1 qmake -spec win32-g++ TARGET = trimesh_refine -LIBPATH += DEPENDPATH += . INCLUDEPATH += . ../../.. CONFIG += console stl diff --git a/apps/sample/trimesh_smooth/trimesh_smooth.pro b/apps/sample/trimesh_smooth/trimesh_smooth.pro index 1331efeb..56de5000 100644 --- a/apps/sample/trimesh_smooth/trimesh_smooth.pro +++ b/apps/sample/trimesh_smooth/trimesh_smooth.pro @@ -3,9 +3,8 @@ ###################################################################### TARGET = trimesh_smooth -LIBPATH += DEPENDPATH += . INCLUDEPATH += . ../../.. CONFIG += console stl TEMPLATE = app -SOURCES += trimesh_smooth.cpp ../../../wrap/ply/plylib.cpp \ No newline at end of file +SOURCES += trimesh_smooth.cpp ../../../wrap/ply/plylib.cpp diff --git a/apps/sample/trimesh_topology/trimesh_topology.pro b/apps/sample/trimesh_topology/trimesh_topology.pro index eed16d34..fcaa1ccb 100644 --- a/apps/sample/trimesh_topology/trimesh_topology.pro +++ b/apps/sample/trimesh_topology/trimesh_topology.pro @@ -3,9 +3,8 @@ ###################################################################### TARGET = trimesh_topology -LIBPATH += -DEPENDPATH += . +DEPENDPATH += . INCLUDEPATH += . ../../.. CONFIG += console stl TEMPLATE = app -SOURCES += trimesh_topology.cpp \ No newline at end of file +SOURCES += trimesh_topology.cpp