subdivision.h 4.69 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-2011, 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.u-strasbg.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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51

#include <math.h>
#include <vector>

namespace CGoGN
{

namespace Algo
{

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
52
void trianguleFaces(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = allDarts) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
53

54
template <typename PFP>
Pierre Kraemer's avatar
Pierre Kraemer committed
55
void trianguleFaces(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = allDarts) ;
56

Pierre Kraemer's avatar
Pierre Kraemer committed
57 58 59 60 61 62 63 64
/**
 * 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,
	typename PFP::TVEC3& position, typename PFP::TVEC3& positionF,
Pierre Kraemer's avatar
Pierre Kraemer committed
65
	const FunctorSelect& selected = allDarts) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
66

Pierre Kraemer's avatar
Pierre Kraemer committed
67 68 69 70 71 72 73 74 75 76 77 78 79 80
/**
* 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
81
void quadranguleFaces(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = allDarts) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
82

83
template <typename PFP>
Pierre Kraemer's avatar
Pierre Kraemer committed
84
void quadranguleFaces(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = allDarts) ;
85

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

92
template <typename PFP>
Pierre Kraemer's avatar
Pierre Kraemer committed
93
void CatmullClarkSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = allDarts) ;
94

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

101
template <typename PFP>
Pierre Kraemer's avatar
Pierre Kraemer committed
102
void LoopSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = allDarts) ;
103

104 105 106 107 108 109
/**
 * Reverse the orientation of the map
 */
template <typename PFP>
void reverseOrientation(typename PFP::MAP& map) ;

Pierre Kraemer's avatar
Pierre Kraemer committed
110 111 112
/**
 * Dual mesh computation
 */
113
template <typename PFP>
Pierre Kraemer's avatar
Pierre Kraemer committed
114
void computeDual(typename PFP::MAP& map, const FunctorSelect& selected = allDarts) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
115 116 117 118

/**
 * Sqrt(3) subdivision scheme
 */
119
template <typename PFP>
Pierre Kraemer's avatar
Pierre Kraemer committed
120
void Sqrt3Subdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = allDarts) ;
121 122


Pierre Kraemer's avatar
Pierre Kraemer committed
123 124 125 126 127 128 129 130 131
} // namespace Modelisation

} // namespace Algo

} // namespace CGoGN

#include "Algo/Modelisation/subdivision.hpp"

#endif