curvature.h 6.4 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef __ALGO_GEOMETRY_CURVATURE_H__
#define __ALGO_GEOMETRY_CURVATURE_H__

#include "Geometry/basic.h"

#include "OpenNL/linear_solver.h"
#include "OpenNL/sparse_matrix.h"
#include "OpenNL/full_vector.h"

namespace CGoGN
{

namespace Algo
{

namespace Geometry
{

typedef CPULinearSolverTraits< SparseMatrix<double>, FullVector<double> > CPUSolverTraits ;

template <typename PFP>
Pierre Kraemer's avatar
Pierre Kraemer committed
46
void computeCurvatureVertices_QuadraticFitting(
Pierre Kraemer's avatar
Pierre Kraemer committed
47
	typename PFP::MAP& map,
48
49
50
51
52
53
	const VertexAttribute<typename PFP::VEC3>& position,
	const VertexAttribute<typename PFP::VEC3>& normal,
	VertexAttribute<typename PFP::REAL>& kmax,
	VertexAttribute<typename PFP::REAL>& kmin,
	VertexAttribute<typename PFP::VEC3>& Kmax,
	VertexAttribute<typename PFP::VEC3>& Kmin,
Pierre Kraemer's avatar
Pierre Kraemer committed
54
	const FunctorSelect& select = allDarts) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
55
56

template <typename PFP>
Pierre Kraemer's avatar
Pierre Kraemer committed
57
void computeCurvatureVertex_QuadraticFitting(
Pierre Kraemer's avatar
Pierre Kraemer committed
58
59
	typename PFP::MAP& map,
	Dart dart,
60
61
62
63
64
65
	const VertexAttribute<typename PFP::VEC3>& position,
	const VertexAttribute<typename PFP::VEC3>& normal,
	VertexAttribute<typename PFP::REAL>& kmax,
	VertexAttribute<typename PFP::REAL>& kmin,
	VertexAttribute<typename PFP::VEC3>& Kmax,
	VertexAttribute<typename PFP::VEC3>& Kmin) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
66
67

template <typename PFP>
Pierre Kraemer's avatar
Pierre Kraemer committed
68
void vertexQuadraticFitting(
Pierre Kraemer's avatar
Pierre Kraemer committed
69
70
71
	typename PFP::MAP& map,
	Dart dart,
	typename PFP::MATRIX33& localFrame,
72
73
	const VertexAttribute<typename PFP::VEC3>& position,
	const VertexAttribute<typename PFP::VEC3>& normal,
Pierre Kraemer's avatar
Pierre Kraemer committed
74
75
76
	float& a, float& b, float& c, float& d, float& e) ;

template <typename PFP>
Pierre Kraemer's avatar
Pierre Kraemer committed
77
void quadraticFittingAddVertexPos(typename PFP::VEC3& v, typename PFP::VEC3& p, typename PFP::MATRIX33& localFrame, LinearSolver<CPUSolverTraits>& solver) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
78
79

template <typename PFP>
Pierre Kraemer's avatar
Pierre Kraemer committed
80
void quadraticFittingAddVertexNormal(typename PFP::VEC3& v, typename PFP::VEC3& n, typename PFP::VEC3& p, typename PFP::MATRIX33& localFrame, LinearSolver<CPUSolverTraits>& solver) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
81
82
83
84
85
86
87
88
89
90
91
/*
template <typename PFP>
void vertexCubicFitting(Dart dart, typename PFP::VEC3& normal, float& a, float& b, float& c, float& d, float& e, float& f, float& g, float& h, float& i) ;

template <typename PFP>
void cubicFittingAddVertexPos(typename PFP::VEC3& v, typename PFP::VEC3& p, typename PFP::MATRIX33& localFrame) ;

template <typename PFP>
void cubicFittingAddVertexNormal(typename PFP::VEC3& v, typename PFP::VEC3& n, typename PFP::VEC3& p, typename PFP::MATRIX33& localFrame) ;
*/

Pierre Kraemer's avatar
Pierre Kraemer committed
92
93
94
95
template <typename PFP>
void computeCurvatureVertices_NormalCycles(
	typename PFP::MAP& map,
	typename PFP::REAL radius,
96
97
98
99
100
101
102
103
	const VertexAttribute<typename PFP::VEC3>& position,
	const VertexAttribute<typename PFP::VEC3>& normal,
	const EdgeAttribute<typename PFP::REAL>& edgeangle,
	VertexAttribute<typename PFP::REAL>& kmax,
	VertexAttribute<typename PFP::REAL>& kmin,
	VertexAttribute<typename PFP::VEC3>& Kmax,
	VertexAttribute<typename PFP::VEC3>& Kmin,
	VertexAttribute<typename PFP::VEC3>& Knormal,
104
	const FunctorSelect& select = allDarts, unsigned int thread=0) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
105
106
107
108
109

template <typename PFP>
void computeCurvatureVertex_NormalCycles(
	typename PFP::MAP& map,
	Dart dart,
110
	typename PFP::REAL radius,
111
112
113
114
115
116
117
	const VertexAttribute<typename PFP::VEC3>& position,
	const VertexAttribute<typename PFP::VEC3>& normal,
	const EdgeAttribute<typename PFP::REAL>& edgeangle,
	VertexAttribute<typename PFP::REAL>& kmax,
	VertexAttribute<typename PFP::REAL>& kmin,
	VertexAttribute<typename PFP::VEC3>& Kmax,
	VertexAttribute<typename PFP::VEC3>& Kmin,
118
	VertexAttribute<typename PFP::VEC3>& Knormal, unsigned int thread=0) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
119

Sylvain Thery's avatar
Sylvain Thery committed
120

Pierre Kraemer's avatar
Pierre Kraemer committed
121

122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
namespace Parallel
{
template <typename PFP>
void computeCurvatureVertices_NormalCycles(
	typename PFP::MAP& map,
	typename PFP::REAL radius,
	const VertexAttribute<typename PFP::VEC3>& position,
	const VertexAttribute<typename PFP::VEC3>& normal,
	const EdgeAttribute<typename PFP::REAL>& edgeangle,
	VertexAttribute<typename PFP::REAL>& kmax,
	VertexAttribute<typename PFP::REAL>& kmin,
	VertexAttribute<typename PFP::VEC3>& Kmax,
	VertexAttribute<typename PFP::VEC3>& Kmin,
	VertexAttribute<typename PFP::VEC3>& Knormal,
	const FunctorSelect& select = allDarts, unsigned int nbth = 0, unsigned int current_thread=0) ;

Sylvain Thery's avatar
Sylvain Thery committed
138
139
140
141
142
143
144
145
146
147
148
149
150
template <typename PFP>
void computeCurvatureVertices_QuadraticFitting(
	typename PFP::MAP& map,
	const VertexAttribute<typename PFP::VEC3>& position,
	const VertexAttribute<typename PFP::VEC3>& normal,
	VertexAttribute<typename PFP::REAL>& kmax,
	VertexAttribute<typename PFP::REAL>& kmin,
	VertexAttribute<typename PFP::VEC3>& Kmax,
	VertexAttribute<typename PFP::VEC3>& Kmin,
	const FunctorSelect& select = allDarts, unsigned int nbth=0, unsigned int current_thread=0);

} // namespace Parallel

151

Sylvain Thery's avatar
Sylvain Thery committed
152
} // namespace Geometry
153

Pierre Kraemer's avatar
Pierre Kraemer committed
154
155
156
157
158
159
160
} // namespace Algo

} // namespace CGoGN

#include "Algo/Geometry/curvature.hpp"

#endif