From 2fb492d90ac76a5788147529519f5fb3bfc92282 Mon Sep 17 00:00:00 2001 From: cignoni Date: Wed, 10 Mar 2004 01:00:21 +0000 Subject: [PATCH] minor changes --- apps/test/trimesh/main.cpp | 35 +++++++++++++-------- docs/Doxygen/doxyfile | 13 ++++---- vcg/complex/trimesh/base.h | 63 ++++++++++++++++++++------------------ vcg/simplex/vertex/base.h | 4 +++ 4 files changed, 66 insertions(+), 49 deletions(-) diff --git a/apps/test/trimesh/main.cpp b/apps/test/trimesh/main.cpp index 22f10c33..ef499246 100644 --- a/apps/test/trimesh/main.cpp +++ b/apps/test/trimesh/main.cpp @@ -6,16 +6,18 @@ #include #include #include +#include #include -#include +#include #include #include -#include +#include #include #include #include #include #include +#include using namespace vcg; using namespace std; @@ -31,30 +33,37 @@ int main(int argc, char *argv[]) FaceFN fnf; FaceFN fnd; - typedef tri::TriMesh< vector, vector< FaceFN > > MyMesh; - MyMesh tm; - typedef tri::TriMesh< vector, vector< FaceFA > > MyMeshAdj; + typedef tri::TriMesh< vector, vector< FaceFAFC > > MyMeshAdj; MyMeshAdj ta; printf("Sizeof(VertexNf) = %i (%i + %i + %i)\n",sizeof(VertexNf),sizeof(Point3f),sizeof(int),sizeof(Point3f)); printf("Sizeof(VertexNd) = %i (%i + %i + %i) \n",sizeof(VertexNd),sizeof(Point3d),sizeof(int),sizeof(Point3d)); printf("Sizeof(FaceFN) = %i \n",sizeof(FaceFN)); - printf("Sizeof(FaceFA) = %i \n",sizeof(FaceFA)); + //printf("Sizeof(FaceFA) = %i \n",sizeof(FaceFA)); - tri::Tetrahedron(tm); + //typedef tri::TriMesh< vector, vector< FaceFN > > MyMesh; + //MyMesh tm; + //tri::Tetrahedron(tm); - tri::io::ExporterSTL::Save(tm,"Tetra.stl",false); + //tri::io::ExporterSTL::Save(tm,"Tetra.stl",false); + //tri::io::ExporterPLY::Save(tm,"Tetraascii.ply",false); + //tri::io::ExporterPLY::Save(tm,"Tetrabin.ply"); //tri::io::ExporterSTL::Save(tm,"armawarp.stl",false); - tri::UpdateNormals::PerVertexNormalized(tm); - tri::UpdateNormals::PerFaceNormalized(tm); - tri::UpdateNormals::PerVertex(tm); - tri::UpdateNormals::PerFace(tm); + //tri::UpdateNormals::PerVertexNormalized(tm); + //tri::UpdateNormals::PerFaceNormalized(tm); + //tri::UpdateNormals::PerVertex(tm); + //tri::UpdateNormals::PerFace(tm); - tri::io::ImporterPLY::Open(ta,"armawarp.ply"); + tri::io::ImporterPLY::Open(ta,"bigtest.ply"); printf("Loaded Mesh Has %i vn %i fn\n",ta.vn,ta.fn); tri::UpdateTopology::FaceFace(ta); tri::UpdateFlags::FaceBorderFromFF(ta); + tri::UpdateColor::FaceBF(ta); + tri::io::PlyInfo pi; + pi.mask=tri::io::PLYMask::PM_FACECOLOR; + tri::io::ExporterPLY::Save(ta,"color.ply",true, pi); + return 0; } \ No newline at end of file diff --git a/docs/Doxygen/doxyfile b/docs/Doxygen/doxyfile index 3e0bf163..55b55c3e 100644 --- a/docs/Doxygen/doxyfile +++ b/docs/Doxygen/doxyfile @@ -29,12 +29,12 @@ SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- -EXTRACT_ALL = YES +EXTRACT_ALL = NO EXTRACT_PRIVATE = NO EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = YES -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO +EXTRACT_LOCAL_CLASSES = NO +HIDE_UNDOC_MEMBERS = YES +HIDE_UNDOC_CLASSES = YES HIDE_FRIEND_COMPOUNDS = NO HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO @@ -62,8 +62,9 @@ WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = C:/Documenti/sf/vcg/ \ - C:/Documenti/sf/docs/Doxygen/ +INPUT = ./ \ + ../../vcg/ \ + ../../wrap/io_trimesh FILE_PATTERNS = *.cpp \ *.h \ *.dxy diff --git a/vcg/complex/trimesh/base.h b/vcg/complex/trimesh/base.h index 69a8f9cd..45bfbe08 100644 --- a/vcg/complex/trimesh/base.h +++ b/vcg/complex/trimesh/base.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.3 2004/03/07 21:54:56 cignoni +some more reflection functions + Revision 1.2 2004/03/04 00:08:15 cignoni First working version! @@ -50,11 +53,11 @@ namespace tri { @param VertContainer (Template Parameter) Specifies the type of the vertices container any the vertex type. @param STL_FACE_CONT (Template Parameter) Specifies the type of the faces container any the face type. */ -template < class STL_VERT_CONT, class STL_FACE_CONT > +template < class VertContainerType, class FaceContainerType > class TriMesh{ public: - typedef STL_FACE_CONT FaceContainer; - typedef STL_VERT_CONT VertContainer; + typedef FaceContainerType FaceContainer; + typedef VertContainerType VertContainer; typedef typename VertContainer::value_type VertexType; typedef typename FaceContainer::value_type FaceType; typedef typename VertexType::ScalarType ScalarType; @@ -140,15 +143,16 @@ static bool HasPerVertexMark() { return VertexType::HasMark() ; } static bool HasPerVertexQuality() { return VertexType::HasQuality(); } static bool HasPerVertexTexture() { return VertexType::HasTexture(); } -static bool HasPerFaceColor() { return FaceType::HasFaceNormal() ; } -static bool HasPerFaceNormal() { return FaceType::HasFaceColor() ; } +static bool HasPerFaceColor() { return FaceType::HasFaceColor() ; } +static bool HasPerFaceNormal() { return FaceType::HasFaceNormal() ; } static bool HasPerFaceMark() { return FaceType::HasFaceMark() ; } static bool HasPerFaceQuality() { return FaceType::HasFaceQuality(); } -static bool HasPerWedgeColor() { return FaceType::HasWedgeNormal() ; } -static bool HasPerWedgeNormal() { return FaceType::HasWedgeColor() ; } +static bool HasPerWedgeColor() { return FaceType::HasWedgeColor() ; } +static bool HasPerWedgeNormal() { return FaceType::HasWedgeNormal() ; } static bool HasPerWedgeMark() { return FaceType::HasWedgeMark() ; } static bool HasPerWedgeQuality() { return FaceType::HasWedgeQuality(); } +static bool HasPerWedgeTexture() { return FaceType::HasWedgeTexture(); } static bool HasFFTopology() { return FaceType::HasFFAdjacency(); } static bool HasVFTopology() { return FaceType::HasVFAdjacency(); } @@ -158,7 +162,7 @@ static bool HasTopology() { return HasFFTopology() || HasVFTopology(); } /// Initialize the imark-system of the faces void InitFaceIMark() { - face_iterator f; + FaceIterator f; for(f=face.begin();f!=face.end();++f) if( !(*f).IsDeleted() && (*f).IsR() && (*f).IsW() ) @@ -168,7 +172,7 @@ void InitFaceIMark() /// Initialize the imark-system of the vertices void InitVertexIMark() { - vertex_iterator vi; + VertexIterator vi; for(vi=vert.begin();vi!=vert.end();++vi) if( !(*vi).IsDeleted() && (*vi).IsRW() ) @@ -202,34 +206,33 @@ inline void UnMarkAll() { ++imark; } /// Calcolo del volume di una mesh chiusa ScalarType Volume() { - - face_iterator f; + FaceIterator fi; int j,k; ScalarType V = 0; - vectorial_type T,N,B; + CoordType T,N,B; - for(f = face.begin(); f!=face.end(); ++f) + for(fi = face.begin(); fi!=face.end(); ++fi) { - for(j = 0; j < 3; ++j) - { - /*calcolo tangente, normale e binormale (6 volte)*/ - k = (j+1)%3; - T = (*f).V(k)->P() - (*f).V(j)->P(); - T.Normalize(); - T = ( (*f).V( k )->P() - (*f).V(j)->P() ) ^ - ( (*f).V((k+1)%3)->P() - (*f).V(j)->P() ) ; - B.Normalize(); - N = T ^ B; + for(j = 0; j < 3; ++j) + { + /*calcolo tangente, normale e binormale (6 volte)*/ + k = (j+1)%3; + T = (*fi).P(k) - (*fi).P(j); + T.Normalize(); + T = ( (*fi).P( k ) - (*fi).P(j) ) ^ + ( (*fi).P((k+1)%3) - (*fi).P(j) ) ; + B.Normalize(); + N = T ^ B; + + CoordType pj = (*fi).P(j); + CoordType pk = (*fi).P(k); - vectorial_type pj = (*f).V(j)->P(); - vectorial_type pk = (*f).V(k)->P(); - - V += (pj* T )*(pj*N)*(pj*B); - V += (pk*(-T))*(pk*N)*(pk*B); - } + V += (pj* T )*(pj*N)*(pj*B); + V += (pk*(-T))*(pk*N)*(pk*B); + } } - return V/6; + return V/6.0; } diff --git a/vcg/simplex/vertex/base.h b/vcg/simplex/vertex/base.h index 0e3ab589..1d0ca74a 100644 --- a/vcg/simplex/vertex/base.h +++ b/vcg/simplex/vertex/base.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.4 2004/03/03 16:07:57 cignoni +Yet another cr lf mismatch + Revision 1.3 2004/02/24 21:36:39 cignoni grouped documentation, changed typenames and reflection mechanism @@ -64,6 +67,7 @@ public: typedef FLTYPE ScalarType; /// The coordinate type used to represent the point (i.e. Point3f, Point3d, ...) typedef Point3 CoordType; + typedef Point3 NormalType; /// The type base of the vertex, useful for recovering the original typename after user subclassing typedef VERTEX_TYPE BaseVertexType; /// The type base of the vertex, useful for recovering the original typename after user subclassing