subdivision.h 5.31 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1 2 3
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
4
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg           *
Pierre Kraemer's avatar
Pierre Kraemer committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
*                                                                              *
* 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.           *
*                                                                              *
20
* Web site: http://cgogn.unistra.fr/                                           *
Pierre Kraemer's avatar
Pierre Kraemer committed
21 22 23 24
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

25 26
#ifndef __SUBDIVISION_H__
#define __SUBDIVISION_H__
Pierre Kraemer's avatar
Pierre Kraemer committed
27 28 29

#include <math.h>
#include <vector>
Sylvain Thery's avatar
Sylvain Thery committed
30
#include "Algo/Geometry/centroid.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
31 32 33 34 35 36 37

namespace CGoGN
{

namespace Algo
{

38 39 40
namespace Surface
{

Pierre Kraemer's avatar
Pierre Kraemer committed
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
namespace Modelisation
{

/**
* Triangule a face with central vertex
* @param d dart of face
* @return a dart of the central vertex
*/
template <typename PFP>
Dart trianguleFace(typename PFP::MAP& map, Dart d);

/**
 * Triangule all the faces of the mesh
 */
template <typename PFP, typename EMBV, typename EMB>
Pierre Kraemer's avatar
Pierre Kraemer committed
56
void trianguleFaces(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = allDarts) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
57

58
template <typename PFP>
59
void trianguleFaces(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, const FunctorSelect& selected = allDarts) ;
60

Pierre Kraemer's avatar
Pierre Kraemer committed
61 62 63 64 65 66 67
/**
 * Triangule all the faces of the mesh
 * positions for new vertices are given as face attribute
 */
template <typename PFP>
void trianguleFaces(
	typename PFP::MAP& map,
68
	VertexAttribute<typename PFP::VEC3>& position, const FaceAttribute<typename PFP::VEC3>& positionF,
Pierre Kraemer's avatar
Pierre Kraemer committed
69
	const FunctorSelect& selected = allDarts) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
70

Pierre Kraemer's avatar
Pierre Kraemer committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84
/**
* Quadrangule a face with central vertex
* warning: edges are considered here as already cut !!
* A face with 2n edges give n quads
* @param d dart of face with belong to a vertex introduce when cutting the edge
* @return a dart of central point
*/
template <typename PFP>
Dart quadranguleFace(typename PFP::MAP& map, Dart d);

/**
 * Quadrangule all the faces of the mesh
 */
template <typename PFP, typename EMBV, typename EMB>
Pierre Kraemer's avatar
Pierre Kraemer committed
85
void quadranguleFaces(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = allDarts) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
86

87
template <typename PFP>
88
void quadranguleFaces(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, const FunctorSelect& selected = allDarts) ;
89

Pierre Kraemer's avatar
Pierre Kraemer committed
90 91 92 93
/**
 * Catmull-Clark subdivision scheme
 */
template <typename PFP, typename EMBV, typename EMB>
Pierre Kraemer's avatar
Pierre Kraemer committed
94
void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = allDarts) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
95

96
template <typename PFP>
97
void CatmullClarkSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, const FunctorSelect& selected = allDarts) ;
98

Pierre Kraemer's avatar
Pierre Kraemer committed
99 100 101 102
/**
 * Loop subdivision scheme
 */
template <typename PFP, typename EMBV, typename EMB>
Pierre Kraemer's avatar
Pierre Kraemer committed
103
void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = allDarts) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
104

105
template <typename PFP>
106
void LoopSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, const FunctorSelect& selected = allDarts) ;
107

108 109 110 111

template <typename PFP, typename EMBV, typename EMB>
void TwoNPlusOneSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = allDarts) ;

Sylvain Thery's avatar
Sylvain Thery committed
112 113 114 115 116 117
/**
 * Doo-Sabin subdivision scheme
 */
template <typename PFP>
void DooSabin(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position);

untereiner's avatar
untereiner committed
118 119 120 121 122 123
///**
// * Reverse the orientation of the map
// */
//template <typename PFP>
//void reverseOrientation(typename PFP::MAP& map) ;
//
Pierre Kraemer's avatar
Pierre Kraemer committed
124 125 126 127 128
///**
// * Dual mesh computation
// */
//template <typename PFP>
//void computeDual(typename PFP::MAP& map, const FunctorSelect& selected = allDarts) ;
untereiner's avatar
untereiner committed
129 130 131 132
//
//template <typename PFP>
//void computeDualV2(typename PFP::MAP& map, const FunctorSelect& selected = allDarts) ;
//
Pierre Kraemer's avatar
Pierre Kraemer committed
133 134 135 136 137
///**
// * Sqrt(3) subdivision scheme
// */
//template <typename PFP>
//void Sqrt3Subdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = allDarts) ;
138 139


Sylvain Thery's avatar
Sylvain Thery committed
140 141


Pierre Kraemer's avatar
Pierre Kraemer committed
142 143
} // namespace Modelisation

144 145
}

Pierre Kraemer's avatar
Pierre Kraemer committed
146 147 148 149 150 151 152
} // namespace Algo

} // namespace CGoGN

#include "Algo/Modelisation/subdivision.hpp"

#endif