area.h 5.95 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
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef __ALGO_GEOMETRY_AREA_H__
#define __ALGO_GEOMETRY_AREA_H__

namespace CGoGN
{

namespace Algo
{

34 35 36
namespace Surface
{

Pierre Kraemer's avatar
Pierre Kraemer committed
37 38 39
namespace Geometry
{

40 41 42 43 44
//! \brief Compute triangle area
//! @param map
//! @param d
//! @param position
//! @return
Pierre Kraemer's avatar
Pierre Kraemer committed
45
template <typename PFP>
46
typename PFP::REAL triangleArea(typename PFP::MAP& map, Face f, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
47

48 49 50 51 52
//! \brief Compute convex polygonal face area
//! @param map
//! @param d
//! @param position
//! @return
Pierre Kraemer's avatar
Pierre Kraemer committed
53
template <typename PFP>
54
typename PFP::REAL convexFaceArea(typename PFP::MAP& map, Face f, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
55

56 57 58 59
//! \brief Compute the total area of a mesh by summing all face areas.
//! @param map
//! @param position
//! @return
Pierre Kraemer's avatar
Pierre Kraemer committed
60
template <typename PFP>
Sylvain Thery's avatar
Sylvain Thery committed
61
typename PFP::REAL totalArea(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
62

63 64 65 66 67
//! \brief Compute the area of the faces around a vertex.
//! @param map
//! @param d
//! @param position
//! @return
68
template <typename PFP>
69
typename PFP::REAL vertexOneRingArea(typename PFP::MAP& map, Vertex v, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position) ;
70

71
template <typename PFP>
72
typename PFP::REAL vertexBarycentricArea(typename PFP::MAP& map, Vertex v, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position) ;
73

74
template <typename PFP>
75
typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Vertex v, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position) ;
76

77 78 79
template <typename PFP>
typename PFP::REAL  edgeArea(typename PFP::MAP& map, Edge e, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position);

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

83 84 85
template <typename PFP>
void computeAreaEdges(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edge_area);

86
template <typename PFP>
Sylvain Thery's avatar
Sylvain Thery committed
87
void computeOneRingAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& vertex_area) ;
88

89
template <typename PFP>
Sylvain Thery's avatar
Sylvain Thery committed
90
void computeBarycentricAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& vertex_area) ;
91

92
template <typename PFP>
Sylvain Thery's avatar
Sylvain Thery committed
93
void computeVoronoiAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& vertex_area) ;
94

Sylvain Thery's avatar
Sylvain Thery committed
95 96
namespace Parallel
{
97 98 99 100

template <typename PFP>
typename PFP::REAL totalArea(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position) ;

Sylvain Thery's avatar
Sylvain Thery committed
101
template <typename PFP>
102
void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, FaceAttribute<typename PFP::REAL, typename PFP::MAP>& area);
Sylvain Thery's avatar
Sylvain Thery committed
103

104 105 106
template <typename PFP>
void computeAreaEdges(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& area);

Sylvain Thery's avatar
Sylvain Thery committed
107
template <typename PFP>
108
void computeOneRingAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& area);
Sylvain Thery's avatar
Sylvain Thery committed
109 110

template <typename PFP>
111
void computeBarycentricAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& vertex_area);
Sylvain Thery's avatar
Sylvain Thery committed
112 113 114

template <typename PFP>
void computeVoronoiAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& area);
115

Sylvain Thery's avatar
Sylvain Thery committed
116 117
} // namespace Parallel

118

Pierre Kraemer's avatar
Pierre Kraemer committed
119
} // namespace Geometry
Pierre Kraemer's avatar
Pierre Kraemer committed
120

121
} // namespace Surface
122

Pierre Kraemer's avatar
Pierre Kraemer committed
123
} // namespace Algo
Pierre Kraemer's avatar
Pierre Kraemer committed
124

Pierre Kraemer's avatar
Pierre Kraemer committed
125
} // namespace CGoGN
Pierre Kraemer's avatar
Pierre Kraemer committed
126 127 128 129

#include "Algo/Geometry/area.hpp"

#endif