2004-03-04 01:08:15 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* VCGLib o o *
|
|
|
|
* Visual and Computer Graphics Library o o *
|
|
|
|
* _ O _ *
|
|
|
|
* Copyright(C) 2004 \/)\/ *
|
|
|
|
* 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. *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
2004-09-08 17:15:05 +02:00
|
|
|
|
2007-02-22 10:18:41 +01:00
|
|
|
#if defined(_MSC_VER)
|
2004-03-04 01:08:15 +01:00
|
|
|
#pragma warning( disable : 4804 )
|
2004-09-08 17:15:05 +02:00
|
|
|
#endif
|
2005-11-16 23:35:47 +01:00
|
|
|
#include <assert.h>
|
2005-12-02 01:05:34 +01:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2008-05-15 18:32:27 +02:00
|
|
|
#include <set>
|
2004-07-15 14:03:50 +02:00
|
|
|
#include <vcg/space/box3.h>
|
2005-11-16 23:35:47 +01:00
|
|
|
#include <vcg/space/color4.h>
|
2004-10-07 16:25:38 +02:00
|
|
|
#include <vcg/math/shot.h>
|
2004-03-04 01:08:15 +01:00
|
|
|
|
2008-05-15 18:32:27 +02:00
|
|
|
#include <vcg/container/simple_temporary_data.h>
|
2010-03-19 18:13:31 +01:00
|
|
|
#include <vcg/simplex/vertex/base.h>
|
2008-12-19 11:39:32 +01:00
|
|
|
#include <vcg/simplex/edge/base.h>
|
2010-03-19 18:13:31 +01:00
|
|
|
#include <vcg/simplex/face/base.h>
|
2010-03-25 17:50:28 +01:00
|
|
|
#include <vcg/connectors/hedge.h>
|
[ Changes in definition of TriMesh: PART I ]
Note for the developers: the change to make to existing projects is very little
but strictly necessary to compile. This change IS NOT backward compliant.
==== OLD ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;
class MyVertex: public VertexSimp2 < MyVertex, MyEdge, MyFace, vertex::Coord3f,...other components>{};
class MyFace: public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};
==== NEW ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;
// declaration of which types is used as VertexType, which type is used as FaceType and so on...
class MyUsedTypes: public vcg::UsedType < vcg::Use<MyVertex>::AsVertexType,
vcg::Use<MyFace>::AsFaceType>{};
class MyVertex: public Vertex < MyUsedTypes, vertex::Coord3f,...other components>{};
class MyFace: public Face < MyUsedTypes, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};
===== classes introduced
[vcg::UsedType] : it is a class containing all the types that must be passed to the definition of Vertex, Face, Edge... This
class replaces the list of typenames to pass as first templates and the need to specify the maximal simplicial. So
<MyVertex, MyEdge, MyFace becomes <MyUsedTypes<
and
VertexSimp2 becomes Vertex
[vcg::Use] : an auxiliary class to give a simple way to specify the role of a type
Note 2: the order of templates parameters to vcg::UsedTypes is unimportant, e.g:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyVertex>::AsVertexType,
vcg::Use<MyEdge>::AsEdgeType,
vcg::Use<MyFace>::AsFaceType>{};
is the same as:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyFace>::AsFaceType,
vcg::Use<MyEdge>::AsEdgeType,
vcg::Use<MyVertex>::AsVertexType>{};
Note 3: you only need to specify the type you use. If you do not have edges you do not need
to include vcg::Use<MyEdge>::AsEdgeType in the template list of UsedTypes.
==== the Part II will be a tiny change to the class TriMesh it self.
2010-03-15 11:42:52 +01:00
|
|
|
#include <vcg/complex/used_types.h>
|
2010-03-19 18:13:31 +01:00
|
|
|
#include <vcg/container/derivation_chain.h>
|
[ Changes in definition of TriMesh: PART I ]
Note for the developers: the change to make to existing projects is very little
but strictly necessary to compile. This change IS NOT backward compliant.
==== OLD ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;
class MyVertex: public VertexSimp2 < MyVertex, MyEdge, MyFace, vertex::Coord3f,...other components>{};
class MyFace: public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};
==== NEW ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;
// declaration of which types is used as VertexType, which type is used as FaceType and so on...
class MyUsedTypes: public vcg::UsedType < vcg::Use<MyVertex>::AsVertexType,
vcg::Use<MyFace>::AsFaceType>{};
class MyVertex: public Vertex < MyUsedTypes, vertex::Coord3f,...other components>{};
class MyFace: public Face < MyUsedTypes, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};
===== classes introduced
[vcg::UsedType] : it is a class containing all the types that must be passed to the definition of Vertex, Face, Edge... This
class replaces the list of typenames to pass as first templates and the need to specify the maximal simplicial. So
<MyVertex, MyEdge, MyFace becomes <MyUsedTypes<
and
VertexSimp2 becomes Vertex
[vcg::Use] : an auxiliary class to give a simple way to specify the role of a type
Note 2: the order of templates parameters to vcg::UsedTypes is unimportant, e.g:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyVertex>::AsVertexType,
vcg::Use<MyEdge>::AsEdgeType,
vcg::Use<MyFace>::AsFaceType>{};
is the same as:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyFace>::AsFaceType,
vcg::Use<MyEdge>::AsEdgeType,
vcg::Use<MyVertex>::AsVertexType>{};
Note 3: you only need to specify the type you use. If you do not have edges you do not need
to include vcg::Use<MyEdge>::AsEdgeType in the template list of UsedTypes.
==== the Part II will be a tiny change to the class TriMesh it self.
2010-03-15 11:42:52 +01:00
|
|
|
|
2010-06-16 17:18:39 +02:00
|
|
|
|
2004-03-04 01:08:15 +01:00
|
|
|
|
|
|
|
#ifndef __VCG_MESH
|
|
|
|
#define __VCG_MESH
|
|
|
|
|
|
|
|
namespace vcg {
|
|
|
|
namespace tri {
|
2004-03-18 17:00:10 +01:00
|
|
|
/** \addtogroup trimesh */
|
|
|
|
/*@{*/
|
2004-10-28 02:56:44 +02:00
|
|
|
/*@{*/
|
2004-03-04 01:08:15 +01:00
|
|
|
/** Class Mesh.
|
|
|
|
This is class for definition of a mesh.
|
2004-10-28 02:56:44 +02:00
|
|
|
@param VertContainerType (Template Parameter) Specifies the type of the vertices container any the vertex type.
|
2010-03-25 17:50:28 +01:00
|
|
|
@param FaceContainer (Template Parameter) Specifies the type of the faces container any the face type.
|
2004-03-04 01:08:15 +01:00
|
|
|
*/
|
2008-11-12 16:51:01 +01:00
|
|
|
|
2008-11-27 19:01:07 +01:00
|
|
|
|
2010-03-19 18:13:31 +01:00
|
|
|
/* MeshTypeHolder is a class which is used to define the types in the mesh
|
|
|
|
*/
|
|
|
|
|
|
|
|
template <class TYPESPOOL>
|
|
|
|
struct BaseMeshTypeHolder{
|
|
|
|
|
|
|
|
typedef bool ScalarType;
|
2010-06-16 17:18:39 +02:00
|
|
|
typedef std::vector< typename TYPESPOOL::VertexType > CONTV;
|
|
|
|
typedef std::vector< typename TYPESPOOL::EdgeType > CONTE;
|
|
|
|
typedef std::vector< typename TYPESPOOL::FaceType > CONTF;
|
|
|
|
typedef std::vector< typename TYPESPOOL::HEdgeType > CONTH;
|
|
|
|
|
|
|
|
typedef CONTV VertContainer;
|
|
|
|
typedef _Vertex VertexType;
|
|
|
|
typedef typename TYPESPOOL::VertexPointer VertexPointer;
|
|
|
|
typedef const typename TYPESPOOL::VertexPointer ConstVertexPointer;
|
|
|
|
typedef bool CoordType;
|
2010-03-19 18:13:31 +01:00
|
|
|
typedef typename CONTV::iterator VertexIterator;
|
|
|
|
typedef typename CONTV::const_iterator ConstVertexIterator;
|
|
|
|
|
2010-06-16 17:18:39 +02:00
|
|
|
typedef CONTE EdgeContainer;
|
|
|
|
typedef typename CONTE::value_type EdgeType;
|
|
|
|
typedef typename TYPESPOOL::EdgePointer EdgePointer;
|
2010-03-19 18:13:31 +01:00
|
|
|
typedef typename CONTE::iterator EdgeIterator;
|
|
|
|
typedef typename CONTE::const_iterator ConstEdgeIterator;
|
|
|
|
|
|
|
|
typedef CONTF FaceContainer;
|
2010-06-16 17:18:39 +02:00
|
|
|
typedef typename CONTF::value_type FaceType;
|
|
|
|
typedef typename CONTF::const_iterator ConstFaceIterator;
|
|
|
|
typedef typename CONTF::iterator FaceIterator;
|
|
|
|
typedef typename TYPESPOOL::FacePointer FacePointer;
|
|
|
|
typedef const typename TYPESPOOL::FacePointer ConstFacePointer;
|
2010-03-19 18:13:31 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
typedef CONTH HEdgeContainer;
|
|
|
|
typedef typename CONTH::value_type HEdgeType;
|
2010-06-16 17:18:39 +02:00
|
|
|
typedef typename TYPESPOOL::HEdgePointer HEdgePointer;
|
2010-03-25 17:50:28 +01:00
|
|
|
typedef typename CONTH::iterator HEdgeIterator;
|
|
|
|
typedef typename CONTH::const_iterator ConstHEdgeIterator;
|
2010-03-19 18:13:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <class T, typename CONT, class TRAIT >
|
|
|
|
struct MeshTypeHolder: public T {};
|
|
|
|
|
|
|
|
template <class T, typename CONT>
|
|
|
|
struct MeshTypeHolder<T, CONT, AllTypes::AVertexType>: public T {
|
|
|
|
typedef CONT VertContainer;
|
|
|
|
typedef typename VertContainer::value_type VertexType;
|
|
|
|
typedef VertexType * VertexPointer;
|
|
|
|
typedef const VertexType * ConstVertexPointer;
|
|
|
|
typedef typename VertexType::ScalarType ScalarType;
|
|
|
|
typedef typename VertexType::CoordType CoordType;
|
|
|
|
typedef typename VertContainer::iterator VertexIterator;
|
|
|
|
typedef typename VertContainer::const_iterator ConstVertexIterator;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
template <typename T, class CONT>
|
|
|
|
struct MeshTypeHolder< T, CONT, AllTypes::AEdgeType>: public T{
|
|
|
|
typedef CONT EdgeContainer;
|
|
|
|
typedef typename EdgeContainer::value_type EdgeType;
|
|
|
|
typedef typename EdgeContainer::value_type * EdgePointer;
|
|
|
|
typedef typename EdgeContainer::iterator EdgeIterator;
|
|
|
|
typedef typename EdgeContainer::const_iterator ConstEdgeIterator;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T, class CONT>
|
|
|
|
struct MeshTypeHolder< T, CONT, AllTypes::AFaceType>:public T {
|
|
|
|
typedef CONT FaceContainer;
|
|
|
|
typedef typename FaceContainer::value_type FaceType;
|
|
|
|
typedef typename FaceContainer::const_iterator ConstFaceIterator;
|
|
|
|
typedef typename FaceContainer::iterator FaceIterator;
|
|
|
|
typedef FaceType * FacePointer;
|
|
|
|
typedef const FaceType * ConstFacePointer;
|
|
|
|
};
|
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template <typename T, class CONT>
|
|
|
|
struct MeshTypeHolder< T, CONT, AllTypes::AHEdgeType>: public T{
|
|
|
|
typedef CONT HEdgeContainer;
|
|
|
|
typedef typename HEdgeContainer::value_type HEdgeType;
|
|
|
|
typedef typename HEdgeContainer::value_type * HEdgePointer;
|
|
|
|
typedef typename HEdgeContainer::iterator HEdgeIterator;
|
|
|
|
typedef typename HEdgeContainer::const_iterator ConstHEdgeIterator;
|
|
|
|
};
|
|
|
|
|
2010-03-19 18:13:31 +01:00
|
|
|
|
|
|
|
/*struct DummyContainer {};
|
|
|
|
template <class CONT> struct Deriver: public MeshTypeHolder<CONT, typename CONT::value_type::IAm>{};
|
|
|
|
template <> struct Deriver<DummyContainer>{}*/;
|
|
|
|
|
|
|
|
template <typename T, typename CONT> struct Der: public MeshTypeHolder<T,CONT, typename CONT::value_type::IAm>{};
|
|
|
|
struct DummyContainer{struct value_type{ typedef int IAm;}; };
|
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class Container0 = DummyContainer, class Container1 = DummyContainer, class Container2 = DummyContainer, class Container3 = DummyContainer >
|
2010-03-19 18:13:31 +01:00
|
|
|
class TriMesh
|
2010-06-16 17:18:39 +02:00
|
|
|
: public MArity4< BaseMeshTypeHolder<typename Container0::value_type::TypesPool>, Container0, Der ,Container1, Der, Container2, Der, Container3, Der>{
|
2008-11-27 19:01:07 +01:00
|
|
|
public:
|
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
typedef typename TriMesh::ScalarType ScalarType;
|
2010-03-19 18:13:31 +01:00
|
|
|
typedef typename TriMesh::VertContainer VertContainer;
|
|
|
|
typedef typename TriMesh::EdgeContainer EdgeContainer;
|
|
|
|
typedef typename TriMesh::FaceContainer FaceContainer;
|
[ Changes in definition of TriMesh: PART I ]
Note for the developers: the change to make to existing projects is very little
but strictly necessary to compile. This change IS NOT backward compliant.
==== OLD ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;
class MyVertex: public VertexSimp2 < MyVertex, MyEdge, MyFace, vertex::Coord3f,...other components>{};
class MyFace: public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};
==== NEW ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;
// declaration of which types is used as VertexType, which type is used as FaceType and so on...
class MyUsedTypes: public vcg::UsedType < vcg::Use<MyVertex>::AsVertexType,
vcg::Use<MyFace>::AsFaceType>{};
class MyVertex: public Vertex < MyUsedTypes, vertex::Coord3f,...other components>{};
class MyFace: public Face < MyUsedTypes, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};
===== classes introduced
[vcg::UsedType] : it is a class containing all the types that must be passed to the definition of Vertex, Face, Edge... This
class replaces the list of typenames to pass as first templates and the need to specify the maximal simplicial. So
<MyVertex, MyEdge, MyFace becomes <MyUsedTypes<
and
VertexSimp2 becomes Vertex
[vcg::Use] : an auxiliary class to give a simple way to specify the role of a type
Note 2: the order of templates parameters to vcg::UsedTypes is unimportant, e.g:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyVertex>::AsVertexType,
vcg::Use<MyEdge>::AsEdgeType,
vcg::Use<MyFace>::AsFaceType>{};
is the same as:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyFace>::AsFaceType,
vcg::Use<MyEdge>::AsEdgeType,
vcg::Use<MyVertex>::AsVertexType>{};
Note 3: you only need to specify the type you use. If you do not have edges you do not need
to include vcg::Use<MyEdge>::AsEdgeType in the template list of UsedTypes.
==== the Part II will be a tiny change to the class TriMesh it self.
2010-03-15 11:42:52 +01:00
|
|
|
|
2010-03-19 18:13:31 +01:00
|
|
|
// types for vertex
|
2010-03-25 17:50:28 +01:00
|
|
|
typedef typename TriMesh::VertexType VertexType;
|
|
|
|
typedef typename TriMesh::VertexPointer VertexPointer;
|
|
|
|
typedef typename TriMesh::ConstVertexPointer ConstVertexPointer;
|
|
|
|
typedef typename TriMesh::CoordType CoordType;
|
|
|
|
typedef typename TriMesh::VertexIterator VertexIterator;
|
|
|
|
typedef typename TriMesh::ConstVertexIterator ConstVertexIterator;
|
[ Changes in definition of TriMesh: PART I ]
Note for the developers: the change to make to existing projects is very little
but strictly necessary to compile. This change IS NOT backward compliant.
==== OLD ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;
class MyVertex: public VertexSimp2 < MyVertex, MyEdge, MyFace, vertex::Coord3f,...other components>{};
class MyFace: public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};
==== NEW ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;
// declaration of which types is used as VertexType, which type is used as FaceType and so on...
class MyUsedTypes: public vcg::UsedType < vcg::Use<MyVertex>::AsVertexType,
vcg::Use<MyFace>::AsFaceType>{};
class MyVertex: public Vertex < MyUsedTypes, vertex::Coord3f,...other components>{};
class MyFace: public Face < MyUsedTypes, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};
===== classes introduced
[vcg::UsedType] : it is a class containing all the types that must be passed to the definition of Vertex, Face, Edge... This
class replaces the list of typenames to pass as first templates and the need to specify the maximal simplicial. So
<MyVertex, MyEdge, MyFace becomes <MyUsedTypes<
and
VertexSimp2 becomes Vertex
[vcg::Use] : an auxiliary class to give a simple way to specify the role of a type
Note 2: the order of templates parameters to vcg::UsedTypes is unimportant, e.g:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyVertex>::AsVertexType,
vcg::Use<MyEdge>::AsEdgeType,
vcg::Use<MyFace>::AsFaceType>{};
is the same as:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyFace>::AsFaceType,
vcg::Use<MyEdge>::AsEdgeType,
vcg::Use<MyVertex>::AsVertexType>{};
Note 3: you only need to specify the type you use. If you do not have edges you do not need
to include vcg::Use<MyEdge>::AsEdgeType in the template list of UsedTypes.
==== the Part II will be a tiny change to the class TriMesh it self.
2010-03-15 11:42:52 +01:00
|
|
|
|
2010-03-19 18:13:31 +01:00
|
|
|
// types for edge
|
2010-03-25 17:50:28 +01:00
|
|
|
typedef typename TriMesh::EdgeType EdgeType;
|
|
|
|
typedef typename TriMesh::EdgePointer EdgePointer;
|
|
|
|
typedef typename TriMesh::EdgeIterator EdgeIterator;
|
|
|
|
typedef typename TriMesh::ConstEdgeIterator ConstEdgeIterator;
|
[ Changes in definition of TriMesh: PART I ]
Note for the developers: the change to make to existing projects is very little
but strictly necessary to compile. This change IS NOT backward compliant.
==== OLD ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;
class MyVertex: public VertexSimp2 < MyVertex, MyEdge, MyFace, vertex::Coord3f,...other components>{};
class MyFace: public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};
==== NEW ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;
// declaration of which types is used as VertexType, which type is used as FaceType and so on...
class MyUsedTypes: public vcg::UsedType < vcg::Use<MyVertex>::AsVertexType,
vcg::Use<MyFace>::AsFaceType>{};
class MyVertex: public Vertex < MyUsedTypes, vertex::Coord3f,...other components>{};
class MyFace: public Face < MyUsedTypes, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};
===== classes introduced
[vcg::UsedType] : it is a class containing all the types that must be passed to the definition of Vertex, Face, Edge... This
class replaces the list of typenames to pass as first templates and the need to specify the maximal simplicial. So
<MyVertex, MyEdge, MyFace becomes <MyUsedTypes<
and
VertexSimp2 becomes Vertex
[vcg::Use] : an auxiliary class to give a simple way to specify the role of a type
Note 2: the order of templates parameters to vcg::UsedTypes is unimportant, e.g:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyVertex>::AsVertexType,
vcg::Use<MyEdge>::AsEdgeType,
vcg::Use<MyFace>::AsFaceType>{};
is the same as:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyFace>::AsFaceType,
vcg::Use<MyEdge>::AsEdgeType,
vcg::Use<MyVertex>::AsVertexType>{};
Note 3: you only need to specify the type you use. If you do not have edges you do not need
to include vcg::Use<MyEdge>::AsEdgeType in the template list of UsedTypes.
==== the Part II will be a tiny change to the class TriMesh it self.
2010-03-15 11:42:52 +01:00
|
|
|
|
2010-03-19 18:13:31 +01:00
|
|
|
//types for face
|
2010-03-25 17:50:28 +01:00
|
|
|
typedef typename TriMesh::FaceType FaceType;
|
|
|
|
typedef typename TriMesh::ConstFaceIterator ConstFaceIterator;
|
|
|
|
typedef typename TriMesh::FaceIterator FaceIterator;
|
|
|
|
typedef typename TriMesh::FacePointer FacePointer;
|
|
|
|
typedef typename TriMesh::ConstFacePointer ConstFacePointer;
|
2008-11-27 19:01:07 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
// types for hedge
|
|
|
|
typedef typename TriMesh::HEdgeType HEdgeType;
|
|
|
|
typedef typename TriMesh::HEdgePointer HEdgePointer;
|
|
|
|
typedef typename TriMesh::HEdgeIterator HEdgeIterator;
|
|
|
|
typedef typename TriMesh::HEdgeContainer HEdgeContainer;
|
|
|
|
typedef typename TriMesh::ConstHEdgeIterator ConstHEdgeIterator;
|
2008-11-27 19:01:07 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
typedef TriMesh<Container0, Container1,Container2,Container3> MeshType;
|
2008-11-27 19:01:07 +01:00
|
|
|
|
2004-03-04 01:08:15 +01:00
|
|
|
typedef Box3<ScalarType> BoxType;
|
|
|
|
|
|
|
|
/// Set of vertices
|
|
|
|
VertContainer vert;
|
2008-11-12 16:51:01 +01:00
|
|
|
/// Actual number of vertices
|
2004-03-04 01:08:15 +01:00
|
|
|
int vn;
|
|
|
|
/// Set of faces
|
|
|
|
FaceContainer face;
|
2008-11-12 16:51:01 +01:00
|
|
|
/// Actual number of faces
|
2004-03-04 01:08:15 +01:00
|
|
|
int fn;
|
2008-11-12 16:51:01 +01:00
|
|
|
/// Set of edges
|
|
|
|
EdgeContainer edge;
|
2010-03-25 17:50:28 +01:00
|
|
|
/// Actual number of edges
|
2008-11-12 16:51:01 +01:00
|
|
|
int en;
|
2010-03-25 17:50:28 +01:00
|
|
|
/// Set of hedges
|
|
|
|
HEdgeContainer hedge;
|
|
|
|
/// Actual number of hedges
|
|
|
|
int hn;
|
2004-03-04 01:08:15 +01:00
|
|
|
/// Bounding box of the mesh
|
|
|
|
Box3<ScalarType> bbox;
|
|
|
|
|
|
|
|
/// Nomi di textures
|
2005-11-16 23:35:47 +01:00
|
|
|
//
|
|
|
|
std::vector<std::string> textures;
|
|
|
|
//
|
|
|
|
std::vector<std::string> normalmaps;
|
2004-03-04 01:08:15 +01:00
|
|
|
|
2009-01-15 18:41:59 +01:00
|
|
|
int attrn; // total numer of attribute created
|
|
|
|
|
2009-07-29 14:46:46 +02:00
|
|
|
class PointerToAttribute{
|
2008-05-15 18:32:27 +02:00
|
|
|
public:
|
2010-06-16 17:18:39 +02:00
|
|
|
void * _handle; // pointer to the SimpleTempData that stores the attribute
|
|
|
|
std::string _name; // name of the attribute
|
|
|
|
std::string _typename; // name as returned by the rtti
|
|
|
|
int _sizeof; // size of the attribute type (used only with VMI loading)
|
|
|
|
int _padding; // padding (used only with VMI loading)
|
2009-07-29 14:46:46 +02:00
|
|
|
|
|
|
|
int n_attr; // unique ID of the attribute
|
2008-05-15 18:32:27 +02:00
|
|
|
void Resize(const int & sz){((SimpleTempDataBase<VertContainer>*)_handle)->Resize(sz);}
|
|
|
|
void Reorder(std::vector<size_t> & newVertIndex){((SimpleTempDataBase<VertContainer>*)_handle)->Reorder(newVertIndex);}
|
2009-07-29 14:46:46 +02:00
|
|
|
bool operator<(const PointerToAttribute b) const { return(_name.empty()&&b._name.empty())?(_handle < b._handle):( _name < b._name);}
|
2008-05-15 18:32:27 +02:00
|
|
|
};
|
|
|
|
|
2009-07-29 14:46:46 +02:00
|
|
|
std::set< PointerToAttribute > vert_attr;
|
|
|
|
std::set< PointerToAttribute > edge_attr;
|
|
|
|
std::set< PointerToAttribute > face_attr;
|
|
|
|
std::set< PointerToAttribute > mesh_attr;
|
2009-01-15 18:41:59 +01:00
|
|
|
|
2009-06-04 18:08:15 +02:00
|
|
|
|
|
|
|
template <class ATTR_TYPE, class CONT>
|
|
|
|
class AttributeHandle{
|
2008-05-15 18:32:27 +02:00
|
|
|
public:
|
2009-06-04 18:08:15 +02:00
|
|
|
AttributeHandle(){_handle=(SimpleTempData<CONT,ATTR_TYPE> *)NULL;}
|
|
|
|
AttributeHandle( void *ah,const int & n):_handle ( (SimpleTempData<CONT,ATTR_TYPE> *)ah ),n_attr(n){}
|
|
|
|
AttributeHandle operator = ( const CONT & pva){
|
|
|
|
_handle = (SimpleTempData<CONT,ATTR_TYPE> *)pva._handle;
|
2009-01-15 18:41:59 +01:00
|
|
|
n_attr = pva.n_attr;
|
2009-01-19 13:57:47 +01:00
|
|
|
return (*this);
|
2009-01-15 18:41:59 +01:00
|
|
|
}
|
2009-07-29 14:46:46 +02:00
|
|
|
|
|
|
|
//pointer to the SimpleTempData that stores the attribute
|
2009-06-04 18:08:15 +02:00
|
|
|
SimpleTempData<CONT,ATTR_TYPE> * _handle;
|
2009-07-29 14:46:46 +02:00
|
|
|
|
|
|
|
// its attribute number
|
|
|
|
int n_attr;
|
|
|
|
|
|
|
|
// access function
|
2008-05-15 18:32:27 +02:00
|
|
|
template <class RefType>
|
|
|
|
ATTR_TYPE & operator [](const RefType & i){return (*_handle)[i];}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <class ATTR_TYPE>
|
2009-06-04 18:08:15 +02:00
|
|
|
class PerVertexAttributeHandle: public AttributeHandle<ATTR_TYPE,VertContainer>{
|
2009-06-07 10:55:44 +02:00
|
|
|
public:
|
2009-06-04 18:08:15 +02:00
|
|
|
PerVertexAttributeHandle():AttributeHandle<ATTR_TYPE,VertContainer>(){}
|
2009-06-07 10:55:44 +02:00
|
|
|
PerVertexAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,VertContainer>(ah,n){};
|
2008-05-15 18:32:27 +02:00
|
|
|
};
|
|
|
|
|
2008-11-12 16:51:01 +01:00
|
|
|
template <class ATTR_TYPE>
|
2009-06-04 18:08:15 +02:00
|
|
|
class PerFaceAttributeHandle: public AttributeHandle<ATTR_TYPE,FaceContainer>{
|
2009-06-07 10:55:44 +02:00
|
|
|
public:
|
2009-06-04 18:08:15 +02:00
|
|
|
PerFaceAttributeHandle():AttributeHandle<ATTR_TYPE,FaceContainer>(){}
|
2009-06-07 10:55:44 +02:00
|
|
|
PerFaceAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,FaceContainer>(ah,n){};
|
2009-06-04 18:08:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
template <class ATTR_TYPE>
|
|
|
|
class PerEdgeAttributeHandle: public AttributeHandle<ATTR_TYPE,EdgeContainer>{
|
2009-06-07 10:55:44 +02:00
|
|
|
public:
|
2009-06-04 18:08:15 +02:00
|
|
|
PerEdgeAttributeHandle():AttributeHandle<ATTR_TYPE,EdgeContainer>(){}
|
2009-06-07 10:55:44 +02:00
|
|
|
PerEdgeAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,EdgeContainer>(ah,n){};
|
2008-11-12 16:51:01 +01:00
|
|
|
};
|
|
|
|
|
2008-06-23 16:18:13 +02:00
|
|
|
template <class ATTR_TYPE>
|
|
|
|
class PerMeshAttributeHandle{
|
|
|
|
public:
|
2009-01-15 18:41:59 +01:00
|
|
|
PerMeshAttributeHandle(){_handle=NULL;}
|
|
|
|
PerMeshAttributeHandle(void *ah,const int & n):_handle ( (Attribute<ATTR_TYPE> *)ah ),n_attr(n){}
|
|
|
|
PerMeshAttributeHandle operator = ( const PerMeshAttributeHandle & pva){
|
2009-01-19 13:57:47 +01:00
|
|
|
_handle = (Attribute<ATTR_TYPE> *)pva._handle;
|
2009-01-15 18:41:59 +01:00
|
|
|
n_attr = pva.n_attr;
|
2009-01-19 13:57:47 +01:00
|
|
|
return (*this);
|
2009-01-15 18:41:59 +01:00
|
|
|
}
|
2008-06-23 16:18:13 +02:00
|
|
|
Attribute<ATTR_TYPE> * _handle;
|
2009-01-15 18:41:59 +01:00
|
|
|
int n_attr;
|
2008-06-23 16:18:13 +02:00
|
|
|
ATTR_TYPE & operator ()(){ return *((Attribute<ATTR_TYPE> *)_handle)->attribute;}
|
|
|
|
};
|
2008-05-15 18:32:27 +02:00
|
|
|
|
2009-05-22 01:02:48 +02:00
|
|
|
// the camera member (that should keep the intrinsics) is no more needed since 2006, when intrisncs moved into the Shot structure
|
|
|
|
//Camera<ScalarType> camera; // intrinsic
|
|
|
|
Shot<ScalarType> shot; // intrinsic && extrinsic
|
2004-03-04 01:08:15 +01:00
|
|
|
|
|
|
|
private:
|
2009-06-23 22:43:39 +02:00
|
|
|
/// The per-mesh color. Not very useful and meaningful...
|
2004-03-04 01:08:15 +01:00
|
|
|
Color4b c;
|
|
|
|
public:
|
|
|
|
|
|
|
|
inline const Color4b & C() const
|
|
|
|
{
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline Color4b & C()
|
|
|
|
{
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Default constructor
|
2009-05-22 01:02:48 +02:00
|
|
|
TriMesh()
|
2004-03-04 01:08:15 +01:00
|
|
|
{
|
|
|
|
fn = vn = 0;
|
|
|
|
imark = 0;
|
2009-01-15 18:41:59 +01:00
|
|
|
attrn = 0;
|
2009-06-23 22:43:39 +02:00
|
|
|
C()=Color4b::Gray;
|
2004-03-04 01:08:15 +01:00
|
|
|
}
|
|
|
|
|
2008-05-16 12:07:36 +02:00
|
|
|
/// destructor
|
|
|
|
~TriMesh()
|
|
|
|
{
|
2009-07-29 14:46:46 +02:00
|
|
|
typename std::set< PointerToAttribute>::iterator i;
|
2008-05-16 12:07:36 +02:00
|
|
|
for( i = vert_attr.begin(); i != vert_attr.end(); ++i)
|
|
|
|
delete ((SimpleTempDataBase<VertContainer>*)(*i)._handle);
|
2010-06-16 17:18:39 +02:00
|
|
|
for( i = edge_attr.begin(); i != edge_attr.end(); ++i)
|
|
|
|
delete ((SimpleTempDataBase<EdgeContainer>*)(*i)._handle);
|
|
|
|
for( i = face_attr.begin(); i != face_attr.end(); ++i)
|
2008-05-16 12:07:36 +02:00
|
|
|
delete ((SimpleTempDataBase<FaceContainer>*)(*i)._handle);
|
2008-06-23 16:18:13 +02:00
|
|
|
for( i = mesh_attr.begin(); i != mesh_attr.end(); ++i)
|
|
|
|
delete ((AttributeBase*)(*i)._handle);
|
2008-10-08 11:10:53 +02:00
|
|
|
|
|
|
|
FaceIterator fi;
|
|
|
|
for(fi = face.begin(); fi != face.end(); ++fi) (*fi).Dealloc();
|
2008-05-16 12:07:36 +02:00
|
|
|
}
|
|
|
|
|
2008-06-23 16:18:13 +02:00
|
|
|
int Mem(const int & nv, const int & nf) const {
|
2009-07-29 14:46:46 +02:00
|
|
|
typename std::set< PointerToAttribute>::const_iterator i;
|
2008-06-23 16:18:13 +02:00
|
|
|
int size = 0;
|
|
|
|
size += sizeof(TriMesh)+sizeof(VertexType)*nv+sizeof(FaceType)*nf;
|
2004-03-04 01:08:15 +01:00
|
|
|
|
2008-06-23 16:18:13 +02:00
|
|
|
for( i = vert_attr.begin(); i != vert_attr.end(); ++i)
|
|
|
|
size += ((SimpleTempDataBase<VertContainer>*)(*i)._handle)->SizeOf()*nv;
|
2010-06-16 17:18:39 +02:00
|
|
|
for( i = edge_attr.begin(); i != edge_attr.end(); ++i)
|
|
|
|
size += ((SimpleTempDataBase<EdgeContainer>*)(*i)._handle)->SizeOf()*en;
|
|
|
|
for( i = face_attr.begin(); i != face_attr.end(); ++i)
|
2008-06-23 16:18:13 +02:00
|
|
|
size += ((SimpleTempDataBase<FaceContainer>*)(*i)._handle)->SizeOf()*nf;
|
|
|
|
for( i = mesh_attr.begin(); i != mesh_attr.end(); ++i)
|
|
|
|
size += ((AttributeBase*)(*i)._handle)->SizeOf();
|
|
|
|
|
|
|
|
return size;
|
2004-03-04 01:08:15 +01:00
|
|
|
}
|
2008-06-23 16:18:13 +02:00
|
|
|
int MemUsed() const {return Mem(vert.size(),face.size());}
|
|
|
|
inline int MemNeeded() const {return Mem(vn,fn);}
|
2004-03-04 01:08:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Function to destroy the mesh
|
|
|
|
void Clear()
|
|
|
|
{
|
|
|
|
vert.clear();
|
|
|
|
face.clear();
|
|
|
|
// textures.clear();
|
|
|
|
// normalmaps.clear();
|
|
|
|
vn = 0;
|
|
|
|
fn = 0;
|
|
|
|
}
|
|
|
|
|
2004-03-07 22:54:56 +01:00
|
|
|
/// Reflection functions that speak about vertex and face properties.
|
2004-03-04 01:08:15 +01:00
|
|
|
static bool HasPerVertexNormal() { return VertexType::HasNormal() ; }
|
|
|
|
static bool HasPerVertexColor() { return VertexType::HasColor() ; }
|
|
|
|
static bool HasPerVertexMark() { return VertexType::HasMark() ; }
|
|
|
|
static bool HasPerVertexQuality() { return VertexType::HasQuality(); }
|
2007-03-12 16:42:11 +01:00
|
|
|
static bool HasPerVertexTexCoord(){ return VertexType::HasTexCoord(); }
|
2009-03-19 18:26:26 +01:00
|
|
|
static bool HasPerVertexRadius() { return VertexType::HasRadius(); }
|
|
|
|
static bool HasPerVertexFlags() { return VertexType::HasFlags(); }
|
2004-03-04 01:08:15 +01:00
|
|
|
|
2008-10-08 11:10:53 +02:00
|
|
|
static bool HasPolyInfo() { return FaceType::HasPolyInfo() ; }
|
2004-03-10 02:00:21 +01:00
|
|
|
static bool HasPerFaceColor() { return FaceType::HasFaceColor() ; }
|
|
|
|
static bool HasPerFaceNormal() { return FaceType::HasFaceNormal() ; }
|
2004-03-04 01:08:15 +01:00
|
|
|
static bool HasPerFaceMark() { return FaceType::HasFaceMark() ; }
|
|
|
|
static bool HasPerFaceQuality() { return FaceType::HasFaceQuality(); }
|
2007-02-14 16:31:41 +01:00
|
|
|
static bool HasPerFaceFlags() { return FaceType::HasFlags(); }
|
2004-03-04 01:08:15 +01:00
|
|
|
|
2004-03-10 02:00:21 +01:00
|
|
|
static bool HasPerWedgeColor() { return FaceType::HasWedgeColor() ; }
|
|
|
|
static bool HasPerWedgeNormal() { return FaceType::HasWedgeNormal() ; }
|
2004-03-07 22:54:56 +01:00
|
|
|
static bool HasPerWedgeMark() { return FaceType::HasWedgeMark() ; }
|
|
|
|
static bool HasPerWedgeQuality() { return FaceType::HasWedgeQuality(); }
|
2007-03-12 16:42:11 +01:00
|
|
|
static bool HasPerWedgeTexCoord() { return FaceType::HasWedgeTexCoord(); }
|
2004-03-04 01:08:15 +01:00
|
|
|
|
2004-03-07 22:54:56 +01:00
|
|
|
static bool HasFFTopology() { return FaceType::HasFFAdjacency(); }
|
2005-01-28 18:56:57 +01:00
|
|
|
static bool HasVFTopology() { return ((FaceType::HasVFAdjacency())&&(VertexType::HasVFAdjacency())); }
|
2004-03-04 01:08:15 +01:00
|
|
|
static bool HasTopology() { return HasFFTopology() || HasVFTopology(); }
|
|
|
|
|
2004-07-09 12:18:19 +02:00
|
|
|
int & SimplexNumber(){ return fn;}
|
|
|
|
int & VertexNumber(){ return vn;}
|
2004-03-04 01:08:15 +01:00
|
|
|
|
|
|
|
/// The incremental mark
|
|
|
|
int imark;
|
|
|
|
|
|
|
|
/// Calcolo del volume di una mesh chiusa
|
|
|
|
ScalarType Volume()
|
|
|
|
{
|
2004-03-10 02:00:21 +01:00
|
|
|
FaceIterator fi;
|
2004-03-04 01:08:15 +01:00
|
|
|
int j,k;
|
|
|
|
ScalarType V = 0;
|
2004-03-10 02:00:21 +01:00
|
|
|
CoordType T,N,B;
|
2004-03-04 01:08:15 +01:00
|
|
|
|
2004-03-10 02:00:21 +01:00
|
|
|
for(fi = face.begin(); fi!=face.end(); ++fi)
|
2004-03-04 01:08:15 +01:00
|
|
|
{
|
2004-03-10 02:00:21 +01:00
|
|
|
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();
|
2005-10-03 18:00:08 +02:00
|
|
|
B = ( (*fi).P( k ) - (*fi).P(j) ) ^
|
2004-03-10 02:00:21 +01:00
|
|
|
( (*fi).P((k+1)%3) - (*fi).P(j) ) ;
|
|
|
|
B.Normalize();
|
2005-11-15 13:09:17 +01:00
|
|
|
N = T ^ B;
|
2004-03-10 02:00:21 +01:00
|
|
|
|
|
|
|
CoordType pj = (*fi).P(j);
|
|
|
|
CoordType pk = (*fi).P(k);
|
2004-03-04 01:08:15 +01:00
|
|
|
|
|
|
|
|
2005-11-15 13:09:17 +01:00
|
|
|
V += (pk* T )*(pk*N)*(pk*B);
|
|
|
|
V += (pj*(-T))*(pj*N)*(pj*B);
|
2004-03-10 02:00:21 +01:00
|
|
|
}
|
2004-03-04 01:08:15 +01:00
|
|
|
}
|
2004-03-10 02:00:21 +01:00
|
|
|
return V/6.0;
|
2004-03-04 01:08:15 +01:00
|
|
|
}
|
|
|
|
|
2008-10-28 12:00:30 +01:00
|
|
|
private:
|
|
|
|
// TriMesh cannot be copied. Use Append (see vcg/complex/trimesh/append.h)
|
2008-11-27 19:01:07 +01:00
|
|
|
TriMesh operator =(const TriMesh & m){assert(0);return TriMesh();}
|
2008-10-28 12:00:30 +01:00
|
|
|
TriMesh(const TriMesh & ){}
|
2004-03-04 01:08:15 +01:00
|
|
|
|
|
|
|
}; // end class Mesh
|
2005-11-26 01:16:03 +01:00
|
|
|
|
2010-03-19 18:13:31 +01:00
|
|
|
/// Initialize the imark-system of the faces
|
|
|
|
template <class MeshType> inline void InitFaceIMark(MeshType & m)
|
|
|
|
{
|
|
|
|
typename MeshType::FaceIterator f;
|
|
|
|
|
|
|
|
for(f=m.face.begin();f!=m.face.end();++f)
|
|
|
|
if( !(*f).IsD() && (*f).IsR() && (*f).IsW() )
|
|
|
|
(*f).InitIMark();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Initialize the imark-system of the vertices
|
|
|
|
template <class MeshType> inline void InitVertexIMark(MeshType & m)
|
|
|
|
{
|
|
|
|
typename MeshType::VertexIterator vi;
|
|
|
|
|
|
|
|
for(vi=m.vert.begin();vi!=m.vert.end();++vi)
|
|
|
|
if( !(*vi).IsD() && (*vi).IsRW() )
|
|
|
|
(*vi).InitIMark();
|
|
|
|
}
|
|
|
|
/** Access function to the incremental mark.
|
|
|
|
*/
|
|
|
|
template <class MeshType> inline int & IMark(MeshType & m){return m.imark;}
|
|
|
|
|
|
|
|
/** Check if the vertex incremental mark matches the one of the mesh.
|
|
|
|
@param v Vertex pointer
|
|
|
|
*/
|
|
|
|
template <class MeshType> inline bool IsMarked(MeshType & m, typename MeshType::ConstVertexPointer v ) { return v->IMark() == m.imark; }
|
|
|
|
/** Check if the face incremental mark matches the one of the mesh.
|
|
|
|
@param v Face pointer
|
|
|
|
*/
|
|
|
|
template <class MeshType> inline bool IsMarked( MeshType & m,typename MeshType::ConstFacePointer f ) { return f->IMark() == m.imark; }
|
|
|
|
/** Set the vertex incremental mark of the vertex to the one of the mesh.
|
|
|
|
@param v Vertex pointer
|
|
|
|
*/
|
|
|
|
template <class MeshType> inline void Mark(MeshType & m, typename MeshType::VertexPointer v ) { v->IMark() = m.imark; }
|
|
|
|
/** Set the face incremental mark of the vertex to the one of the mesh.
|
|
|
|
@param v Vertex pointer
|
|
|
|
*/
|
|
|
|
template <class MeshType> inline void Mark(MeshType & m, typename MeshType::FacePointer f ) { f->IMark() = m.imark; }
|
|
|
|
/// Unmark the mesh
|
|
|
|
template <class MeshType> inline void UnMarkAll(MeshType & m) { ++m.imark; }
|
|
|
|
|
|
|
|
|
2008-11-27 19:01:07 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1 , class ContainerType2, class ContainerType3>
|
|
|
|
bool HasPerVertexQuality (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::VertContainer::value_type::HasQuality();}
|
|
|
|
|
|
|
|
template < class ContainerType0, class ContainerType1 , class ContainerType2, class ContainerType3>
|
|
|
|
bool HasPerVertexMark (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::VertContainer::value_type::HasMark();}
|
|
|
|
|
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasPerVertexCurvature (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::VertContainer::value_type::HasCurvature();}
|
|
|
|
|
|
|
|
template < class ContainerType0, class ContainerType1 , class ContainerType2, class ContainerType3>
|
|
|
|
bool HasPerVertexCurvatureDir (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::VertContainer::value_type::HasCurvatureDir();}
|
2008-11-12 16:51:01 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1 , class ContainerType2, class ContainerType3>
|
|
|
|
bool HasPerVertexColor (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::VertContainer::value_type::HasColor();}
|
2008-12-05 23:45:05 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasPerVertexTexCoord (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::VertContainer::value_type::HasTexCoord();}
|
2008-11-12 16:51:01 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasPerVertexFlags (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::VertContainer::value_type::HasFlags();}
|
2006-11-07 12:29:24 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2, class ContainerType3 >
|
|
|
|
bool HasPerVertexNormal (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::VertContainer::value_type::HasNormal();}
|
2008-10-28 12:00:30 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasPerVertexRadius (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::VertContainer::value_type::HasRadius();}
|
2008-10-28 12:00:30 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasPerWedgeTexCoord (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::FaceContainer::value_type::HasWedgeTexCoord();}
|
2008-02-21 18:27:06 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasPerWedgeNormal (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::FaceContainer::value_type::HasWedgeNormal();}
|
2008-02-21 18:27:06 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasPerWedgeColor (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::FaceContainer::value_type::HasWedgeColor();}
|
2009-03-19 17:22:23 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasPerFaceFlags (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::FaceContainer::value_type::HasFlags();}
|
2007-02-14 16:31:41 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasPerFaceNormal (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::FaceContainer::value_type::HasFaceNormal();}
|
2008-01-28 09:42:07 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasPerFaceColor (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::FaceContainer::value_type::HasFaceColor();}
|
2005-11-26 01:16:03 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasPerFaceMark (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::FaceContainer::value_type::HasMark();}
|
2008-01-28 15:46:03 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasPerFaceQuality (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::FaceContainer::value_type::HasFaceQuality();}
|
2008-01-28 15:46:03 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasFFAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::FaceContainer::value_type::HasFFAdjacency();}
|
2005-12-02 01:05:34 +01:00
|
|
|
|
2010-06-16 17:18:39 +02:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasFEAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::FaceContainer::value_type::HasFEAdjacency();}
|
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasFVAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::FaceContainer::value_type::HasFVAdjacency();}
|
2008-01-28 09:42:07 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasVEAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::VertContainer::value_type::HasVEAdjacency();}
|
2006-05-03 23:35:31 +02:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasVHAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::VertContainer::value_type::HasVHAdjacency();}
|
2005-12-02 01:05:34 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasEVAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::EdgeType::HasEVAdjacency();}
|
2006-05-25 06:40:57 +02:00
|
|
|
|
2010-06-16 17:18:39 +02:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasEEAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::EdgeType::HasEEAdjacency();}
|
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasEFAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::EdgeType::HasEFAdjacency();}
|
2008-11-27 19:01:07 +01:00
|
|
|
|
2010-04-26 17:11:52 +02:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasEHAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::EdgeType::HasEHAdjacency();}
|
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasFHAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::FaceType::HasFHAdjacency();}
|
2008-11-27 19:01:07 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasHVAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::HEdgeType::HasHVAdjacency();}
|
2008-11-27 19:01:07 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasHEAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::HEdgeType::HasHEAdjacency();}
|
2008-11-27 19:01:07 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasHFAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::HEdgeType::HasHFAdjacency();}
|
2008-11-27 19:01:07 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasHNextAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh< ContainerType0, ContainerType1, ContainerType2 , ContainerType3>::HEdgeType::HasHNextAdjacency();}
|
2008-11-27 19:01:07 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasHPrevAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh< ContainerType0, ContainerType1, ContainerType2 , ContainerType3>::HEdgeType::HasHPrevAdjacency();}
|
2008-11-27 19:01:07 +01:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1, class ContainerType2 , class ContainerType3>
|
|
|
|
bool HasHOppAdjacency (const TriMesh < ContainerType0, ContainerType1, ContainerType2, ContainerType3> & /*m*/) {return TriMesh< ContainerType0, ContainerType1, ContainerType2 , ContainerType3>::HEdgeType::HasHOppAdjacency();}
|
2006-10-27 13:08:18 +02:00
|
|
|
|
2010-03-25 17:50:28 +01:00
|
|
|
template < class ContainerType0, class ContainerType1 , class ContainerType2, class ContainerType3>
|
|
|
|
bool HasVFAdjacency (const TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3> & /*m*/) {
|
|
|
|
// gcc 4.4: if the expressions assigned to a1 and a2 are replaced in the assert we get a compilation error
|
|
|
|
// for the macro assert
|
|
|
|
bool a1 = TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::FaceContainer::value_type::HasVFAdjacency();
|
|
|
|
bool a2 = TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::VertContainer::value_type::HasVFAdjacency();
|
2010-05-22 21:47:43 +02:00
|
|
|
// a1 and a2 are still evaluated but not referenced, this causes a warning
|
|
|
|
(void)a1;
|
|
|
|
(void)a2;
|
2010-03-25 17:50:28 +01:00
|
|
|
assert(a1==a2);
|
|
|
|
return TriMesh < ContainerType0 , ContainerType1, ContainerType2, ContainerType3>::FaceContainer::value_type::HasVFAdjacency();
|
2006-11-28 23:35:29 +01:00
|
|
|
}
|
2008-05-15 18:32:27 +02:00
|
|
|
|
|
|
|
template <class MESH_TYPE>
|
|
|
|
bool HasPerVertexAttribute(const MESH_TYPE &m, std::string name){
|
2009-07-29 14:46:46 +02:00
|
|
|
typename std::set< typename MESH_TYPE::PointerToAttribute>::const_iterator ai;
|
|
|
|
typename MESH_TYPE::PointerToAttribute h;
|
2008-05-15 18:32:27 +02:00
|
|
|
h._name = name;
|
|
|
|
ai = m.vert_attr.find(h);
|
|
|
|
return (ai!= m.vert_attr.end() ) ;
|
|
|
|
}
|
|
|
|
template <class MESH_TYPE>
|
|
|
|
bool HasPerFaceAttribute(const MESH_TYPE &m, std::string name){
|
2009-07-29 14:46:46 +02:00
|
|
|
typename std::set< typename MESH_TYPE::PointerToAttribute>::const_iterator ai;
|
|
|
|
typename MESH_TYPE::PointerToAttribute h;
|
2008-05-15 18:32:27 +02:00
|
|
|
h._name = name;
|
|
|
|
ai = m.face_attr.find(h);
|
|
|
|
return (ai!= m.face_attr.end() ) ;
|
|
|
|
}
|
|
|
|
|
2008-06-23 16:18:13 +02:00
|
|
|
template <class MESH_TYPE>
|
|
|
|
bool HasPerMeshAttribute(const MESH_TYPE &m, std::string name){
|
2009-07-29 14:46:46 +02:00
|
|
|
typename std::set< typename MESH_TYPE::PointerToAttribute>::const_iterator ai;
|
|
|
|
typename MESH_TYPE::PointerToAttribute h;
|
2008-06-23 16:18:13 +02:00
|
|
|
h._name = name;
|
|
|
|
ai = m.mesh_attr.find(h);
|
|
|
|
return (ai!= m.mesh_attr.end() ) ;
|
|
|
|
}
|
|
|
|
|
2004-10-28 02:56:44 +02:00
|
|
|
/*@}*/
|
2004-03-18 17:00:10 +01:00
|
|
|
/*@}*/
|
2004-03-04 01:08:15 +01:00
|
|
|
} // end namespace
|
|
|
|
} // end namespace
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|