feature.h 6.44 KB
Newer Older
julien's avatar
julien committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
* Copyright (C) 2009-2011, 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.u-strasbg.fr/                                         *
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef __ALGO_GEOMETRY_FEATURE_H__
#define __ALGO_GEOMETRY_FEATURE_H__

namespace CGoGN
{

namespace Algo
{

34 35 36
namespace Surface
{

julien's avatar
julien committed
37 38 39
namespace Geometry
{

Pierre Kraemer's avatar
Pierre Kraemer committed
40 41
enum
{
Pierre Kraemer's avatar
Pierre Kraemer committed
42 43 44 45
	EMPTY,
	SEGMENT,
	BARY,
	FEATURE
Pierre Kraemer's avatar
Pierre Kraemer committed
46 47
};

julien's avatar
julien committed
48
typedef struct { Dart d ; float w ; } e0point ;
Pierre Kraemer's avatar
Pierre Kraemer committed
49
typedef struct { e0point p1 ; e0point p2 ; unsigned char type ; } e0segment ;
50
typedef NoTypeNameAttribute<e0segment> ridgeSegment ;
julien's avatar
julien committed
51

julien's avatar
julien committed
52
template <typename PFP>
Pierre Kraemer's avatar
Pierre Kraemer committed
53 54
void featureEdgeDetection(
	typename PFP::MAP& map,
55
	const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
56
	CellMarker<typename PFP::MAP, EDGE>& featureEdge) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
57 58 59 60

template <typename PFP>
void computeFaceGradient(
	typename PFP::MAP& map,
61 62 63 64
	const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
	const FaceAttribute<typename PFP::VEC3, typename PFP::MAP>& face_normal,
	const VertexAttribute<typename PFP::REAL, typename PFP::MAP>& scalar,
	const FaceAttribute<typename PFP::REAL, typename PFP::MAP>& face_area,
Sylvain Thery's avatar
Sylvain Thery committed
65
	FaceAttribute<typename PFP::VEC3, typename PFP::MAP>& face_gradient) ;
66 67 68 69 70

template <typename PFP>
typename PFP::VEC3 faceGradient(
	typename PFP::MAP& map,
	Dart d,
71 72 73 74
	const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
	const FaceAttribute<typename PFP::VEC3, typename PFP::MAP>& face_normal,
	const VertexAttribute<typename PFP::REAL, typename PFP::MAP>& scalar,
	const FaceAttribute<typename PFP::REAL, typename PFP::MAP>& face_area) ;
75 76 77 78

template <typename PFP>
void computeVertexGradient(
	typename PFP::MAP& map,
79 80
	const FaceAttribute<typename PFP::VEC3, typename PFP::MAP>& face_gradient,
	const FaceAttribute<typename PFP::REAL, typename PFP::MAP>& face_area,
Sylvain Thery's avatar
Sylvain Thery committed
81
	VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& vertex_gradient) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
82

83 84 85 86
template <typename PFP>
typename PFP::VEC3 vertexGradient(
	typename PFP::MAP& map,
	Dart d,
87 88
	const FaceAttribute<typename PFP::VEC3, typename PFP::MAP>& face_gradient,
	const FaceAttribute<typename PFP::REAL, typename PFP::MAP>& area) ;
89

Pierre Kraemer's avatar
Pierre Kraemer committed
90
//template <typename PFP>
91
//typename PFP::REAL extremality(
Pierre Kraemer's avatar
Pierre Kraemer committed
92
//	typename PFP::MAP& map,
93 94
//	Dart d,
//	const typename PFP::VEC3& K,
95 96
//	const FaceAttribute<typename PFP::VEC3>& face_gradient,
//	const FaceAttribute<typename PFP::REAL>& face_area) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
97 98 99 100

template <typename PFP>
void computeTriangleType(
	typename PFP::MAP& map,
101
	const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& K,
Sylvain Thery's avatar
Sylvain Thery committed
102
	CellMarker<typename PFP::MAP, FACE>& regularMarker) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
103 104

template <typename PFP>
105 106 107
bool isTriangleRegular(
	typename PFP::MAP& map,
	Dart d,
108
	const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& K) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
109 110 111 112

template <typename PFP>
void initRidgeSegments(
	typename PFP::MAP& map,
Sylvain Thery's avatar
Sylvain Thery committed
113
	FaceAttribute<ridgeSegment, typename PFP::MAP>& ridge_segments) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
114 115

template <typename PFP>
116
void computeRidgeLines(
Pierre Kraemer's avatar
Pierre Kraemer committed
117
	typename PFP::MAP& map,
118
	CellMarker<typename PFP::MAP, FACE>& regularMarker,
119 120 121 122 123
	const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
	const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& K,
	const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& vertex_gradient,
	const VertexAttribute<typename PFP::REAL, typename PFP::MAP>& k,
	const VertexAttribute<typename PFP::REAL, typename PFP::MAP>& k2,
Sylvain Thery's avatar
Sylvain Thery committed
124
	FaceAttribute<ridgeSegment, typename PFP::MAP>& ridge_segments) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
125 126 127 128 129

template <typename PFP>
void ridgeLines(
	typename PFP::MAP& map,
	Dart d,
130 131 132 133 134 135 136
	const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
	const FaceAttribute<typename PFP::VEC3, typename PFP::MAP>& face_area,
	const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& K,
	const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& vertex_gradient,
	const VertexAttribute<typename PFP::REAL, typename PFP::MAP>& k,
	const VertexAttribute<typename PFP::REAL, typename PFP::MAP>& k2,
	FaceAttribute<ridgeSegment, typename PFP::MAP>& ridge_segments) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
137

138 139 140
template <typename PFP>
void computeSingularTriangle(
	typename PFP::MAP& map,
141
	CellMarker<typename PFP::MAP, FACE>& regularMarker,
Sylvain Thery's avatar
Sylvain Thery committed
142
	FaceAttribute<ridgeSegment, typename PFP::MAP>& ridge_segments) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
143 144 145 146 147

template <typename PFP>
void singularTriangle(
	typename PFP::MAP& map,
	Dart d,
148
	CellMarker<typename PFP::MAP, FACE>& regularMarker,
149
	FaceAttribute<ridgeSegment, typename PFP::MAP>& ridge_segments) ;
julien's avatar
julien committed
150 151

template <typename PFP>
152 153 154 155
bool isEdgeInTriangle(
	typename PFP::MAP& map,
	Dart edge,
	Dart triangle) ;
julien's avatar
julien committed
156

157 158 159 160
template <typename PFP>
std::vector<typename PFP::VEC3> occludingContoursDetection(
	typename PFP::MAP& map,
	const typename PFP::VEC3& cameraPosition,
161 162
	const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
	const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& normal) ;
163

julien's avatar
julien committed
164 165
} // namespace Geometry

166
} // namespace Surface
167

julien's avatar
julien committed
168 169 170 171 172 173 174
} // namespace Algo

} // namespace CGoGN

#include "Algo/Geometry/feature.hpp"

#endif