*** empty log message ***
This commit is contained in:
parent
1b3fc69fac
commit
7980702bd2
|
@ -0,0 +1,248 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* 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. *
|
||||||
|
* *
|
||||||
|
****************************************************************************/
|
||||||
|
/****************************************************************************
|
||||||
|
History
|
||||||
|
|
||||||
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.1 2004/04/15 08:54:20 pietroni
|
||||||
|
*** empty log message ***
|
||||||
|
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#pragma warning( disable : 4804 )
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __VCG_TETRAMESH
|
||||||
|
#define __VCG_TETRAMESH
|
||||||
|
#include <space\box3.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace vcg {
|
||||||
|
namespace tetra {
|
||||||
|
/** \addtogroup trimesh */
|
||||||
|
/*@{*/
|
||||||
|
|
||||||
|
/** Class TetraMesh.
|
||||||
|
This is class for definition of a mesh.
|
||||||
|
@param STL_VERT_CONT (Template Parameter) Specifies the type of the vertices container any the vertex type.
|
||||||
|
@param STL_FACE_CONT (Template Parameter) Specifies the type of the faces container any the face type.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
template < class STL_VERT_CONT ,class STL_TETRA_CONT >
|
||||||
|
class Tetramesh{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/***********************************************/
|
||||||
|
/** @name Tetramesh Type Definitions **/
|
||||||
|
//@{
|
||||||
|
|
||||||
|
/// The mesh type
|
||||||
|
typedef Tetramesh<STL_VERT_CONT,STL_TETRA_CONT> TetraMeshType;
|
||||||
|
|
||||||
|
/// The vertex container
|
||||||
|
typedef STL_VERT_CONT VertexContainer;
|
||||||
|
|
||||||
|
/// The tethaedhron container
|
||||||
|
typedef STL_TETRA_CONT TetraContainer;
|
||||||
|
|
||||||
|
/// The vertex type
|
||||||
|
typedef typename STL_VERT_CONT::value_type VertexType;
|
||||||
|
|
||||||
|
/// The tetrahedron type
|
||||||
|
typedef typename STL_TETRA_CONT::value_type TetraType;
|
||||||
|
|
||||||
|
/// The type of vertex iterator
|
||||||
|
typedef typename STL_VERT_CONT::iterator VertexIterator;
|
||||||
|
|
||||||
|
/// The type of tetra iterator
|
||||||
|
typedef typename STL_TETRA_CONT::iterator TetraIterator;
|
||||||
|
|
||||||
|
/// The type of constant vertex iterator
|
||||||
|
typedef typename STL_VERT_CONT::const_iterator const_VertexIterator;
|
||||||
|
|
||||||
|
/// The type of constant face iterator
|
||||||
|
typedef typename STL_TETRA_CONT::const_iterator const_TetraIterator;
|
||||||
|
|
||||||
|
/// The vertex pointer type
|
||||||
|
typedef VertexType * VertexPointer;
|
||||||
|
|
||||||
|
/// The tetra pointer type
|
||||||
|
typedef VertexType * TetraPointer;
|
||||||
|
|
||||||
|
/// The type of the constant vertex pointer
|
||||||
|
typedef const VertexType * const_VertexPointer;
|
||||||
|
|
||||||
|
/// The type of the constant tetrahedron pointer
|
||||||
|
typedef const VertexType * const_TetraPointer;
|
||||||
|
|
||||||
|
typedef typename VertexType::ScalarType ScalarType;
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/***********************************************/
|
||||||
|
/** @Common Attributes of a tetrahedral mesh **/
|
||||||
|
//@{
|
||||||
|
|
||||||
|
///temporary mark for decimation
|
||||||
|
int IMark;
|
||||||
|
|
||||||
|
/// Set of vertices
|
||||||
|
STL_VERT_CONT vert;
|
||||||
|
|
||||||
|
/// Real number of vertices
|
||||||
|
int vn;
|
||||||
|
|
||||||
|
/// Set of tetrahedron
|
||||||
|
STL_TETRA_CONT tetra;
|
||||||
|
|
||||||
|
/// Real number of tetrahedron
|
||||||
|
int tn;
|
||||||
|
|
||||||
|
/// Real number of edges
|
||||||
|
int en;
|
||||||
|
|
||||||
|
///Boundingbox della mesh
|
||||||
|
Box3<ScalarType> bbox;
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/***********************************************/
|
||||||
|
/** @Default Functions **/
|
||||||
|
//@{
|
||||||
|
|
||||||
|
/// Default constructor
|
||||||
|
Tetramesh()
|
||||||
|
{
|
||||||
|
tn = vn = en = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tetramesh(VertexContainer v,TetraContainer t)
|
||||||
|
{
|
||||||
|
this->vert=v;
|
||||||
|
this->tetra=t;
|
||||||
|
vn=v.size();
|
||||||
|
tn=t.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int MemUsed() const
|
||||||
|
{
|
||||||
|
return sizeof(TMTYPE)+sizeof(VertexType)*vert.size()+sizeof(tetrahedron)*tetra.size()+sizeof(edge)*edges.size();
|
||||||
|
}
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/***********************************************/
|
||||||
|
/** @Functions used to retrieve vertex informations**/
|
||||||
|
//@{
|
||||||
|
static bool HasPerVertexNormal() { return bool(VertexType::OBJ_TYPE & (VertexType::OBJ_TYPE_N)); }
|
||||||
|
static bool HasPerVertexColor() { return bool(VertexType::OBJ_TYPE & (VertexType::OBJ_TYPE_C)); }
|
||||||
|
static bool HasPerVertexMark() { return bool(VertexType::OBJ_TYPE & (VertexType::OBJ_TYPE_M)); }
|
||||||
|
static bool HasPerVertexQuality() { return bool(VertexType::OBJ_TYPE & (VertexType::OBJ_TYPE_Q)); }
|
||||||
|
static bool HasPerVertexTexture() { return bool(VertexType::OBJ_TYPE & (VertexType::OBJ_TYPE_T)); }
|
||||||
|
//@}
|
||||||
|
|
||||||
|
/***********************************************/
|
||||||
|
/** @Functions used for handle the temporany mark of a tetrahedron used in decimation**/
|
||||||
|
//@{
|
||||||
|
|
||||||
|
///Increase the current mark.
|
||||||
|
void UnMarkAll()
|
||||||
|
{
|
||||||
|
++IMark;
|
||||||
|
}
|
||||||
|
|
||||||
|
///Mark the vertex with current value
|
||||||
|
void Mark(VertexType *v)
|
||||||
|
{
|
||||||
|
v->IMark()=IMark;
|
||||||
|
}
|
||||||
|
|
||||||
|
///Initialize the mark of all vertices
|
||||||
|
void InitIMark()
|
||||||
|
{
|
||||||
|
VertexIterator vi;
|
||||||
|
IMark=0;
|
||||||
|
for(vi=vert.begin();vi!=vert.end();vi++)
|
||||||
|
{
|
||||||
|
(*vi).InitIMark();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
void LoadTs(char * filename, double meshscale )
|
||||||
|
{
|
||||||
|
int nvertex;
|
||||||
|
int ntetra;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float z;
|
||||||
|
int tp0;
|
||||||
|
int tp1;
|
||||||
|
int tp2;
|
||||||
|
int tp3;
|
||||||
|
float mass;
|
||||||
|
FILE *f;
|
||||||
|
Tetramesh::VertexType p1;
|
||||||
|
f = fopen(filename,"r");
|
||||||
|
if(f == NULL )
|
||||||
|
printf( "The file was not opened\n" );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fscanf(f, "%i", &nvertex );
|
||||||
|
fscanf(f, "%i", &ntetra );
|
||||||
|
int j;
|
||||||
|
for (j=0;j<nvertex;j++)
|
||||||
|
{
|
||||||
|
fscanf(f, "%f", &x );
|
||||||
|
fscanf(f, "%f", &y );
|
||||||
|
fscanf(f, "%f", &z );
|
||||||
|
fscanf(f, "%f", &mass );
|
||||||
|
p1.P()=Point3d(x*meshscale, y*meshscale ,z*meshscale );
|
||||||
|
vert.push_back(p1);
|
||||||
|
}
|
||||||
|
tetra.reserve(ntetra*10);
|
||||||
|
vert.reserve(nvertex*10);
|
||||||
|
for (j=0;j<ntetra;j++)
|
||||||
|
{
|
||||||
|
fscanf(f, "%i", &tp0 );
|
||||||
|
fscanf(f, "%i", &tp1 );
|
||||||
|
fscanf(f, "%i", &tp2 );
|
||||||
|
fscanf(f, "%i", &tp3 );
|
||||||
|
|
||||||
|
Tetramesh::TetraType newTetra;
|
||||||
|
tetra.push_back(newTetra);
|
||||||
|
tetra.back().Init(&vert[tp0],&vert[tp1],&vert[tp2],&vert[tp3]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};//End class
|
||||||
|
|
||||||
|
/*@}*/
|
||||||
|
|
||||||
|
|
||||||
|
};//end namespace
|
||||||
|
};//end namespace
|
||||||
|
#endif
|
|
@ -0,0 +1,151 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* 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. *
|
||||||
|
* *
|
||||||
|
****************************************************************************/
|
||||||
|
/****************************************************************************
|
||||||
|
History
|
||||||
|
|
||||||
|
Revision 1.1 2004/19/04 13:05 pietroni
|
||||||
|
Initial commit
|
||||||
|
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
|
#ifndef __VCG_TETRA_ALLOCATE
|
||||||
|
#define __VCG_TETRA_ALLOCATE
|
||||||
|
#include <vector>
|
||||||
|
using namespace std;
|
||||||
|
namespace vcg {
|
||||||
|
namespace tetra {
|
||||||
|
/** \addtogroup tetramesh */
|
||||||
|
/*@{*/
|
||||||
|
|
||||||
|
/** 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.
|
||||||
|
*/
|
||||||
|
template < class STL_VERT_CONT ,class STL_TETRA_CONT >
|
||||||
|
class Allocate
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/// The vertex container
|
||||||
|
typedef STL_VERT_CONT VertexContainer;
|
||||||
|
|
||||||
|
/// The tethaedhron container
|
||||||
|
typedef STL_TETRA_CONT TetraContainer;
|
||||||
|
|
||||||
|
/// The vertex type
|
||||||
|
typedef typename STL_VERT_CONT::value_type VertexType;
|
||||||
|
|
||||||
|
/// The tetrahedron type
|
||||||
|
typedef typename STL_TETRA_CONT::value_type TetraType;
|
||||||
|
|
||||||
|
/// The type of vertex iterator
|
||||||
|
typedef typename STL_VERT_CONT::iterator VertexIterator;
|
||||||
|
|
||||||
|
/// The type of tetra iterator
|
||||||
|
typedef typename STL_TETRA_CONT::iterator TetraIterator;
|
||||||
|
|
||||||
|
/// The type of constant vertex iterator
|
||||||
|
typedef typename STL_VERT_CONT::const_iterator const_VertexIterator;
|
||||||
|
|
||||||
|
/// The type of constant face iterator
|
||||||
|
typedef typename STL_TETRA_CONT::const_iterator 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.
|
||||||
|
@param n Il numero di vertici che si vuole aggiungere alla mesh.
|
||||||
|
@param local_var Vettore di variabili locali che rappresentano puntatori a vertici.
|
||||||
|
restituisce l'iteratore al primo elemento aggiunto.
|
||||||
|
*/
|
||||||
|
|
||||||
|
VertexIterator AddVertices(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
|
||||||
|
else --last;
|
||||||
|
unsigned int siz=0;
|
||||||
|
#ifdef __STL_CONFIG_H
|
||||||
|
if(last!=0) distance(_vert->begin(),last,siz);
|
||||||
|
#else
|
||||||
|
if(last!=0) siz=distance(_vert->begin(),last);
|
||||||
|
#endif
|
||||||
|
for(unsigned int i=0; i<n; ++i)
|
||||||
|
{
|
||||||
|
_vert->push_back(VertexType());
|
||||||
|
_vert->back().Supervisor_Flags() = 0;
|
||||||
|
}
|
||||||
|
vn+=n;
|
||||||
|
newbegin = _vert->begin();
|
||||||
|
if(newbegin != oldbegin)
|
||||||
|
{
|
||||||
|
TetraIterator f;
|
||||||
|
for (f=_tetra->begin(); f!=_tetra->end(); ++f)
|
||||||
|
if(!(*f).IsD())
|
||||||
|
for(unsigned int k=0; k<4; ++k)
|
||||||
|
(*f).V(k)= (*f).V(k)-&*oldbegin+&*newbegin;
|
||||||
|
for(unsigned int j=0; j<local_var.size(); ++j)
|
||||||
|
if((*local_var[j]) !=0 ) *local_var[j] = *local_var[j]-&*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 = _vert->begin();
|
||||||
|
advance(last,siz+1);
|
||||||
|
}
|
||||||
|
else last=_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
|
||||||
|
else advance(last,1); // altrimenti il primo dopo quello che era in precedenza l'ultimo valido.
|
||||||
|
}
|
||||||
|
return last;
|
||||||
|
}
|
||||||
|
|
||||||
|
}; // end class
|
||||||
|
|
||||||
|
|
||||||
|
/*@}*/
|
||||||
|
} // End namespace
|
||||||
|
} // End namespace
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,449 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* 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. *
|
||||||
|
* *
|
||||||
|
****************************************************************************/
|
||||||
|
/****************************************************************************
|
||||||
|
History
|
||||||
|
|
||||||
|
Revision 1.1 2004/16/04 14:32 pietroni
|
||||||
|
Initial commit
|
||||||
|
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
|
#ifndef __VCG_TETRA_UPDATE_TOPOLOGY
|
||||||
|
#define __VCG_TETRA_UPDATE_TOPOLOGY
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
namespace vcg {
|
||||||
|
namespace tetra {
|
||||||
|
/** Class Facet.
|
||||||
|
This is class for definition of a face of tethahedron
|
||||||
|
@param STL_VERT_CONT (Template Parameter) Specifies the type of the vertices container any the vertex type.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
template < class VERT_TYPE , class TETRA_TYPE>
|
||||||
|
class Facet{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/// The vertex type
|
||||||
|
typedef VERT_TYPE MVTYPE;
|
||||||
|
typedef TETRA_TYPE MTTYPE;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
MTTYPE *Tr;
|
||||||
|
int numface;
|
||||||
|
MVTYPE * vertex[3];
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Facet(MVTYPE *v0,MVTYPE *v1,MVTYPE *v2,TETRA_TYPE * t,int index)
|
||||||
|
{
|
||||||
|
vertex[0]=v0;
|
||||||
|
vertex[1]=v1;
|
||||||
|
vertex[2]=v2;
|
||||||
|
sort(vertex,vertex+3);
|
||||||
|
Tr = t;
|
||||||
|
numface = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const MVTYPE * V(int index) const
|
||||||
|
{
|
||||||
|
return vertex[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
TETRA_TYPE *getTetrahedron()
|
||||||
|
{
|
||||||
|
return Tr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setTetrahedron(TETRA_TYPE * t)
|
||||||
|
{
|
||||||
|
Tr=t;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator == ( Facet const & f) const
|
||||||
|
{
|
||||||
|
return ((vertex[0]==f.V(0))&&(vertex[1]==f.V(1))&&(vertex[2]==f.V(2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator != ( Facet const & f) const
|
||||||
|
{
|
||||||
|
return !((*this) == f);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator > ( Facet const & f) const
|
||||||
|
{
|
||||||
|
|
||||||
|
if (vertex[0]!=f.V(0))
|
||||||
|
{
|
||||||
|
if (vertex[0]>f.V(0))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (vertex[1]!=f.V(1))
|
||||||
|
{
|
||||||
|
if (vertex[1]>f.V(1))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (vertex[2]!=f.V(2))
|
||||||
|
{
|
||||||
|
if (vertex[2]>f.V(2))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator < ( Facet const & f) const
|
||||||
|
{
|
||||||
|
return !(((*this)>f)&&((*this)!=f));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator <= ( Facet const & f) const
|
||||||
|
{
|
||||||
|
return (((*this)<f)||((*this)==f));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator >= ( Facet const & f) const
|
||||||
|
{
|
||||||
|
return (((*this)>f)||((*this)==f));
|
||||||
|
}
|
||||||
|
|
||||||
|
int getFaceIndex()const
|
||||||
|
{
|
||||||
|
return numface;
|
||||||
|
}
|
||||||
|
|
||||||
|
};//end class
|
||||||
|
/** \addtogroup tetramesh */
|
||||||
|
/*@{*/
|
||||||
|
|
||||||
|
/** Class UpdateTopology.
|
||||||
|
This is class for Topology of a tetrahedralmesh.
|
||||||
|
@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.
|
||||||
|
*/
|
||||||
|
template < class STL_VERT_CONT ,class STL_TETRA_CONT >
|
||||||
|
class UpdateTopology
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/// The vertex container
|
||||||
|
typedef STL_VERT_CONT VertexContainer;
|
||||||
|
|
||||||
|
/// The tethaedhron container
|
||||||
|
typedef STL_TETRA_CONT TetraContainer;
|
||||||
|
|
||||||
|
/// The vertex type
|
||||||
|
typedef typename STL_VERT_CONT::value_type VertexType;
|
||||||
|
|
||||||
|
/// The tetrahedron type
|
||||||
|
typedef typename STL_TETRA_CONT::value_type TetraType;
|
||||||
|
|
||||||
|
/// The type of vertex iterator
|
||||||
|
typedef typename STL_VERT_CONT::iterator VertexIterator;
|
||||||
|
|
||||||
|
/// The type of tetra iterator
|
||||||
|
typedef typename STL_TETRA_CONT::iterator TetraIterator;
|
||||||
|
|
||||||
|
/// The type of constant vertex iterator
|
||||||
|
typedef typename STL_VERT_CONT::const_iterator const_VertexIterator;
|
||||||
|
|
||||||
|
/// 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()
|
||||||
|
{
|
||||||
|
vertex_iterator v;
|
||||||
|
tetra_iterator t;
|
||||||
|
|
||||||
|
ClearVTTopology();
|
||||||
|
|
||||||
|
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).V(j)->Fp() = &(*t);
|
||||||
|
(*t).V(j)->Zp() = j;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// clear the Vertex-Tetra topology
|
||||||
|
void ClearVTTopology()
|
||||||
|
{
|
||||||
|
vertex_iterator 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)
|
||||||
|
for(int j=0;j<4;++j)
|
||||||
|
{
|
||||||
|
(*t).TV(j) = 0;
|
||||||
|
(*t).ZV(j) = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///erase one tetrahedron from VTTopology of all his vertices
|
||||||
|
|
||||||
|
void DetachVTTopology(TetraType *t)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i=0;i<4;i++)
|
||||||
|
DetachVTTopology(t->V(i),t);
|
||||||
|
}
|
||||||
|
|
||||||
|
///erase one tetrahedron from VTTopology of one specified vertex
|
||||||
|
void DetachVTTopology(VertexType *v,TetraType *t)
|
||||||
|
{
|
||||||
|
TetraType *lastt;
|
||||||
|
int lastz;
|
||||||
|
EdgePosT<TetraType> Et(v->Fp(),v->Zp());
|
||||||
|
if (Et.t==t)
|
||||||
|
{
|
||||||
|
v->Fp()=(TetraType *)t->tv[v->Zp()];
|
||||||
|
v->Zp()=t->zv[v->Zp()];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lastz=Et.z;
|
||||||
|
while((Et.t!=t)&&(Et.t!=NULL))
|
||||||
|
{
|
||||||
|
lastz=Et.z;
|
||||||
|
lastt=Et.t;
|
||||||
|
Et.NextT();
|
||||||
|
}
|
||||||
|
//in the list of the vertex v must be present the
|
||||||
|
//tetrahedron that you want to detach
|
||||||
|
assert(Et.t!=NULL);
|
||||||
|
lastt->tv[lastz]=Et.t->tv[Et.z];
|
||||||
|
lastt->zv[lastz]=Et.t->zv[Et.z];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///insert the tetrahedron t in VT topology for vertex v of index z
|
||||||
|
void InsertVTTopology(VertexType *v,int z,TetraType *t)
|
||||||
|
{
|
||||||
|
if( ! (*t).IsD())
|
||||||
|
{
|
||||||
|
(*t).tv[z] = v->Fp();
|
||||||
|
(*t).zv[z] = v->Zp();
|
||||||
|
v->Fp() = &(*t);
|
||||||
|
v->Zp() = z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///insert the tetrahedron t in VT topology for all his vertices
|
||||||
|
void InsertVTTopology(TetraType *t)
|
||||||
|
{
|
||||||
|
assert(!t->IsD());
|
||||||
|
int k=0;
|
||||||
|
for (k=0;k<4;k++)
|
||||||
|
{
|
||||||
|
assert(!t->V(k)->IsD());
|
||||||
|
InsertVTTopology(t->V(k),k,t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*@}*/
|
||||||
|
/***********************************************/
|
||||||
|
/** @Tetrahedron-Tetrahedron Topology Funtions
|
||||||
|
**/
|
||||||
|
//@{
|
||||||
|
///Build the Tetrahedron-Tetrahedron Topology (by Face)
|
||||||
|
void TTTopology()
|
||||||
|
{
|
||||||
|
vector <Facet<VertexType,TetraType> > VF;
|
||||||
|
VertexType* v0;
|
||||||
|
VertexType* v1;
|
||||||
|
VertexType* v2;
|
||||||
|
|
||||||
|
for (TetraIterator ti=_tetra->begin();ti!=_tetra->end();ti++)
|
||||||
|
{
|
||||||
|
if (!(*ti).IsD())
|
||||||
|
{
|
||||||
|
(*ti).Z(0)=0;
|
||||||
|
(*ti).Z(1)=1;
|
||||||
|
(*ti).Z(2)=2;
|
||||||
|
(*ti).Z(3)=3;
|
||||||
|
(*ti).T(0)=(&(*ti));
|
||||||
|
(*ti).T(1)=(&(*ti));
|
||||||
|
(*ti).T(2)=(&(*ti));
|
||||||
|
(*ti).T(3)=(&(*ti));
|
||||||
|
|
||||||
|
v0=(*ti).V(Tetra4<double>::VofF(0,0));
|
||||||
|
v1=(*ti).V(Tetra4<double>::VofF(0,1));
|
||||||
|
v2=(*ti).V(Tetra4<double>::VofF(0,2));
|
||||||
|
|
||||||
|
VF.push_back(Facet<VertexType,TetraType>(v0,v1,v2,&(*ti),0));
|
||||||
|
|
||||||
|
v0=(*ti).V(Tetra4<double>::VofF(1,0));
|
||||||
|
v1=(*ti).V(Tetra4<double>::VofF(1,1));
|
||||||
|
v2=(*ti).V(Tetra4<double>::VofF(1,2));
|
||||||
|
|
||||||
|
VF.push_back(Facet<VertexType,TetraType>(v0,v1,v2,&(*ti),1));
|
||||||
|
|
||||||
|
v0=(*ti).V(Tetra4<double>::VofF(2,0));
|
||||||
|
v1=(*ti).V(Tetra4<double>::VofF(2,1));
|
||||||
|
v2=(*ti).V(Tetra4<double>::VofF(2,2));
|
||||||
|
|
||||||
|
VF.push_back(Facet<VertexType,TetraType>(v0,v1,v2,&(*ti),2));
|
||||||
|
|
||||||
|
v0=(*ti).V(Tetra4<double>::VofF(3,0));
|
||||||
|
v1=(*ti).V(Tetra4<double>::VofF(3,1));
|
||||||
|
v2=(*ti).V(Tetra4<double>::VofF(3,2));
|
||||||
|
|
||||||
|
VF.push_back(Facet<VertexType,TetraType>(v0,v1,v2,&(*ti),3));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sort(VF.begin(),VF.end());
|
||||||
|
|
||||||
|
TetraType *t0;
|
||||||
|
TetraType *t1;
|
||||||
|
int faceindex0;
|
||||||
|
int faceindex1;
|
||||||
|
int j;
|
||||||
|
unsigned int i;
|
||||||
|
for (i=0;i<VF.size()-1;i++)
|
||||||
|
{
|
||||||
|
j=i+1;
|
||||||
|
if (VF[i]==VF[j])
|
||||||
|
{
|
||||||
|
t0=VF[i].getTetrahedron();
|
||||||
|
t1=VF[j].getTetrahedron();
|
||||||
|
faceindex0=VF[i].getFaceIndex();
|
||||||
|
faceindex1=VF[j].getFaceIndex();
|
||||||
|
t0->T(faceindex0)=(t1);
|
||||||
|
t1->T(faceindex1)=(t0);
|
||||||
|
t0->Z(faceindex0)=(faceindex1);
|
||||||
|
t1->Z(faceindex1)=(faceindex0);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///Test the Tetrahedron-Tetrahedron Topology (by Face)
|
||||||
|
void TestTTTopology()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (TetraIterator ti=_tetra->begin();ti!=_tetra->end();ti++)
|
||||||
|
{
|
||||||
|
for (i=0;i<4;i++)
|
||||||
|
{
|
||||||
|
if ((!(*ti).IsD())&& ((*ti).T(i)!=&(*ti)))
|
||||||
|
{
|
||||||
|
assert( ((((*ti).T(i))->T((*ti).Z(i)))==&(*ti)));
|
||||||
|
|
||||||
|
VertexType *v0=(*ti).V(Tetra4<double>::VofF(i,0));
|
||||||
|
VertexType *v1=(*ti).V(Tetra4<double>::VofF(i,1));
|
||||||
|
VertexType *v2=(*ti).V(Tetra4<double>::VofF(i,2));
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
assert((v0!=v1)&&(v0!=v2)&&(v1!=v2));
|
||||||
|
assert((vo0!=vo1)&&(vo0!=vo2)&&(vo1!=vo2));
|
||||||
|
|
||||||
|
assert ((v0==vo0)||(v0==vo1)||(v0==vo2));
|
||||||
|
assert ((v1==vo0)||(v1==vo1)||(v1==vo2));
|
||||||
|
assert ((v2==vo0)||(v2==vo1)||(v2==vo2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void setExternalVertices()
|
||||||
|
{
|
||||||
|
|
||||||
|
TetraIterator tt;
|
||||||
|
int i;
|
||||||
|
for (tt=_tetra.begin();tt<_tetra.end();++tt)
|
||||||
|
{
|
||||||
|
|
||||||
|
for(i=0;i<4;i++)
|
||||||
|
{
|
||||||
|
if ((*tt).IsBorderF(i))
|
||||||
|
{
|
||||||
|
(*tt).FV(i,0)->SetB();
|
||||||
|
(*tt).FV(i,1)->SetB();
|
||||||
|
(*tt).FV(i,2)->SetB();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
(*tt).FV(i,0)->SetB();
|
||||||
|
(*tt).FV(i,1)->SetB();
|
||||||
|
(*tt).FV(i,2)->SetB();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@}*/
|
||||||
|
}; // end class
|
||||||
|
|
||||||
|
|
||||||
|
/*@}*/
|
||||||
|
} // End namespace
|
||||||
|
} // End namespace
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -24,13 +24,16 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.1 2004/04/15 08:54:20 pietroni
|
||||||
|
*** empty log message ***
|
||||||
|
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef TETRA_TYPE
|
#ifndef TETRA_TYPE
|
||||||
#pragma message("\nYou should never directly include this file\_n")
|
#pragma message("\nYou should never directly include this file\_n")
|
||||||
#else
|
#else
|
||||||
#define TETRA_TYPE
|
#define NULL 0
|
||||||
#include<vcg/space/point3.h>
|
#include<vcg/space/point3.h>
|
||||||
#include<vcg/space/tetra4.h>
|
#include<vcg/space/tetra4.h>
|
||||||
|
|
||||||
|
@ -72,7 +75,7 @@ vcg::TetrahedronFull::SetUserBit() vcg::TetrahedronFull::ClearUserBit() and vcg:
|
||||||
/// This are the flags of tetrahedron, the default value is 0
|
/// This are the flags of tetrahedron, the default value is 0
|
||||||
int _flags;
|
int _flags;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
DELETED = 0x00000001, // deleted tetrahedron flag
|
DELETED = 0x00000001, // deleted tetrahedron flag
|
||||||
SELECTED = 0x00000002, // Selection flag
|
SELECTED = 0x00000002, // Selection flag
|
||||||
BORDERF0 = 0x00000004, // Border flag, Face 0
|
BORDERF0 = 0x00000004, // Border flag, Face 0
|
||||||
|
@ -133,10 +136,7 @@ void SetS() {_flags |=SELECTED;}
|
||||||
/// This function mark the tetrahedron as not selected.
|
/// This function mark the tetrahedron as not selected.
|
||||||
void ClearS() {_flags &=~SELECTED;}
|
void ClearS() {_flags &=~SELECTED;}
|
||||||
/// This function return true if one face is extern.
|
/// This function return true if one face is extern.
|
||||||
bool HaveBorderF()
|
bool HaveBorderF() {return ((_flags & (BORDERF0 | BORDERF1 | BORDERF2 | BORDERF3)) != 0);}
|
||||||
{
|
|
||||||
{return ((_flags & (BORDERF0 | BORDERF1 | BORDERF2 | BORDERF3)) != 0);}
|
|
||||||
{
|
|
||||||
/// This function return true if the face is extern.
|
/// This function return true if the face is extern.
|
||||||
bool IsBorderF(int face) {
|
bool IsBorderF(int face) {
|
||||||
assert ((face<4)&&(face>-1));
|
assert ((face<4)&&(face>-1));
|
||||||
|
@ -167,12 +167,12 @@ protected:
|
||||||
VertexType *_v[4];
|
VertexType *_v[4];
|
||||||
public:
|
public:
|
||||||
/// The Functions to access a vertex
|
/// The Functions to access a vertex
|
||||||
inline MVTYPE * &V(int index)
|
inline VertexType * &V(int index)
|
||||||
{
|
{
|
||||||
return _v[index];
|
return _v[index];
|
||||||
}
|
}
|
||||||
/// The Functions to access a vertex
|
/// The Functions to access a vertex
|
||||||
inline const MVTYPE * &V(int index) const
|
inline const VertexType * &V(int index) const
|
||||||
{
|
{
|
||||||
return _v[index];
|
return _v[index];
|
||||||
}
|
}
|
||||||
|
@ -197,12 +197,12 @@ public:
|
||||||
///Function to access the Tetrahedron that share the index-face (extern face returns a pointer to himself)
|
///Function to access the Tetrahedron that share the index-face (extern face returns a pointer to himself)
|
||||||
TETRA_TYPE *&T(const int &index)
|
TETRA_TYPE *&T(const int &index)
|
||||||
{
|
{
|
||||||
return t[index];
|
return _t[index];
|
||||||
}
|
}
|
||||||
///Function to see the index of the face as seen from the other tetrahedron (extern face returns -1)
|
///Function to see the index of the face as seen from the other tetrahedron (extern face returns -1)
|
||||||
int &Z(const int &index)
|
int &Z(const int &index)
|
||||||
{
|
{
|
||||||
return z[index];
|
return _z[index];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ public:
|
||||||
_flags=0;
|
_flags=0;
|
||||||
}
|
}
|
||||||
///initialize default parameters of tetrahedron
|
///initialize default parameters of tetrahedron
|
||||||
virtual void Init(MVTYPE * p0,MVTYPE * p1,MVTYPE * p2,MVTYPE * p3)
|
virtual void Init(VertexType * p0,VertexType * p1,VertexType * p2,VertexType * p3)
|
||||||
{
|
{
|
||||||
_flags = 0;
|
_flags = 0;
|
||||||
_v[0]=p0;
|
_v[0]=p0;
|
||||||
|
@ -249,12 +249,12 @@ public:
|
||||||
swap(_v[1],_v[2]);
|
swap(_v[1],_v[2]);
|
||||||
|
|
||||||
#ifdef __VCGLIB_TETRA_A
|
#ifdef __VCGLIB_TETRA_A
|
||||||
z[0]=z[1]=z[2]=z[3]=-1;
|
_z[0]=_z[1]=_z[2]=_z[3]=-1;
|
||||||
t[0]=t[1]=t[2]=t[3]=NULL;
|
_t[0]=_t[1]=_t[2]=_t[3]=NULL;
|
||||||
#endif
|
#endif
|
||||||
#ifdef __VCGLIB_TETRA_V
|
#ifdef __VCGLIB_TETRA_V
|
||||||
zv[0]=zv[1]=zv[2]=zv[3]=-1;
|
_zv[0]=_zv[1]=_zv[2]=_zv[3]=-1;
|
||||||
tv[0]=tv[1]=tv[2]=tv[3]=NULL;
|
_tv[0]=_tv[1]=_tv[2]=_tv[3]=NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
///set border vertices using TT-topology
|
///set border vertices using TT-topology
|
||||||
|
@ -278,16 +278,21 @@ public:
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
#ifdef __VCGLIB_TETRA_Q
|
#ifdef __VCGLIB_TETRA_Q
|
||||||
scalar_type _volume;
|
ScalarType _volume;
|
||||||
scalar_type _aspect_ratio;
|
ScalarType _aspect_ratio;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __VCGLIB_TETRA_Q
|
|
||||||
scalar_type ComputeVolume(){
|
ScalarType ComputeVolume(){
|
||||||
Tetra4<scalar_type> T(V(0)->cP(),V(1)->cP(),V(2)->cP(),V(3)->cP());
|
Tetra4<ScalarType> T(V(0)->cP(),V(1)->cP(),V(2)->cP(),V(3)->cP());
|
||||||
|
#ifdef __VCGLIB_TETRA_Q
|
||||||
_volume = T.ComputeVolume();
|
_volume = T.ComputeVolume();
|
||||||
|
return _volume;
|
||||||
|
#else
|
||||||
|
return (T.ComputeVolume());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
///return the volume of the tetrahedron
|
///return the volume of the tetrahedron
|
||||||
const double & Volume(){
|
const double & Volume(){
|
||||||
|
@ -307,123 +312,6 @@ public:
|
||||||
}
|
}
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/***********************************************/
|
|
||||||
/** @Tatrahedron Functions to retrieve information about relation between faces of tetrahedron
|
|
||||||
(faces,adges,vertices).**/
|
|
||||||
//@{
|
|
||||||
|
|
||||||
MVTYPE *FV(const int &indexF,const int &indexV)
|
|
||||||
{ int facevert[4][3]={{0,1,2},
|
|
||||||
{0,3,1},
|
|
||||||
{0,2,3},
|
|
||||||
{1,3,2}};
|
|
||||||
assert ((indexF<4)&&(indexV<3));
|
|
||||||
return _v[facevert[indexF][indexV]];
|
|
||||||
}
|
|
||||||
|
|
||||||
int iFV(const int &indexF,const int &indexV)
|
|
||||||
{ int facevert[4][3]={{0,1,2},
|
|
||||||
{0,3,1},
|
|
||||||
{0,2,3},
|
|
||||||
{1,3,2}};
|
|
||||||
|
|
||||||
assert ((indexF<4)&&(indexV<3));
|
|
||||||
return facevert[indexF][indexV];
|
|
||||||
}
|
|
||||||
|
|
||||||
int VF(const int &indexV,const int &indexF)
|
|
||||||
{ int vertface[4][3]={{0,1,2},
|
|
||||||
{0,3,1},
|
|
||||||
{0,2,3},
|
|
||||||
{1,3,2}};
|
|
||||||
|
|
||||||
assert ((indexV<4)&&(indexF<3));
|
|
||||||
return vertface[indexV][indexF];
|
|
||||||
}
|
|
||||||
|
|
||||||
int FVE(const int &indexF,const int &indexV)
|
|
||||||
{
|
|
||||||
|
|
||||||
int facevertedge[4][4]={{1,0,3,-1},
|
|
||||||
{2,0,-1,4},
|
|
||||||
{-1,3,5,4},
|
|
||||||
{1,-1,5,2}
|
|
||||||
};
|
|
||||||
assert ((indexF<4)&&(indexV<4));
|
|
||||||
return facevertedge[indexF][indexV];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline MVTYPE * VE(const int &indexE,const int &indexV)
|
|
||||||
{ int edgevert[6][2]={{0,1},
|
|
||||||
{0,2},
|
|
||||||
{0,3},
|
|
||||||
{1,2},
|
|
||||||
{1,3},
|
|
||||||
{2,3}};
|
|
||||||
assert ((indexE<6)&&(indexV<2));
|
|
||||||
return _v[edgevert[indexE][indexV]];
|
|
||||||
}
|
|
||||||
// Tetrahedron Vertex (Couple) To Edge Conversion Function
|
|
||||||
inline int VEC(const int &indexV1,const int &indexV2)
|
|
||||||
{ int ve[4][4]={{-1, 0, 1, 2},
|
|
||||||
{ 0, -1, 3, 4},
|
|
||||||
{ 1, 3, -1, 5},
|
|
||||||
{ 2, 4, 5, -1}};
|
|
||||||
|
|
||||||
assert ((indexV1<4)&&(indexV2<4));
|
|
||||||
return ve[indexV1][indexV2];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int EV(const int &indexV,const int &indexE)
|
|
||||||
{
|
|
||||||
int vertedge[4][3]={{0,1,2},
|
|
||||||
{0,3,4},
|
|
||||||
{5,1,3},
|
|
||||||
{4,5,2}};
|
|
||||||
assert ((indexE<3)&&(indexV<4));
|
|
||||||
return vertedge[indexV][indexE];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int iVE(const int &indexE,const int &indexV)
|
|
||||||
{ int edgevert[6][2]={{0,1},
|
|
||||||
{0,2},
|
|
||||||
{0,3},
|
|
||||||
{1,2},
|
|
||||||
{1,3},
|
|
||||||
{2,3}};
|
|
||||||
assert ((indexE<6)&&(indexV<2));
|
|
||||||
return edgevert[indexE][indexV];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int FE(const int &indexE,const int &indexSide)
|
|
||||||
{ int edgeface[6][2]={{0,1},
|
|
||||||
{0,2},
|
|
||||||
{1,2},
|
|
||||||
{0,3},
|
|
||||||
{1,3},
|
|
||||||
{2,3}};
|
|
||||||
|
|
||||||
assert ((indexE<6)&&(indexSide<2));
|
|
||||||
return edgeface [indexE][indexSide];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int EF(const int &indexF,const int &faceindexEdge)
|
|
||||||
{ int faceedge[4][3]={{0,3,1},
|
|
||||||
{2,4,0},
|
|
||||||
{1,5,2},
|
|
||||||
{4,5,3}
|
|
||||||
};
|
|
||||||
|
|
||||||
assert ((indexF<4)&&(faceindexEdge<3));
|
|
||||||
return faceedge [indexF][faceindexEdge];
|
|
||||||
}
|
|
||||||
|
|
||||||
//@}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};//end class
|
};//end class
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef __VCGLIB_TETRA_A_TYPE
|
||||||
|
#define __VCGLIB_TETRA_A_TYPE
|
||||||
|
|
||||||
|
#define TETRA_TYPE TetraA
|
||||||
|
|
||||||
|
#define __VCGLIB_TETRA_A
|
||||||
|
|
||||||
|
#include <vcg/simplex/tetrahedron/base.h>
|
||||||
|
|
||||||
|
#undef TETRA_TYPE
|
||||||
|
|
||||||
|
#undef __VCGLIB_TETRA_A
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef __VCGLIB_TETRA_AV_TYPE
|
||||||
|
#define __VCGLIB_TETRA_AV_TYPE
|
||||||
|
|
||||||
|
#define TETRA_TYPE TetraAV
|
||||||
|
|
||||||
|
#define __VCGLIB_TETRA_A
|
||||||
|
#define __VCGLIB_TETRA_V
|
||||||
|
#include <vcg/simplex/tetrahedron/base.h>
|
||||||
|
|
||||||
|
#undef TETRA_TYPE
|
||||||
|
|
||||||
|
#undef __VCGLIB_TETRA_A
|
||||||
|
#undef __VCGLIB_TETRA_V
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef __VCGLIB_TETRA_AVQ_TYPE
|
||||||
|
#define __VCGLIB_TETRA_AVQ_TYPE
|
||||||
|
|
||||||
|
#define TETRA_TYPE TetraAVQ
|
||||||
|
|
||||||
|
#define __VCGLIB_TETRA_A
|
||||||
|
#define __VCGLIB_TETRA_V
|
||||||
|
#define __VCGLIB_TETRA_Q
|
||||||
|
#include <vcg/simplex/tetrahedron/base.h>
|
||||||
|
|
||||||
|
#undef TETRA_TYPE
|
||||||
|
|
||||||
|
#undef __VCGLIB_TETRA_A
|
||||||
|
#undef __VCGLIB_TETRA_V
|
||||||
|
#undef __VCGLIB_TETRA_Q
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef __VCGLIB_TETRA_Q_TYPE
|
||||||
|
#define __VCGLIB_TETRA_Q_TYPE
|
||||||
|
|
||||||
|
#define TETRA_TYPE TetraQ
|
||||||
|
|
||||||
|
#define __VCGLIB_TETRA_Q
|
||||||
|
|
||||||
|
#include <vcg/simplex/tetrahedron/base.h>
|
||||||
|
|
||||||
|
#undef TETRA_TYPE
|
||||||
|
|
||||||
|
#undef __VCGLIB_TETRA_Q
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue