*** empty log message ***
This commit is contained in:
parent
00de9443f0
commit
adeca3e96f
|
@ -1,7 +1,32 @@
|
|||
#include <simplex\vertex\with\cn.h>
|
||||
#include <simplex\tetrahedron\base.h>
|
||||
#include <simplex\vertex\with\a.h>
|
||||
#include <simplex\tetrahedron\with\avq.h>
|
||||
#include <simplex\face\with\fa.h>
|
||||
#include <complex\tetramesh\base.h>
|
||||
#include <complex\tetramesh\update\topology.h>
|
||||
#include <complex\tetramesh\update\allocate.h>
|
||||
#include<vector>
|
||||
#include<complex\tetramesh\update\triconvert.h>
|
||||
#include<complex\trimesh\base.h>
|
||||
using namespace vcg;
|
||||
using namespace tetra;
|
||||
using namespace tri;
|
||||
#include<apps\test\tetramesh\test\myclasses.h>
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
|
||||
MyMesh tm=MyMesh();
|
||||
UpdateTopology<vector<MyVertex>,vector<MyTetrahedron> > ut= UpdateTopology<vector<MyVertex>,vector<MyTetrahedron> >();
|
||||
Allocator<MyMesh> All= Allocator<MyMesh>();
|
||||
vector<MyVertex **> local_var=vector<MyVertex **>();
|
||||
char* filename="sphere.ts";
|
||||
tm.LoadTs(filename,1);
|
||||
ut.TTTopology(tm.vert,tm.tetra);
|
||||
ut.TestTTTopology(tm.vert,tm.tetra);
|
||||
ut.VTTopology(tm.vert,tm.tetra);
|
||||
All.AddVertices(tm,10,local_var);
|
||||
All.AddVertices(tm,10);
|
||||
ut.TestTTTopology(tm.vert,tm.tetra);
|
||||
MyTriMesh mesh;
|
||||
TriConverter <MyMesh,MyTriMesh>tric=TriConverter<MyMesh,MyTriMesh>();
|
||||
tric.Convert(tm,mesh);
|
||||
}
|
Binary file not shown.
|
@ -110,12 +110,27 @@
|
|||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc">
|
||||
<File
|
||||
RelativePath="..\..\..\..\vcg\complex\tetramesh\update\allocate.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\vcg\simplex\tetrahedron\base.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\vcg\complex\tetramesh\base.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="myclasses.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\vcg\space\tetra4.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\vcg\complex\tetramesh\update\topology.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\vcg\complex\tetramesh\update\triconvert.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
|
|
|
@ -39,51 +39,40 @@ namespace tetra {
|
|||
|
||||
/** Class Allocate.
|
||||
This is class for Allocate new vertices or tetrahedron on the mesh.
|
||||
@param STL_VERT_CONT (Template Parameter) Specifies the type of the vertices container any the vertex type.
|
||||
@param STL_TETRA_CONT (Template Parameter) Specifies the type of the tetrahedrons container any the tetrahedrons type.
|
||||
@param TM_TYPE (Template Parameter) Specifies the type of the tetrahedral mesh.
|
||||
*/
|
||||
template < class STL_VERT_CONT ,class STL_TETRA_CONT >
|
||||
class Allocate
|
||||
|
||||
template < class TM_TYPE >
|
||||
class Allocator
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/// The vertex container
|
||||
typedef STL_VERT_CONT VertexContainer;
|
||||
|
||||
/// The tethaedhron container
|
||||
typedef STL_TETRA_CONT TetraContainer;
|
||||
/// The tetramesh type
|
||||
typedef TM_TYPE TetraMeshType;
|
||||
|
||||
|
||||
/// The vertex type
|
||||
typedef typename STL_VERT_CONT::value_type VertexType;
|
||||
typedef typename TM_TYPE::VertexType VertexType;
|
||||
|
||||
/// The tetrahedron type
|
||||
typedef typename STL_TETRA_CONT::value_type TetraType;
|
||||
typedef typename TM_TYPE::TetraType TetraType;
|
||||
|
||||
/// The type of vertex iterator
|
||||
typedef typename STL_VERT_CONT::iterator VertexIterator;
|
||||
typedef typename TM_TYPE::VertexIterator VertexIterator;
|
||||
|
||||
/// The type of tetra iterator
|
||||
typedef typename STL_TETRA_CONT::iterator TetraIterator;
|
||||
typedef typename TM_TYPE::TetraIterator TetraIterator;
|
||||
|
||||
/// The type of constant vertex iterator
|
||||
typedef typename STL_VERT_CONT::const_iterator const_VertexIterator;
|
||||
typedef typename TM_TYPE::const_VertexIterator const_VertexIterator;
|
||||
|
||||
/// The type of constant face iterator
|
||||
typedef typename STL_TETRA_CONT::const_iterator const_TetraIterator;
|
||||
typedef typename TM_TYPE::const_TetraIterator const_TetraIterator;
|
||||
|
||||
private:
|
||||
VertexContainer* _vert;
|
||||
TetraContainer* _tetra;
|
||||
|
||||
public:
|
||||
///defaul constructor
|
||||
Allocate(VertexContainer *v,TetraContainer *t)
|
||||
{
|
||||
_vert=v;
|
||||
_tetra=t;
|
||||
}
|
||||
|
||||
|
||||
/** Function to add n vertices to the mesh. The second parameter hold a vector of
|
||||
pointers to pointer to elements of the mesh that should be updated after a
|
||||
possible vector realloc.
|
||||
|
@ -92,30 +81,30 @@ possible vector realloc.
|
|||
restituisce l'iteratore al primo elemento aggiunto.
|
||||
*/
|
||||
|
||||
VertexIterator AddVertices(int n, vector<VertexType **> &local_var)
|
||||
VertexIterator AddVertices(TetraMeshType &m,int n, vector<VertexType **> &local_var)
|
||||
{
|
||||
VertexIterator oldbegin, newbegin;
|
||||
oldbegin = _vert->begin();
|
||||
VertexIterator last=_vert->end();
|
||||
if(_vert->empty()) last=0; // if the vector is empty we cannot find the last valid element
|
||||
oldbegin = m.vert.begin();
|
||||
VertexIterator last=m.vert.end();
|
||||
if(m.vert.empty()) last=0; // if the vector is empty we cannot find the last valid element
|
||||
else --last;
|
||||
unsigned int siz=0;
|
||||
#ifdef __STL_CONFIG_H
|
||||
if(last!=0) distance(_vert->begin(),last,siz);
|
||||
if(last!=0) distance(m.vert.begin(),last,siz);
|
||||
#else
|
||||
if(last!=0) siz=distance(_vert->begin(),last);
|
||||
if(last!=0) siz=distance(m.vert.begin(),last);
|
||||
#endif
|
||||
for(unsigned int i=0; i<n; ++i)
|
||||
{
|
||||
_vert->push_back(VertexType());
|
||||
_vert->back().Supervisor_Flags() = 0;
|
||||
m.vert.push_back(VertexType());
|
||||
m.vert.back().ClearFlags();
|
||||
}
|
||||
vn+=n;
|
||||
newbegin = _vert->begin();
|
||||
m.vn+=n;
|
||||
newbegin = m.vert.begin();
|
||||
if(newbegin != oldbegin)
|
||||
{
|
||||
TetraIterator f;
|
||||
for (f=_tetra->begin(); f!=_tetra->end(); ++f)
|
||||
for (f=m.tetra.begin(); f!=m.tetra.end(); ++f)
|
||||
if(!(*f).IsD())
|
||||
for(unsigned int k=0; k<4; ++k)
|
||||
(*f).V(k)= (*f).V(k)-&*oldbegin+&*newbegin;
|
||||
|
@ -126,15 +115,64 @@ if(last!=0) siz=distance(_vert->begin(),last);
|
|||
// e poiche' lo spazio e' cambiato si ricalcola last da zero
|
||||
if(last!=0)
|
||||
{
|
||||
last = _vert->begin();
|
||||
last = m.vert.begin();
|
||||
advance(last,siz+1);
|
||||
}
|
||||
else last=_vert->begin();
|
||||
else last=m.vert.begin();
|
||||
}
|
||||
else
|
||||
{
|
||||
// se non e'cambiato lo spazio (vector abbastanza grande o lista)
|
||||
if(last==0) last = _vert->begin(); // se il vettore era vuoto si restituisce begin
|
||||
if(last==0) last = m.vert.begin(); // se il vettore era vuoto si restituisce begin
|
||||
else advance(last,1); // altrimenti il primo dopo quello che era in precedenza l'ultimo valido.
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
||||
/** Function to add n vertices to the mesh.
|
||||
@param n Il numero di vertici che si vuole aggiungere alla mesh.
|
||||
*/
|
||||
VertexIterator AddVertices(TetraMeshType &m,int n)
|
||||
{
|
||||
VertexIterator oldbegin, newbegin;
|
||||
oldbegin = m.vert.begin();
|
||||
VertexIterator last=m.vert.end();
|
||||
if(m.vert.empty()) last=0; // if the vector is empty we cannot find the last valid element
|
||||
else --last;
|
||||
unsigned int siz=0;
|
||||
#ifdef __STL_CONFIG_H
|
||||
if(last!=0) distance(m.vert.begin(),last,siz);
|
||||
#else
|
||||
if(last!=0) siz=distance(m.vert.begin(),last);
|
||||
#endif
|
||||
for(unsigned int i=0; i<n; ++i)
|
||||
{
|
||||
m.vert.push_back(VertexType());
|
||||
m.vert.back().ClearFlags();
|
||||
}
|
||||
m.vn+=n;
|
||||
newbegin = m.vert.begin();
|
||||
if(newbegin != oldbegin)
|
||||
{
|
||||
TetraIterator f;
|
||||
for (f=m.tetra.begin(); f!=m.tetra.end(); ++f)
|
||||
if(!(*f).IsD())
|
||||
for(unsigned int k=0; k<4; ++k)
|
||||
(*f).V(k)= (*f).V(k)-&*oldbegin+&*newbegin;
|
||||
|
||||
// deve restituire l'iteratore alla prima faccia aggiunta;
|
||||
// e poiche' lo spazio e' cambiato si ricalcola last da zero
|
||||
if(last!=0)
|
||||
{
|
||||
last = m.vert.begin();
|
||||
advance(last,siz+1);
|
||||
}
|
||||
else last=m.vert.begin();
|
||||
}
|
||||
else
|
||||
{
|
||||
// se non e'cambiato lo spazio (vector abbastanza grande o lista)
|
||||
if(last==0) last = m.vert.begin(); // se il vettore era vuoto si restituisce begin
|
||||
else advance(last,1); // altrimenti il primo dopo quello che era in precedenza l'ultimo valido.
|
||||
}
|
||||
return last;
|
||||
|
|
|
@ -181,36 +181,27 @@ public:
|
|||
/// The type of constant face iterator
|
||||
typedef typename STL_TETRA_CONT::const_iterator const_TetraIterator;
|
||||
|
||||
private:
|
||||
VertexContainer* _vert;
|
||||
TetraContainer* _tetra;
|
||||
|
||||
public:
|
||||
///defaul constructor
|
||||
UpdateTopology(VertexContainer *v,TetraContainer *t)
|
||||
{
|
||||
_vert=v;
|
||||
_tetra=t;
|
||||
}
|
||||
|
||||
/***********************************************/
|
||||
/** @Vertex-Tetrahedron Topology Funtions
|
||||
**/
|
||||
//@{
|
||||
|
||||
///create the VT topology for tetrahedrons that are into containers
|
||||
void VTTopology()
|
||||
void VTTopology(VertexContainer &vert,TetraContainer &tetra)
|
||||
{
|
||||
vertex_iterator v;
|
||||
tetra_iterator t;
|
||||
VertexIterator v;
|
||||
TetraIterator t;
|
||||
|
||||
ClearVTTopology();
|
||||
ClearVTTopology(vert,tetra);
|
||||
|
||||
for(t=_tetra.begin();t!=_tetra.end();++t)
|
||||
for(t=tetra.begin();t!=tetra.end();++t)
|
||||
if( ! (*t).IsD())
|
||||
for(int j=0;j<4;++j)
|
||||
{
|
||||
(*t).tv[j] = (*t).V(j)->Fp();
|
||||
(*t).zv[j] = (*t).V(j)->Zp();
|
||||
(*t).TV(j) = (*t).V(j)->Fp();
|
||||
(*t).ZV(j) = (*t).V(j)->Zp();
|
||||
(*t).V(j)->Fp() = &(*t);
|
||||
(*t).V(j)->Zp() = j;
|
||||
}
|
||||
|
@ -218,17 +209,17 @@ void VTTopology()
|
|||
}
|
||||
|
||||
/// clear the Vertex-Tetra topology
|
||||
void ClearVTTopology()
|
||||
void ClearVTTopology(VertexContainer &vert,TetraContainer &tetra)
|
||||
{
|
||||
vertex_iterator v;
|
||||
for(v=_vert->begin();v!=_vert->end();++v)
|
||||
VertexIterator v;
|
||||
for(v=vert.begin();v!=vert.end();++v)
|
||||
{
|
||||
v->Fp() = 0;
|
||||
v->Zp() = 0;
|
||||
}
|
||||
|
||||
tetra_iterator t;
|
||||
for(t=_tetra->begin();t!=_tetra->end();++t)
|
||||
TetraIterator t;
|
||||
for(t=tetra.begin();t!=tetra.end();++t)
|
||||
for(int j=0;j<4;++j)
|
||||
{
|
||||
(*t).TV(j) = 0;
|
||||
|
@ -303,14 +294,14 @@ void InsertVTTopology(TetraType *t)
|
|||
**/
|
||||
//@{
|
||||
///Build the Tetrahedron-Tetrahedron Topology (by Face)
|
||||
void TTTopology()
|
||||
void TTTopology(VertexContainer &vert,TetraContainer &tetra)
|
||||
{
|
||||
vector <Facet<VertexType,TetraType> > VF;
|
||||
VertexType* v0;
|
||||
VertexType* v1;
|
||||
VertexType* v2;
|
||||
|
||||
for (TetraIterator ti=_tetra->begin();ti!=_tetra->end();ti++)
|
||||
for (TetraIterator ti=tetra.begin();ti!=tetra.end();ti++)
|
||||
{
|
||||
if (!(*ti).IsD())
|
||||
{
|
||||
|
@ -376,14 +367,14 @@ void TTTopology()
|
|||
}
|
||||
|
||||
///Test the Tetrahedron-Tetrahedron Topology (by Face)
|
||||
void TestTTTopology()
|
||||
void TestTTTopology(VertexContainer &vert,TetraContainer &tetra)
|
||||
{
|
||||
int i;
|
||||
for (TetraIterator ti=_tetra->begin();ti!=_tetra->end();ti++)
|
||||
for (TetraIterator ti=tetra.begin();ti!=tetra.end();ti++)
|
||||
{
|
||||
for (i=0;i<4;i++)
|
||||
{
|
||||
if ((!(*ti).IsD())&& ((*ti).T(i)!=&(*ti)))
|
||||
if ((!(*ti).IsD())&&((*ti).T(i)!=&(*ti)))
|
||||
{
|
||||
assert( ((((*ti).T(i))->T((*ti).Z(i)))==&(*ti)));
|
||||
|
||||
|
@ -394,9 +385,9 @@ void TestTTTopology()
|
|||
TetraType *t1=(TetraType*)(*ti).T(i);
|
||||
int z1=(*ti).Z(i);
|
||||
|
||||
VertexType *vo0=(*ti).V(Tetra4<double>::VofF(z1,0));
|
||||
VertexType *vo1=(*ti).V(Tetra4<double>::VofF(z1,1));
|
||||
VertexType *vo2=(*ti).V(Tetra4<double>::VofF(z1,2));
|
||||
VertexType *vo0=(*t1).V(Tetra4<double>::VofF(z1,0));
|
||||
VertexType *vo1=(*t1).V(Tetra4<double>::VofF(z1,1));
|
||||
VertexType *vo2=(*t1).V(Tetra4<double>::VofF(z1,2));
|
||||
|
||||
assert((v0!=v1)&&(v0!=v2)&&(v1!=v2));
|
||||
assert((vo0!=vo1)&&(vo0!=vo2)&&(vo1!=vo2));
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.2 2004/04/20 12:42:37 pietroni
|
||||
*** empty log message ***
|
||||
|
||||
Revision 1.1 2004/04/15 08:54:20 pietroni
|
||||
*** empty log message ***
|
||||
|
||||
|
@ -140,20 +143,7 @@ bool HaveBorderF() {return ((_flags & (BORDERF0 | BORDERF1 | BORDERF2 | BORDERF3
|
|||
/// This function return true if the face is extern.
|
||||
bool IsBorderF(int face) {
|
||||
assert ((face<4)&&(face>-1));
|
||||
switch (face) {
|
||||
case 0:
|
||||
{return ((_flags & BORDERF0) != 0);}
|
||||
break;
|
||||
case 1:
|
||||
{return ((_flags & BORDERF1) != 0);}
|
||||
break;
|
||||
case 2:
|
||||
{return ((_flags & BORDERF2) != 0);}
|
||||
break;
|
||||
case 3:
|
||||
{return ((_flags & BORDERF3) != 0);}
|
||||
break;
|
||||
}
|
||||
return (this->T(face) == this);
|
||||
}
|
||||
//@}
|
||||
|
||||
|
@ -166,18 +156,33 @@ For each Tetrahedron we store 4 pointers to vertex
|
|||
protected:
|
||||
VertexType *_v[4];
|
||||
public:
|
||||
/// The Functions to access a vertex
|
||||
inline VertexType * &V(int index)
|
||||
{
|
||||
return _v[index];
|
||||
|
||||
/** Return the pointer to the j-th vertex of the terahedron.
|
||||
@param j Index of the tetrahedron's vertex.
|
||||
*/
|
||||
inline VertexType * & V( const int j )
|
||||
{
|
||||
assert( (_flags & DELETED) == 0 );
|
||||
assert(j >= 0);
|
||||
assert(j < 4);
|
||||
return _v[j];
|
||||
}
|
||||
/// The Functions to access a vertex
|
||||
inline const VertexType * &V(int index) const
|
||||
{
|
||||
return _v[index];
|
||||
}
|
||||
//@}
|
||||
|
||||
inline const VertexType * const & V( const int j ) const
|
||||
{
|
||||
assert( (_flags & DELETED) == 0 );
|
||||
assert(j>=0);
|
||||
assert(j<4);
|
||||
return _v[j];
|
||||
}
|
||||
|
||||
inline const VertexType * const & cV( const int j ) const
|
||||
{
|
||||
assert( (_flags & DELETED) == 0 );
|
||||
assert(j>=0);
|
||||
assert(j<4);
|
||||
return _v[j];
|
||||
}
|
||||
|
||||
/***********************************************/
|
||||
/** @name Topology Structures
|
||||
|
@ -216,12 +221,12 @@ public:
|
|||
///Function to access the Next Tetrahedron of the list that share the index-face (end of list is Null)
|
||||
TETRA_TYPE *&TV(const int &index)
|
||||
{
|
||||
return t[index];
|
||||
return _tv[index];
|
||||
}
|
||||
///Function to see the index of the Vertex as seen from the next tetrahedron of the list ( end of list is -1)
|
||||
int &ZV(const int &index)
|
||||
short int &ZV(const int &index)
|
||||
{
|
||||
return z[index];
|
||||
return _zv[index];
|
||||
}
|
||||
#endif
|
||||
//@}
|
||||
|
|
|
@ -24,6 +24,12 @@
|
|||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.6 2004/04/23 14:55:06 pietroni
|
||||
conversion funtion
|
||||
|
||||
Revision 1.5 2004/03/10 00:59:06 cignoni
|
||||
minor changes
|
||||
|
||||
Revision 1.4 2004/03/03 16:07:57 cignoni
|
||||
Yet another cr lf mismatch
|
||||
|
||||
|
@ -561,8 +567,29 @@ static bool HasVFAdjacency() {
|
|||
}
|
||||
//@}
|
||||
|
||||
/***********************************************/
|
||||
/** @Conversion to other vertex
|
||||
**/
|
||||
//@{
|
||||
|
||||
template <class VERT_TYPE>
|
||||
inline Convert( const VERT_TYPE &v )
|
||||
{
|
||||
this->P()=v->P();
|
||||
this._flags=v._flags;
|
||||
if (this->HasNormal())&&(v.HasNormal())
|
||||
this->N()=v->N();
|
||||
if (this->HasColor())&&(v.HasColor())
|
||||
this->C()=v->C();
|
||||
if (this->HasMark())&&(v.HasMark())
|
||||
this.IMark()=v.IMark();
|
||||
if (this->HasQuality())&&(v.HasQuality())
|
||||
this->Q()=v->Q();
|
||||
if (this->HasTexture())&&(v.HasTexture())
|
||||
this->T()=v->T();
|
||||
}
|
||||
|
||||
//@}
|
||||
|
||||
enum {
|
||||
// This bit indicate that the vertex is deleted from the mesh
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef __VCGLIB_VERTEX__A__TYPE
|
||||
#define __VCGLIB_VERTEX__A__TYPE
|
||||
|
||||
#define VERTEX_TYPE VertexA
|
||||
|
||||
#define __VCGLIB_VERTEX_A
|
||||
|
||||
#include <vcg/simplex/vertex/base.h>
|
||||
|
||||
#undef VERTEX_TYPE
|
||||
#undef __VCGLIB_VERTEX_A
|
||||
|
||||
namespace vcg {
|
||||
|
||||
template <class VFTYPE>
|
||||
class VertexAf : public VertexA<float,VFTYPE> {};
|
||||
|
||||
template <class VFTYPE>
|
||||
class VertexAd : public VertexA<double,VFTYPE> {};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue