map3MR_PrimalRegular.h 4.33 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg           *
*                                                                              *
* This library is free software; you can redistribute it and/or modify it      *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your     *
* option) any later version.                                                   *
*                                                                              *
* This library 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 Lesser General Public License  *
* for more details.                                                            *
*                                                                              *
* You should have received a copy of the GNU Lesser General Public License     *
* along with this library; if not, write to the Free Software Foundation,      *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.           *
*                                                                              *
* Web site: http://cgogn.unistra.fr/                                           *
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

25 26
#ifndef __MAP3MR_PRIMAL_REGULAR_
#define __MAP3MR_PRIMAL_REGULAR_
27 28 29 30 31

#include "Topology/map/embeddedMap3.h"
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor3.h"

untereiner's avatar
untereiner committed
32
#include "Algo/Multiresolution/filter.h"
33
#include "Algo/Modelisation/tetrahedralization.h"
34
#include "Algo/Modelisation/subdivision.h"
35 36 37 38

namespace CGoGN
{

39 40 41
namespace Algo
{

42 43 44
namespace Volume
{

45
namespace MR
46 47
{

48 49
namespace Primal
{
untereiner's avatar
untereiner committed
50

51 52
namespace Regular
{
untereiner's avatar
untereiner committed
53

54 55 56
/*! \brief The class of regular 3-map MR
 */

57
template <typename PFP>
58
class Map3MR
59
{
60

61 62 63 64 65
public:
	typedef typename PFP::MAP MAP;
	typedef typename PFP::VEC3 VEC3;
	typedef typename PFP::REAL REAL;

66
protected:
67
	MAP& m_map;
68 69
	bool shareVertexEmbeddings;

70 71
	std::vector<Algo::MR::Filter*> synthesisFilters ;
	std::vector<Algo::MR::Filter*> analysisFilters ;
72

untereiner's avatar
untereiner committed
73

74
public:
75
	Map3MR(MAP& map);
76

77 78
	~Map3MR();

79
private:
80 81 82 83
	/*! @name Topological helping functions
	 *
	 *************************************************************************/
	//@{
84

85 86 87 88

	void splitSurfaceInVolume(std::vector<Dart>& vd, bool firstSideClosed = true, bool secondSideClosed = false);
	//@}

89
public:
90 91 92

	void swapEdges(Dart d, Dart e);

93

94 95
    Dart swap2To2(Dart d);
    void swap4To4(Dart d);
96 97 98
	Dart swap2To3(Dart d);
	void swapGen3To2(Dart d);

99 100 101 102 103 104 105
	/*! @name Level creation
	 *
	 *************************************************************************/
	//@{
	//!
	/*
	 */
106
	void addNewLevelTetraOcta();
107 108 109 110

	//!
	/*
	 */
111
	void addNewLevelHexa();
112

113 114 115 116 117
	//!
	/*
	 */
	void addNewLevel();

118 119
	void addNewLevelSqrt3(bool embedNewVertices = false);

120
	void addNewLevelSqrt3(bool embedNewVertices, VertexAttribute<typename PFP::VEC3> position);
121
    void addNewLevelSqrt3Geom(bool embedNewVertices, VertexAttribute<typename PFP::VEC3> position);
122

123 124 125
	//!
	/*
	 */
126
	//void addNewLevel(bool embedNewVertices);
127 128 129
	//@}

	/*! @name Geometry modification
130
	 *  Analysis / Synthesis
131 132 133
	 *************************************************************************/
	//@{

134
	void setSharingVertexEmbeddings(bool b) { shareVertexEmbeddings = b; }
135

136 137
	void addSynthesisFilter(Algo::MR::Filter* f) { synthesisFilters.push_back(f) ; }
	void addAnalysisFilter(Algo::MR::Filter* f) { analysisFilters.push_back(f) ; }
138

139 140
	void clearSynthesisFilters() { synthesisFilters.clear() ; }
	void clearAnalysisFilters() { analysisFilters.clear() ; }
141

142 143
	void analysis() ;
	void synthesis() ;
144 145 146
	//@}
};

147 148 149 150 151
} // namespace Regular

} // namespace Primal

} // namespace MR
152

153 154
} // namespace Volume

155
} // namespace Algo
156

157
} // namespace CGoGN
158

untereiner's avatar
untereiner committed
159
#include "Algo/Multiresolution/Map3MR/map3MR_PrimalRegular.hpp"
160

161
#endif /* __MAP3MR_PRIMAL__ */