Added RequireCompactness to the basic exception throwing requirements that you can write at the beginning of an algorithm
This commit is contained in:
parent
4897d75026
commit
2acd02f102
|
@ -38,9 +38,9 @@ public:
|
||||||
|
|
||||||
int n_attr; // unique ID of the attribute
|
int n_attr; // unique ID of the attribute
|
||||||
|
|
||||||
void Resize(const int & sz){((SimpleTempDataBase *)_handle)->Resize(sz);}
|
void Resize(const int & sz){((SimpleTempDataBase *)_handle)->Resize(sz);}
|
||||||
void Reorder(std::vector<size_t> & newVertIndex){((SimpleTempDataBase *)_handle)->Reorder(newVertIndex);}
|
void Reorder(std::vector<size_t> & newVertIndex){((SimpleTempDataBase *)_handle)->Reorder(newVertIndex);}
|
||||||
bool operator<(const PointerToAttribute b) const { return(_name.empty()&&b._name.empty())?(_handle < b._handle):( _name < b._name);}
|
bool operator<(const PointerToAttribute b) const { return(_name.empty()&&b._name.empty())?(_handle < b._handle):( _name < b._name);}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,89 +52,89 @@ namespace tri {
|
||||||
/* MeshTypeHolder is a class which is used to define the types in the mesh
|
/* MeshTypeHolder is a class which is used to define the types in the mesh
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <class TYPESPOOL>
|
template <class TYPESPOOL>
|
||||||
struct BaseMeshTypeHolder{
|
struct BaseMeshTypeHolder{
|
||||||
|
|
||||||
typedef bool ScalarType;
|
typedef bool ScalarType;
|
||||||
typedef std::vector< typename TYPESPOOL::VertexType > CONTV;
|
typedef std::vector< typename TYPESPOOL::VertexType > CONTV;
|
||||||
typedef std::vector< typename TYPESPOOL::EdgeType > CONTE;
|
typedef std::vector< typename TYPESPOOL::EdgeType > CONTE;
|
||||||
typedef std::vector< typename TYPESPOOL::FaceType > CONTF;
|
typedef std::vector< typename TYPESPOOL::FaceType > CONTF;
|
||||||
typedef std::vector< typename TYPESPOOL::HEdgeType > CONTH;
|
typedef std::vector< typename TYPESPOOL::HEdgeType > CONTH;
|
||||||
|
|
||||||
typedef CONTV VertContainer;
|
typedef CONTV VertContainer;
|
||||||
typedef _Vertex VertexType;
|
typedef _Vertex VertexType;
|
||||||
typedef typename TYPESPOOL::VertexPointer VertexPointer;
|
typedef typename TYPESPOOL::VertexPointer VertexPointer;
|
||||||
typedef const typename TYPESPOOL::VertexPointer ConstVertexPointer;
|
typedef const typename TYPESPOOL::VertexPointer ConstVertexPointer;
|
||||||
typedef bool CoordType;
|
typedef bool CoordType;
|
||||||
typedef typename CONTV::iterator VertexIterator;
|
typedef typename CONTV::iterator VertexIterator;
|
||||||
typedef typename CONTV::const_iterator ConstVertexIterator;
|
typedef typename CONTV::const_iterator ConstVertexIterator;
|
||||||
|
|
||||||
typedef CONTE EdgeContainer;
|
typedef CONTE EdgeContainer;
|
||||||
typedef typename CONTE::value_type EdgeType;
|
typedef typename CONTE::value_type EdgeType;
|
||||||
typedef typename TYPESPOOL::EdgePointer EdgePointer;
|
typedef typename TYPESPOOL::EdgePointer EdgePointer;
|
||||||
typedef typename CONTE::iterator EdgeIterator;
|
typedef typename CONTE::iterator EdgeIterator;
|
||||||
typedef typename CONTE::const_iterator ConstEdgeIterator;
|
typedef typename CONTE::const_iterator ConstEdgeIterator;
|
||||||
|
|
||||||
typedef CONTF FaceContainer;
|
typedef CONTF FaceContainer;
|
||||||
typedef typename CONTF::value_type FaceType;
|
typedef typename CONTF::value_type FaceType;
|
||||||
typedef typename CONTF::const_iterator ConstFaceIterator;
|
typedef typename CONTF::const_iterator ConstFaceIterator;
|
||||||
typedef typename CONTF::iterator FaceIterator;
|
typedef typename CONTF::iterator FaceIterator;
|
||||||
typedef typename TYPESPOOL::FacePointer FacePointer;
|
typedef typename TYPESPOOL::FacePointer FacePointer;
|
||||||
typedef const typename TYPESPOOL::FacePointer ConstFacePointer;
|
typedef const typename TYPESPOOL::FacePointer ConstFacePointer;
|
||||||
|
|
||||||
typedef CONTH HEdgeContainer;
|
typedef CONTH HEdgeContainer;
|
||||||
typedef typename CONTH::value_type HEdgeType;
|
typedef typename CONTH::value_type HEdgeType;
|
||||||
typedef typename TYPESPOOL::HEdgePointer HEdgePointer;
|
typedef typename TYPESPOOL::HEdgePointer HEdgePointer;
|
||||||
typedef typename CONTH::iterator HEdgeIterator;
|
typedef typename CONTH::iterator HEdgeIterator;
|
||||||
typedef typename CONTH::const_iterator ConstHEdgeIterator;
|
typedef typename CONTH::const_iterator ConstHEdgeIterator;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class T, typename CONT, class TRAIT >
|
template <class T, typename CONT, class TRAIT >
|
||||||
struct MeshTypeHolder: public T {};
|
struct MeshTypeHolder: public T {};
|
||||||
|
|
||||||
template <class T, typename CONT>
|
template <class T, typename CONT>
|
||||||
struct MeshTypeHolder<T, CONT, AllTypes::AVertexType>: public T {
|
struct MeshTypeHolder<T, CONT, AllTypes::AVertexType>: public T {
|
||||||
typedef CONT VertContainer;
|
typedef CONT VertContainer;
|
||||||
typedef typename VertContainer::value_type VertexType;
|
typedef typename VertContainer::value_type VertexType;
|
||||||
typedef VertexType * VertexPointer;
|
typedef VertexType * VertexPointer;
|
||||||
typedef const VertexType * ConstVertexPointer;
|
typedef const VertexType * ConstVertexPointer;
|
||||||
typedef typename VertexType::ScalarType ScalarType;
|
typedef typename VertexType::ScalarType ScalarType;
|
||||||
typedef typename VertexType::CoordType CoordType;
|
typedef typename VertexType::CoordType CoordType;
|
||||||
typedef typename VertContainer::iterator VertexIterator;
|
typedef typename VertContainer::iterator VertexIterator;
|
||||||
typedef typename VertContainer::const_iterator ConstVertexIterator;
|
typedef typename VertContainer::const_iterator ConstVertexIterator;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <typename T, class CONT>
|
template <typename T, class CONT>
|
||||||
struct MeshTypeHolder< T, CONT, AllTypes::AEdgeType>: public T{
|
struct MeshTypeHolder< T, CONT, AllTypes::AEdgeType>: public T{
|
||||||
typedef CONT EdgeContainer;
|
typedef CONT EdgeContainer;
|
||||||
typedef typename EdgeContainer::value_type EdgeType;
|
typedef typename EdgeContainer::value_type EdgeType;
|
||||||
typedef typename EdgeContainer::value_type * EdgePointer;
|
typedef typename EdgeContainer::value_type * EdgePointer;
|
||||||
typedef typename EdgeContainer::iterator EdgeIterator;
|
typedef typename EdgeContainer::iterator EdgeIterator;
|
||||||
typedef typename EdgeContainer::const_iterator ConstEdgeIterator;
|
typedef typename EdgeContainer::const_iterator ConstEdgeIterator;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, class CONT>
|
template <typename T, class CONT>
|
||||||
struct MeshTypeHolder< T, CONT, AllTypes::AFaceType>:public T {
|
struct MeshTypeHolder< T, CONT, AllTypes::AFaceType>:public T {
|
||||||
typedef CONT FaceContainer;
|
typedef CONT FaceContainer;
|
||||||
typedef typename FaceContainer::value_type FaceType;
|
typedef typename FaceContainer::value_type FaceType;
|
||||||
typedef typename FaceContainer::const_iterator ConstFaceIterator;
|
typedef typename FaceContainer::const_iterator ConstFaceIterator;
|
||||||
typedef typename FaceContainer::iterator FaceIterator;
|
typedef typename FaceContainer::iterator FaceIterator;
|
||||||
typedef FaceType * FacePointer;
|
typedef FaceType * FacePointer;
|
||||||
typedef const FaceType * ConstFacePointer;
|
typedef const FaceType * ConstFacePointer;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, class CONT>
|
template <typename T, class CONT>
|
||||||
struct MeshTypeHolder< T, CONT, AllTypes::AHEdgeType>: public T{
|
struct MeshTypeHolder< T, CONT, AllTypes::AHEdgeType>: public T{
|
||||||
typedef CONT HEdgeContainer;
|
typedef CONT HEdgeContainer;
|
||||||
typedef typename HEdgeContainer::value_type HEdgeType;
|
typedef typename HEdgeContainer::value_type HEdgeType;
|
||||||
typedef typename HEdgeContainer::value_type * HEdgePointer;
|
typedef typename HEdgeContainer::value_type * HEdgePointer;
|
||||||
typedef typename HEdgeContainer::iterator HEdgeIterator;
|
typedef typename HEdgeContainer::iterator HEdgeIterator;
|
||||||
typedef typename HEdgeContainer::const_iterator ConstHEdgeIterator;
|
typedef typename HEdgeContainer::const_iterator ConstHEdgeIterator;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, typename CONT> struct Der: public MeshTypeHolder<T,CONT, typename CONT::value_type::IAm>{};
|
template <typename T, typename CONT> struct Der: public MeshTypeHolder<T,CONT, typename CONT::value_type::IAm>{};
|
||||||
|
@ -146,78 +146,78 @@ As explained in \ref basic_concepts, this class is templated over a list of cont
|
||||||
|
|
||||||
template < class Container0 = DummyContainer, class Container1 = DummyContainer, class Container2 = DummyContainer, class Container3 = DummyContainer >
|
template < class Container0 = DummyContainer, class Container1 = DummyContainer, class Container2 = DummyContainer, class Container3 = DummyContainer >
|
||||||
class TriMesh
|
class TriMesh
|
||||||
: public MArity4< BaseMeshTypeHolder<typename Container0::value_type::TypesPool>, Container0, Der ,Container1, Der, Container2, Der, Container3, Der>{
|
: public MArity4< BaseMeshTypeHolder<typename Container0::value_type::TypesPool>, Container0, Der ,Container1, Der, Container2, Der, Container3, Der>{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef typename TriMesh::ScalarType ScalarType;
|
typedef typename TriMesh::ScalarType ScalarType;
|
||||||
typedef typename TriMesh::VertContainer VertContainer;
|
typedef typename TriMesh::VertContainer VertContainer;
|
||||||
typedef typename TriMesh::EdgeContainer EdgeContainer;
|
typedef typename TriMesh::EdgeContainer EdgeContainer;
|
||||||
typedef typename TriMesh::FaceContainer FaceContainer;
|
typedef typename TriMesh::FaceContainer FaceContainer;
|
||||||
|
|
||||||
// types for vertex
|
// types for vertex
|
||||||
typedef typename TriMesh::VertexType VertexType;
|
typedef typename TriMesh::VertexType VertexType;
|
||||||
typedef typename TriMesh::VertexPointer VertexPointer;
|
typedef typename TriMesh::VertexPointer VertexPointer;
|
||||||
typedef typename TriMesh::ConstVertexPointer ConstVertexPointer;
|
typedef typename TriMesh::ConstVertexPointer ConstVertexPointer;
|
||||||
typedef typename TriMesh::CoordType CoordType;
|
typedef typename TriMesh::CoordType CoordType;
|
||||||
typedef typename TriMesh::VertexIterator VertexIterator;
|
typedef typename TriMesh::VertexIterator VertexIterator;
|
||||||
typedef typename TriMesh::ConstVertexIterator ConstVertexIterator;
|
typedef typename TriMesh::ConstVertexIterator ConstVertexIterator;
|
||||||
|
|
||||||
// types for edge
|
// types for edge
|
||||||
typedef typename TriMesh::EdgeType EdgeType;
|
typedef typename TriMesh::EdgeType EdgeType;
|
||||||
typedef typename TriMesh::EdgePointer EdgePointer;
|
typedef typename TriMesh::EdgePointer EdgePointer;
|
||||||
typedef typename TriMesh::EdgeIterator EdgeIterator;
|
typedef typename TriMesh::EdgeIterator EdgeIterator;
|
||||||
typedef typename TriMesh::ConstEdgeIterator ConstEdgeIterator;
|
typedef typename TriMesh::ConstEdgeIterator ConstEdgeIterator;
|
||||||
|
|
||||||
//types for face
|
//types for face
|
||||||
typedef typename TriMesh::FaceType FaceType;
|
typedef typename TriMesh::FaceType FaceType;
|
||||||
typedef typename TriMesh::ConstFaceIterator ConstFaceIterator;
|
typedef typename TriMesh::ConstFaceIterator ConstFaceIterator;
|
||||||
typedef typename TriMesh::FaceIterator FaceIterator;
|
typedef typename TriMesh::FaceIterator FaceIterator;
|
||||||
typedef typename TriMesh::FacePointer FacePointer;
|
typedef typename TriMesh::FacePointer FacePointer;
|
||||||
typedef typename TriMesh::ConstFacePointer ConstFacePointer;
|
typedef typename TriMesh::ConstFacePointer ConstFacePointer;
|
||||||
|
|
||||||
// types for hedge
|
// types for hedge
|
||||||
typedef typename TriMesh::HEdgeType HEdgeType;
|
typedef typename TriMesh::HEdgeType HEdgeType;
|
||||||
typedef typename TriMesh::HEdgePointer HEdgePointer;
|
typedef typename TriMesh::HEdgePointer HEdgePointer;
|
||||||
typedef typename TriMesh::HEdgeIterator HEdgeIterator;
|
typedef typename TriMesh::HEdgeIterator HEdgeIterator;
|
||||||
typedef typename TriMesh::HEdgeContainer HEdgeContainer;
|
typedef typename TriMesh::HEdgeContainer HEdgeContainer;
|
||||||
typedef typename TriMesh::ConstHEdgeIterator ConstHEdgeIterator;
|
typedef typename TriMesh::ConstHEdgeIterator ConstHEdgeIterator;
|
||||||
|
|
||||||
typedef vcg::PointerToAttribute PointerToAttribute;
|
typedef vcg::PointerToAttribute PointerToAttribute;
|
||||||
|
|
||||||
typedef TriMesh<Container0, Container1,Container2,Container3> MeshType;
|
typedef TriMesh<Container0, Container1,Container2,Container3> MeshType;
|
||||||
|
|
||||||
typedef Box3<ScalarType> BoxType;
|
typedef Box3<ScalarType> BoxType;
|
||||||
|
|
||||||
/// Container of vertices, usually a vector.
|
/// Container of vertices, usually a vector.
|
||||||
VertContainer vert;
|
VertContainer vert;
|
||||||
/// Current number of vertices; this member is for internal use only. You should always use the VN() member
|
/// Current number of vertices; this member is for internal use only. You should always use the VN() member
|
||||||
int vn;
|
int vn;
|
||||||
/// Current number of vertices
|
/// Current number of vertices
|
||||||
inline int VN() const { return vn; }
|
inline int VN() const { return vn; }
|
||||||
|
|
||||||
/// Container of edges, usually a vector.
|
/// Container of edges, usually a vector.
|
||||||
EdgeContainer edge;
|
EdgeContainer edge;
|
||||||
/// Current number of edges; this member is for internal use only. You should always use the EN() member
|
/// Current number of edges; this member is for internal use only. You should always use the EN() member
|
||||||
int en;
|
int en;
|
||||||
/// Current number of edges
|
/// Current number of edges
|
||||||
inline int EN() const { return en; }
|
inline int EN() const { return en; }
|
||||||
|
|
||||||
/// Container of faces, usually a vector.
|
/// Container of faces, usually a vector.
|
||||||
FaceContainer face;
|
FaceContainer face;
|
||||||
/// Current number of faces; this member is for internal use only. You should always use the FN() member
|
/// Current number of faces; this member is for internal use only. You should always use the FN() member
|
||||||
int fn;
|
int fn;
|
||||||
/// Current number of faces
|
/// Current number of faces
|
||||||
inline int FN() const { return fn; }
|
inline int FN() const { return fn; }
|
||||||
|
|
||||||
/// Container of half edges, usually a vector.
|
/// Container of half edges, usually a vector.
|
||||||
HEdgeContainer hedge;
|
HEdgeContainer hedge;
|
||||||
/// Current number of halfedges; this member is for internal use only. You should always use the HN() member
|
/// Current number of halfedges; this member is for internal use only. You should always use the HN() member
|
||||||
int hn;
|
int hn;
|
||||||
/// Current number of halfedges;
|
/// Current number of halfedges;
|
||||||
inline int HN() const { return hn; }
|
inline int HN() const { return hn; }
|
||||||
|
|
||||||
/// Bounding box of the mesh
|
/// Bounding box of the mesh
|
||||||
Box3<ScalarType> bbox;
|
Box3<ScalarType> bbox;
|
||||||
|
|
||||||
/// Nomi di textures
|
/// Nomi di textures
|
||||||
//
|
//
|
||||||
|
@ -235,135 +235,135 @@ class TriMesh
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class ATTR_TYPE, class CONT>
|
template <class ATTR_TYPE, class CONT>
|
||||||
class AttributeHandle{
|
class AttributeHandle{
|
||||||
public:
|
public:
|
||||||
AttributeHandle(){_handle=(SimpleTempData<CONT,ATTR_TYPE> *)NULL;}
|
AttributeHandle(){_handle=(SimpleTempData<CONT,ATTR_TYPE> *)NULL;}
|
||||||
AttributeHandle( void *ah,const int & n):_handle ( (SimpleTempData<CONT,ATTR_TYPE> *)ah ),n_attr(n){}
|
AttributeHandle( void *ah,const int & n):_handle ( (SimpleTempData<CONT,ATTR_TYPE> *)ah ),n_attr(n){}
|
||||||
AttributeHandle operator = ( const PointerToAttribute & pva){
|
AttributeHandle operator = ( const PointerToAttribute & pva){
|
||||||
_handle = (SimpleTempData<CONT,ATTR_TYPE> *)pva._handle;
|
_handle = (SimpleTempData<CONT,ATTR_TYPE> *)pva._handle;
|
||||||
n_attr = pva.n_attr;
|
n_attr = pva.n_attr;
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//pointer to the SimpleTempData that stores the attribute
|
//pointer to the SimpleTempData that stores the attribute
|
||||||
SimpleTempData<CONT,ATTR_TYPE> * _handle;
|
SimpleTempData<CONT,ATTR_TYPE> * _handle;
|
||||||
|
|
||||||
// its attribute number
|
// its attribute number
|
||||||
int n_attr;
|
int n_attr;
|
||||||
|
|
||||||
// access function
|
// access function
|
||||||
template <class RefType>
|
template <class RefType>
|
||||||
ATTR_TYPE & operator [](const RefType & i){return (*_handle)[i];}
|
ATTR_TYPE & operator [](const RefType & i){return (*_handle)[i];}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
class PerVertexAttributeHandle: public AttributeHandle<ATTR_TYPE,VertContainer>{
|
class PerVertexAttributeHandle: public AttributeHandle<ATTR_TYPE,VertContainer>{
|
||||||
public:
|
public:
|
||||||
PerVertexAttributeHandle():AttributeHandle<ATTR_TYPE,VertContainer>(){}
|
PerVertexAttributeHandle():AttributeHandle<ATTR_TYPE,VertContainer>(){}
|
||||||
PerVertexAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,VertContainer>(ah,n){}
|
PerVertexAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,VertContainer>(ah,n){}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
class PerFaceAttributeHandle: public AttributeHandle<ATTR_TYPE,FaceContainer>{
|
class PerFaceAttributeHandle: public AttributeHandle<ATTR_TYPE,FaceContainer>{
|
||||||
public:
|
public:
|
||||||
PerFaceAttributeHandle():AttributeHandle<ATTR_TYPE,FaceContainer>(){}
|
PerFaceAttributeHandle():AttributeHandle<ATTR_TYPE,FaceContainer>(){}
|
||||||
PerFaceAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,FaceContainer>(ah,n){}
|
PerFaceAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,FaceContainer>(ah,n){}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
class PerEdgeAttributeHandle: public AttributeHandle<ATTR_TYPE,EdgeContainer>{
|
class PerEdgeAttributeHandle: public AttributeHandle<ATTR_TYPE,EdgeContainer>{
|
||||||
public:
|
public:
|
||||||
PerEdgeAttributeHandle():AttributeHandle<ATTR_TYPE,EdgeContainer>(){}
|
PerEdgeAttributeHandle():AttributeHandle<ATTR_TYPE,EdgeContainer>(){}
|
||||||
PerEdgeAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,EdgeContainer>(ah,n){}
|
PerEdgeAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,EdgeContainer>(ah,n){}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
class PerMeshAttributeHandle{
|
class PerMeshAttributeHandle{
|
||||||
public:
|
public:
|
||||||
PerMeshAttributeHandle(){_handle=NULL;}
|
PerMeshAttributeHandle(){_handle=NULL;}
|
||||||
PerMeshAttributeHandle(void *ah,const int & n):_handle ( (Attribute<ATTR_TYPE> *)ah ),n_attr(n){}
|
PerMeshAttributeHandle(void *ah,const int & n):_handle ( (Attribute<ATTR_TYPE> *)ah ),n_attr(n){}
|
||||||
PerMeshAttributeHandle operator = ( const PerMeshAttributeHandle & pva){
|
PerMeshAttributeHandle operator = ( const PerMeshAttributeHandle & pva){
|
||||||
_handle = (Attribute<ATTR_TYPE> *)pva._handle;
|
_handle = (Attribute<ATTR_TYPE> *)pva._handle;
|
||||||
n_attr = pva.n_attr;
|
n_attr = pva.n_attr;
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Attribute<ATTR_TYPE> * _handle;
|
Attribute<ATTR_TYPE> * _handle;
|
||||||
int n_attr;
|
int n_attr;
|
||||||
ATTR_TYPE & operator ()(){ return *((Attribute<ATTR_TYPE> *)_handle)->attribute;}
|
ATTR_TYPE & operator ()(){ return *((Attribute<ATTR_TYPE> *)_handle)->attribute;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// the camera member (that should keep the intrinsics) is no more needed since 2006, when intrisncs moved into the Shot structure
|
// 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
|
//Camera<ScalarType> camera; // intrinsic
|
||||||
Shot<ScalarType> shot; // intrinsic && extrinsic
|
Shot<ScalarType> shot; // intrinsic && extrinsic
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The per-mesh color. Not very useful and meaningful...
|
/// The per-mesh color. Not very useful and meaningful...
|
||||||
Color4b c;
|
Color4b c;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
inline const Color4b &C() const { return c; }
|
inline const Color4b &C() const { return c; }
|
||||||
inline Color4b &C() { return c; }
|
inline Color4b &C() { return c; }
|
||||||
inline Color4b cC() const { return c; }
|
inline Color4b cC() const { return c; }
|
||||||
|
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
TriMesh()
|
TriMesh()
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// destructor
|
/// destructor
|
||||||
~TriMesh()
|
~TriMesh()
|
||||||
{
|
{
|
||||||
typename std::set< PointerToAttribute>::iterator i;
|
typename std::set< PointerToAttribute>::iterator i;
|
||||||
for( i = vert_attr.begin(); i != vert_attr.end(); ++i)
|
for( i = vert_attr.begin(); i != vert_attr.end(); ++i)
|
||||||
delete ((SimpleTempDataBase*)(*i)._handle);
|
delete ((SimpleTempDataBase*)(*i)._handle);
|
||||||
for( i = edge_attr.begin(); i != edge_attr.end(); ++i)
|
for( i = edge_attr.begin(); i != edge_attr.end(); ++i)
|
||||||
delete ((SimpleTempDataBase*)(*i)._handle);
|
delete ((SimpleTempDataBase*)(*i)._handle);
|
||||||
for( i = face_attr.begin(); i != face_attr.end(); ++i)
|
for( i = face_attr.begin(); i != face_attr.end(); ++i)
|
||||||
delete ((SimpleTempDataBase*)(*i)._handle);
|
delete ((SimpleTempDataBase*)(*i)._handle);
|
||||||
for( i = mesh_attr.begin(); i != mesh_attr.end(); ++i)
|
for( i = mesh_attr.begin(); i != mesh_attr.end(); ++i)
|
||||||
delete ((SimpleTempDataBase*)(*i)._handle);
|
delete ((SimpleTempDataBase*)(*i)._handle);
|
||||||
|
|
||||||
FaceIterator fi;
|
FaceIterator fi;
|
||||||
for(fi = face.begin(); fi != face.end(); ++fi) (*fi).Dealloc();
|
for(fi = face.begin(); fi != face.end(); ++fi) (*fi).Dealloc();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Mem(const int & nv, const int & nf) const {
|
int Mem(const int & nv, const int & nf) const {
|
||||||
typename std::set< PointerToAttribute>::const_iterator i;
|
typename std::set< PointerToAttribute>::const_iterator i;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
size += sizeof(TriMesh)+sizeof(VertexType)*nv+sizeof(FaceType)*nf;
|
size += sizeof(TriMesh)+sizeof(VertexType)*nv+sizeof(FaceType)*nf;
|
||||||
|
|
||||||
for( i = vert_attr.begin(); i != vert_attr.end(); ++i)
|
for( i = vert_attr.begin(); i != vert_attr.end(); ++i)
|
||||||
size += ((SimpleTempDataBase*)(*i)._handle)->SizeOf()*nv;
|
size += ((SimpleTempDataBase*)(*i)._handle)->SizeOf()*nv;
|
||||||
for( i = edge_attr.begin(); i != edge_attr.end(); ++i)
|
for( i = edge_attr.begin(); i != edge_attr.end(); ++i)
|
||||||
size += ((SimpleTempDataBase*)(*i)._handle)->SizeOf()*en;
|
size += ((SimpleTempDataBase*)(*i)._handle)->SizeOf()*en;
|
||||||
for( i = face_attr.begin(); i != face_attr.end(); ++i)
|
for( i = face_attr.begin(); i != face_attr.end(); ++i)
|
||||||
size += ((SimpleTempDataBase*)(*i)._handle)->SizeOf()*nf;
|
size += ((SimpleTempDataBase*)(*i)._handle)->SizeOf()*nf;
|
||||||
for( i = mesh_attr.begin(); i != mesh_attr.end(); ++i)
|
for( i = mesh_attr.begin(); i != mesh_attr.end(); ++i)
|
||||||
size += ((SimpleTempDataBase*)(*i)._handle)->SizeOf();
|
size += ((SimpleTempDataBase*)(*i)._handle)->SizeOf();
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
int MemUsed() const {return Mem(vert.size(),face.size());}
|
int MemUsed() const {return Mem(vert.size(),face.size());}
|
||||||
inline int MemNeeded() const {return Mem(vn,fn);}
|
inline int MemNeeded() const {return Mem(vn,fn);}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Function to destroy the mesh
|
/// Function to destroy the mesh
|
||||||
void Clear()
|
void Clear()
|
||||||
{
|
{
|
||||||
vert.clear();
|
vert.clear();
|
||||||
face.clear();
|
face.clear();
|
||||||
edge.clear();
|
edge.clear();
|
||||||
// textures.clear();
|
// textures.clear();
|
||||||
// normalmaps.clear();
|
// normalmaps.clear();
|
||||||
vn = 0;
|
vn = 0;
|
||||||
en = 0;
|
en = 0;
|
||||||
fn = 0;
|
fn = 0;
|
||||||
hn = 0;
|
hn = 0;
|
||||||
imark = 0;
|
imark = 0;
|
||||||
attrn = 0;
|
attrn = 0;
|
||||||
C()=Color4b::Gray;
|
C()=Color4b::Gray;
|
||||||
|
@ -386,21 +386,21 @@ private:
|
||||||
/// Initialize the imark-system of the faces
|
/// Initialize the imark-system of the faces
|
||||||
template <class MeshType> inline void InitFaceIMark(MeshType & m)
|
template <class MeshType> inline void InitFaceIMark(MeshType & m)
|
||||||
{
|
{
|
||||||
typename MeshType::FaceIterator f;
|
typename MeshType::FaceIterator f;
|
||||||
|
|
||||||
for(f=m.face.begin();f!=m.face.end();++f)
|
for(f=m.face.begin();f!=m.face.end();++f)
|
||||||
if( !(*f).IsD() && (*f).IsR() && (*f).IsW() )
|
if( !(*f).IsD() && (*f).IsR() && (*f).IsW() )
|
||||||
(*f).InitIMark();
|
(*f).InitIMark();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initialize the imark-system of the vertices
|
/// Initialize the imark-system of the vertices
|
||||||
template <class MeshType> inline void InitVertexIMark(MeshType & m)
|
template <class MeshType> inline void InitVertexIMark(MeshType & m)
|
||||||
{
|
{
|
||||||
typename MeshType::VertexIterator vi;
|
typename MeshType::VertexIterator vi;
|
||||||
|
|
||||||
for(vi=m.vert.begin();vi!=m.vert.end();++vi)
|
for(vi=m.vert.begin();vi!=m.vert.end();++vi)
|
||||||
if( !(*vi).IsD() && (*vi).IsRW() )
|
if( !(*vi).IsD() && (*vi).IsRW() )
|
||||||
(*vi).InitIMark();
|
(*vi).InitIMark();
|
||||||
}
|
}
|
||||||
/** \brief Access function to the incremental mark.
|
/** \brief Access function to the incremental mark.
|
||||||
You should not use this member directly. In most of the case just use IsMarked() and Mark()
|
You should not use this member directly. In most of the case just use IsMarked() and Mark()
|
||||||
|
@ -408,23 +408,23 @@ template <class MeshType> inline void InitVertexIMark(MeshType & m)
|
||||||
template <class MeshType> inline int & IMark(MeshType & m){return m.imark;}
|
template <class MeshType> inline int & IMark(MeshType & m){return m.imark;}
|
||||||
|
|
||||||
/** \brief Check if the vertex incremental mark matches the one of the mesh.
|
/** \brief Check if the vertex incremental mark matches the one of the mesh.
|
||||||
@param m the mesh containing the element
|
@param m the mesh containing the element
|
||||||
@param v Vertex pointer */
|
@param v Vertex pointer */
|
||||||
template <class MeshType> inline bool IsMarked(MeshType & m, typename MeshType::ConstVertexPointer v ) { return v->cIMark() == m.imark; }
|
template <class MeshType> inline bool IsMarked(MeshType & m, typename MeshType::ConstVertexPointer v ) { return v->cIMark() == m.imark; }
|
||||||
|
|
||||||
/** \brief Check if the face incremental mark matches the one of the mesh.
|
/** \brief Check if the face incremental mark matches the one of the mesh.
|
||||||
@param m the mesh containing the element
|
@param m the mesh containing the element
|
||||||
@param f Face pointer */
|
@param f Face pointer */
|
||||||
template <class MeshType> inline bool IsMarked( MeshType & m,typename MeshType::ConstFacePointer f ) { return f->cIMark() == m.imark; }
|
template <class MeshType> inline bool IsMarked( MeshType & m,typename MeshType::ConstFacePointer f ) { return f->cIMark() == m.imark; }
|
||||||
|
|
||||||
/** \brief Set the vertex incremental mark of the vertex to the one of the mesh.
|
/** \brief Set the vertex incremental mark of the vertex to the one of the mesh.
|
||||||
@param m the mesh containing the element
|
@param m the mesh containing the element
|
||||||
@param v Vertex pointer */
|
@param v Vertex pointer */
|
||||||
template <class MeshType> inline void Mark(MeshType & m, typename MeshType::VertexPointer v ) { v->IMark() = m.imark; }
|
template <class MeshType> inline void Mark(MeshType & m, typename MeshType::VertexPointer v ) { v->IMark() = m.imark; }
|
||||||
|
|
||||||
/** \brief Set the face incremental mark of the vertex to the one of the mesh.
|
/** \brief Set the face incremental mark of the vertex to the one of the mesh.
|
||||||
@param m the mesh containing the element
|
@param m the mesh containing the element
|
||||||
@param f Vertex pointer */
|
@param f Vertex pointer */
|
||||||
template <class MeshType> inline void Mark(MeshType & m, typename MeshType::FacePointer f ) { f->IMark() = m.imark; }
|
template <class MeshType> inline void Mark(MeshType & m, typename MeshType::FacePointer f ) { f->IMark() = m.imark; }
|
||||||
|
|
||||||
|
|
||||||
|
@ -576,30 +576,35 @@ bool HasHOppAdjacency (const TriMesh < CType0, CType1, CType2, CType3> & /*m*/)
|
||||||
|
|
||||||
template <class MESH_TYPE>
|
template <class MESH_TYPE>
|
||||||
bool HasPerVertexAttribute(const MESH_TYPE &m, std::string name){
|
bool HasPerVertexAttribute(const MESH_TYPE &m, std::string name){
|
||||||
typename std::set< typename MESH_TYPE::PointerToAttribute>::const_iterator ai;
|
typename std::set< typename MESH_TYPE::PointerToAttribute>::const_iterator ai;
|
||||||
typename MESH_TYPE::PointerToAttribute h;
|
typename MESH_TYPE::PointerToAttribute h;
|
||||||
h._name = name;
|
h._name = name;
|
||||||
ai = m.vert_attr.find(h);
|
ai = m.vert_attr.find(h);
|
||||||
return (ai!= m.vert_attr.end() ) ;
|
return (ai!= m.vert_attr.end() ) ;
|
||||||
}
|
}
|
||||||
template <class MESH_TYPE>
|
template <class MESH_TYPE>
|
||||||
bool HasPerFaceAttribute(const MESH_TYPE &m, std::string name){
|
bool HasPerFaceAttribute(const MESH_TYPE &m, std::string name){
|
||||||
typename std::set< typename MESH_TYPE::PointerToAttribute>::const_iterator ai;
|
typename std::set< typename MESH_TYPE::PointerToAttribute>::const_iterator ai;
|
||||||
typename MESH_TYPE::PointerToAttribute h;
|
typename MESH_TYPE::PointerToAttribute h;
|
||||||
h._name = name;
|
h._name = name;
|
||||||
ai = m.face_attr.find(h);
|
ai = m.face_attr.find(h);
|
||||||
return (ai!= m.face_attr.end() ) ;
|
return (ai!= m.face_attr.end() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MESH_TYPE>
|
template <class MESH_TYPE>
|
||||||
bool HasPerMeshAttribute(const MESH_TYPE &m, std::string name){
|
bool HasPerMeshAttribute(const MESH_TYPE &m, std::string name){
|
||||||
typename std::set< typename MESH_TYPE::PointerToAttribute>::const_iterator ai;
|
typename std::set< typename MESH_TYPE::PointerToAttribute>::const_iterator ai;
|
||||||
typename MESH_TYPE::PointerToAttribute h;
|
typename MESH_TYPE::PointerToAttribute h;
|
||||||
h._name = name;
|
h._name = name;
|
||||||
ai = m.mesh_attr.find(h);
|
ai = m.mesh_attr.find(h);
|
||||||
return (ai!= m.mesh_attr.end() ) ;
|
return (ai!= m.mesh_attr.end() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class MeshType> void RequireCompactness (MeshType &m) {
|
||||||
|
if(m.vert.size()!=m.vn) throw vcg::MissingCompactnessException("Vertex Vector Contains deleted elements");
|
||||||
|
if(m.edge.size()!=m.en) throw vcg::MissingCompactnessException("Edge Vector Contains deleted elements");
|
||||||
|
if(m.face.size()!=m.fn) throw vcg::MissingCompactnessException("Face Vector Contains deleted elements");
|
||||||
|
}
|
||||||
|
|
||||||
template <class MeshType> void RequireVFAdjacency (MeshType &m) { if(!tri::HasVFAdjacency (m)) throw vcg::MissingComponentException("VFAdjacency"); }
|
template <class MeshType> void RequireVFAdjacency (MeshType &m) { if(!tri::HasVFAdjacency (m)) throw vcg::MissingComponentException("VFAdjacency"); }
|
||||||
template <class MeshType> void RequireVEAdjacency (MeshType &m) { if(!tri::HasVEAdjacency (m)) throw vcg::MissingComponentException("VEAdjacency"); }
|
template <class MeshType> void RequireVEAdjacency (MeshType &m) { if(!tri::HasVEAdjacency (m)) throw vcg::MissingComponentException("VEAdjacency"); }
|
||||||
|
|
Loading…
Reference in New Issue