bootstrapping tetra

This commit is contained in:
T.Alderighi 2018-05-01 17:02:47 +02:00
parent 21d49e900e
commit 1b61aba402
8 changed files with 3261 additions and 3 deletions

View File

@ -30,6 +30,7 @@ struct AllTypes{
struct AEdgeType {};
struct AFaceType {};
struct AHEdgeType {};
struct ATetraType {};
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,65 @@
/****************************************************************************
* VCGLib o o *
* Visual and Computer Graphics Library o o *
* _ O _ *
* Copyright(C) 2004-2016 \/)\/ *
* 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. *
* *
****************************************************************************/
#ifndef __VCG_TETRA_MESH_H
#define __VCG_TETRA_MESH_H
#define __VCG_TETRA_MESH
#include <cassert>
#include <cstring>
#include <string>
#include <ctime>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iostream>
#include <stdexcept>
#include <limits>
#include <iterator>
#include <typeindex>
#include <wrap/callback.h>
#include <vcg/complex/exception.h>
#include <vcg/container/simple_temporary_data.h>
#include <vcg/complex/tetrahedron/base.h>
#include <vcg/complex/allocate.h>
#include <vcg/simplex/face/pos.h>
#include <vcg/simplex/face/topology.h>
#include <vcg/simplex/edge/pos.h>
#include <vcg/simplex/edge/topology.h>
#include <vcg/simplex/tetrahedron/tetrahedron.h>
#include <vcg/simplex/tetrahedron/pos.h>
#include <vcg/complex/foreach.h>
#include <vcg/complex/algorithms/update/flag.h>
#include <vcg/complex/algorithms/update/selection.h>
#include <vcg/complex/algorithms/update/topology.h>
#include <vcg/complex/algorithms/update/normal.h>
#include <vcg/complex/algorithms/update/bounding.h>
#include <vcg/complex/algorithms/mesh_assert.h>
#include <vcg/complex/append.h>
#undef __VCG_TETRA_MESH
#endif

View File

@ -30,6 +30,7 @@
#include <vcg/space/texcoord2.h>
#include <vcg/space/triangle3.h>
#include <vcg/space/polygon3.h>
#include <vcg/space/tetra3.h>
#include <vcg/container/derivation_chain.h>
#include <vcg/complex/all_types.h>
@ -42,6 +43,8 @@
#include <vcg/simplex/face/base.h>
#include <vcg/simplex/edge/component.h>
#include <vcg/simplex/edge/base.h>
#include <vcg/simplex/tetrahedron/component.h>
#include <vcg/simplex/tetrahedron/base.h>
#include <vcg/connectors/hedge_component.h>
#include <vcg/connectors/hedge.h>
@ -52,13 +55,14 @@ namespace vcg{
struct _Vertex;
struct _Edge ;
struct _Face ;
struct _Tetra ;
struct _HEdge ;
struct DummyTypes{
typedef _Vertex VertexType; // simplex types
typedef _Edge EdgeType;
typedef _Face FaceType;
typedef char TetraType;
typedef _Tetra TetraType;
typedef _HEdge HEdgeType; // connector types
typedef vcg::Point3<bool> CoordType;
@ -92,6 +96,7 @@ template <template <typename> class A = DefaultDeriver, template <typename> clas
Use< Vertex <UsedTypes< A, B, C, D , E, F, G, H > > > :: template AsVertexType,
Use< Edge <UsedTypes< A, B, C, D , E, F, G, H > > > :: template AsEdgeType,
Use< Face <UsedTypes< A, B, C, D , E, F, G, H > > > :: template AsFaceType,
Use< Tetra <UsedTypes< A, B, C, D , E, F, G, H > > > :: template AsTetraType,
Use< HEdge <UsedTypes< A, B, C, D , E, F, G, H > > > :: template AsHEdgeType,
A, B, C, D, E, F, G, H
> {
@ -105,12 +110,14 @@ struct _UsedTypes: public UsedTypes<
Use<_Vertex>::AsVertexType,
Use<_Edge >::AsEdgeType,
Use<_Face >::AsFaceType,
Use<_Tetra >::AsTetraType,
Use<_HEdge >::AsHEdgeType
>{};
struct _Vertex: public Vertex<_UsedTypes>{};
struct _Edge : public Edge<_UsedTypes>{};
struct _Face : public Face<_UsedTypes>{};
struct _Tetra : public Tetra<_UsedTypes>{};
struct _HEdge : public HEdge<_UsedTypes>{};
};

View File

@ -99,7 +99,7 @@ public:
DELETED = 0x00000001, // Face is deleted from the mesh
NOTREAD = 0x00000002, // Face of the mesh is not readable
NOTWRITE = 0x00000004, // Face of the mesh is not writable
VISITED = 0x00000010, // Face has been visited. Usualy this is a per-algorithm used bit.
VISITED = 0x00000010, // Face has been visited. Usualy this is a per-algorithm used bit.
SELECTED = 0x00000020, // Face is selected. Algorithms should try to work only on selected face (if explicitly requested)
// Border _flags, it is assumed that BORDERi = BORDER0<<i
BORDER0 = 0x00000040,

View File

@ -160,7 +160,7 @@ public:
DELETED = 0x00000001, // Face is deleted from the mesh
NOTREAD = 0x00000002, // Face of the mesh is not readable
NOTWRITE = 0x00000004, // Face of the mesh is not writable
VISITED = 0x00000010, // Face has been visited. Usualy this is a per-algorithm used bit.
VISITED = 0x00000010, // Face has been visited. Usualy this is a per-algorithm used bit.
SELECTED = 0x00000020, // Face is selected. Algorithms should try to work only on selected face (if explicitly requested)
// Border _flags, it is assumed that BORDERi = BORDER0<<i
BORDER0 = 0x00000040,
@ -266,6 +266,7 @@ public:
bb.Set(this->P(0));
bb.Add(this->P(1));
bb.Add(this->P(2));
bb.Add(this->P(3));
}

View File

@ -65,6 +65,7 @@ public:
v[0]=0;
v[1]=0;
v[2]=0;
v[3]=0;
}
inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<4); return v[j]; }
@ -82,23 +83,29 @@ public:
inline typename T::VertexType * & V0( const int j ) { return V(j);}
inline typename T::VertexType * & V1( const int j ) { return V((j+1)%4);}
inline typename T::VertexType * & V2( const int j ) { return V((j+2)%4);}
inline typename T::VertexType * & V3( const int j ) { return V((j+3)%4);}
inline const typename T::VertexType * const & V0( const int j ) const { return V(j);}
inline const typename T::VertexType * const & V1( const int j ) const { return V((j+1)%4);}
inline const typename T::VertexType * const & V2( const int j ) const { return V((j+2)%4);}
inline const typename T::VertexType * const & V3( const int j ) const { return V((j+3)%4);}
inline const typename T::VertexType * const & cV0( const int j ) const { return cV(j);}
inline const typename T::VertexType * const & cV1( const int j ) const { return cV((j+1)%4);}
inline const typename T::VertexType * const & cV2( const int j ) const { return cV((j+2)%4);}
inline const typename T::VertexType * const & cV3( const int j ) const { return cV((j+3)%4);}
/// Shortcut to get vertex values
inline typename T::CoordType & P0( const int j ) { return V(j)->P();}
inline typename T::CoordType & P1( const int j ) { return V((j+1)%4)->P();}
inline typename T::CoordType & P2( const int j ) { return V((j+2)%4)->P();}
inline typename T::CoordType & P3( const int j ) { return V((j+3)%4)->P();}
inline const typename T::CoordType & P0( const int j ) const { return V(j)->P();}
inline const typename T::CoordType & P1( const int j ) const { return V((j+1)%4)->P();}
inline const typename T::CoordType & P2( const int j ) const { return V((j+2)%4)->P();}
inline const typename T::CoordType & P3( const int j ) const { return V((j+3)%4)->P();}
inline const typename T::CoordType & cP0( const int j ) const { return cV(j)->P();}
inline const typename T::CoordType & cP1( const int j ) const { return cV((j+1)%4)->P();}
inline const typename T::CoordType & cP2( const int j ) const { return cV((j+2)%4)->P();}
inline const typename T::CoordType & cP3( const int j ) const { return cV((j+3)%4)->P();}
static bool HasVertexRef() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("VertexRef"));T::Name(name);}
@ -214,13 +221,17 @@ public:
template <class T> class VTAdj: public T {
public:
VTAdj() { _vtp[0]=0; _vtp[1]=0; _vtp[2]=0; _vtp[3]=0; }
typename T::TetraPointer & VTp( const int j ) { assert( j >= 0 && j < 4 ); return _vtp[j]; }
typename T::TetraPointer const VTp( const int j ) const { assert( j >= 0 && j < 4 ); return _vtp[j]; }
typename T::TetraPointer const cVTp( const int j ) const { assert( j >= 0 && j < 4 ); return _vtp[j]; }
char & VTi( const int j ) { return _vti[j]; }
const char & cVTi( const int j ) const { return _vti[j]; }
static bool HasVTAdjacency() { return true; }
static bool HasVTAdjacencyOcc() { return false; }
static void Name( std::vector< std::string > & name ) { name.push_back( std::string("VTAdj") ); T::Name(name); }
private:
@ -246,8 +257,10 @@ public:
typename T::TetraPointer &TTp1( const int j ) { return TTp((j+1)%4);}
typename T::TetraPointer &TTp2( const int j ) { return TTp((j+2)%4);}
typename T::TetraPointer &TTp3( const int j ) { return TTp((j+3)%4);}
typename T::TetraPointer const TTp1( const int j ) const { return TTp((j+1)%4);}
typename T::TetraPointer const TTp2( const int j ) const { return TTp((j+2)%4);}
typename T::TetraPointer const TTp3( const int j ) const { return TTp((j+3)%4);}
bool IsBorderF(const int & i) const { assert( (i>=0) && (i < 4)); { return TTp(i) == this;}}