MSDM
 All Classes Namespaces Files Functions Variables Typedefs Pages
enriched_polyhedron.h
Go to the documentation of this file.
1 
6 #ifndef _POLYGON_MESH_
7 #define _POLYGON_MESH_
8 
13 template <class Refs, class T>
14 class Enriched_facet : public CGAL::HalfedgeDS_face_base<Refs, T>
15 {
16  std::size_t m_tag;
17  Vector_3 m_normal;
18  double m_area;
19 public:
20  Enriched_facet(){}
21 
27  const Vector_3& normal() const { return m_normal; }
28 
31  std::size_t get_tag(){return m_tag;}
32 
35  void set_tag(std::size_t tag){m_tag = tag;}
36 
38  double get_area() const{return m_area;}
39 
44  void update()
45  {
46  Point& p0 = this->halfedge()->vertex()->point();
47  Point& p1 = this->halfedge()->next()->vertex()->point();
48  Point& p2 = this->halfedge()->next()->next()->vertex()->point();
49  m_area = std::sqrt(Triangle(p0, p1, p2).squared_area());
50  m_normal = normalize(K::Plane_3(p0, p1, p2).orthogonal_vector());
51  }
52 };
53 
59 template <class Refs, class Tprev, class Tvertex, class Tface>
60 class Enriched_halfedge : public CGAL::HalfedgeDS_halfedge_base<Refs, Tprev, Tvertex, Tface>
61 {
62 private:
63  std::size_t m_tag;
64 public:
65 
68  std::size_t get_tag(){return m_tag;}
69 
72  void set_tag(std::size_t tag){m_tag = tag;}
73 };
74 
79 template <class Refs, class T>
80 class Enriched_vertex : public CGAL::HalfedgeDS_vertex_base<Refs, T, Point>
81 {
82  std::size_t m_tag;
83  double mp_kmax, mp_kmin, courbureMSDM;
84  double courbureMoyenne, courbureVariance, courbureCoVariance;
85 public:
86 
89 
93  Enriched_vertex(const Point& pt) : CGAL::HalfedgeDS_vertex_base<Refs, T, Point>(pt){}
94 
97  inline std::size_t get_tag() const {return m_tag;}
98 
101  inline void set_tag(std::size_t tag){m_tag = tag;}
102 
105  inline double get_kmax() const {return mp_kmax;}
106 
109  inline void set_kmax(double kmax){mp_kmax = kmax;}
110 
113  inline double get_kmin() const {return mp_kmin;}
114 
117  inline void set_kmin(double kmin){mp_kmin = kmin;}
118 
121  inline double get_courbureMSDM() const {return courbureMSDM;}
122 
125  inline void set_courbureMSDM(double value){courbureMSDM = value;}
126 
127 
134  inline double get_courbureMoyenne() const {return courbureMoyenne;}
135 
136 
143  inline void set_courbureMoyenne(double value){courbureMoyenne = value;}
144 
147  inline double get_courbureVariance() const {return courbureVariance;}
148 
151  inline void set_courbureVariance(double value){courbureVariance = value;}
152 
155  inline double get_courbureCoVariance() const {return courbureCoVariance;}
156 
159  inline void set_courbureCoVariance(double value){courbureCoVariance = value;}
160 };
161 
168 struct Enriched_items : public CGAL::Polyhedron_items_3
169 {
171  template <class Refs, class Traits>
173 
175  template <class Refs, class Traits>
177 
179  template <class Refs, class Traits>
181 };
182 
183 
188 template <class kernel, class items>
189 class Enriched_polyhedron : public CGAL::Polyhedron_3<kernel,items>
190 {
191 private :
192  double maxDim;
193  CGAL::Bbox_3 m_bbox;
194 public :
195 
203  void construct()
204  {
205  std::size_t facet_id = 0;
206  Polyhedron::Facet_iterator fit = facets_begin();
207  CGAL_For_all (fit, facets_end())
208  {
209  fit->set_tag(facet_id++);
210  fit->update();
211  }
212  Polyhedron::Vertex_iterator vi = vertices_begin();
213  std::size_t vertex_id = 0;
214  m_bbox = CGAL::Bbox_3(points_begin()->bbox());
215  CGAL_For_all(vi, vertices_end())
216  {
217  vi->set_tag(vertex_id++);
218  m_bbox += vi->point().bbox();
219  }
220  double X = m_bbox.xmax() - m_bbox.xmin();
221  double Y = m_bbox.ymax() - m_bbox.ymin();
222  double Z = m_bbox.zmax() - m_bbox.zmin();
223  maxDim = std::max(std::max(X, Y), Z);
224  }
225 
227  double getMaxDim() const {return maxDim;}
228 };
229 
230 
231 #endif
double get_kmax() const
Getter to maximum curvature.
Definition: enriched_polyhedron.h:105
const Vector_3 & normal() const
Return facet normal vector.
Definition: enriched_polyhedron.h:27
void set_tag(std::size_t tag)
Setter to facet tag.
Definition: enriched_polyhedron.h:35
K::Vector_3 Vector_3
Definition: Header.h:27
void set_kmax(double kmax)
Setter to maximum curvature.
Definition: enriched_polyhedron.h:109
void set_courbureMSDM(double value)
Setter to MSDM scaled mean curvature.
Definition: enriched_polyhedron.h:125
void update()
Update internal data on the facet.
Definition: enriched_polyhedron.h:44
Vector_3 normalize(const Vector_3 &v)
Normalize a CGAL vector using according to its Euclidean norm.
Definition: Header.h:114
K::Triangle_3 Triangle
Definition: Header.h:25
std::size_t get_tag() const
Getter to vertex tag.
Definition: enriched_polyhedron.h:97
Wrapper for the face used in the custom polyhedron.
Definition: enriched_polyhedron.h:176
double get_area() const
Getter to surface area of the triangle facet.
Definition: enriched_polyhedron.h:38
double get_courbureMSDM() const
Getter to MSDM scaled mean curvature.
Definition: enriched_polyhedron.h:121
double get_kmin() const
Getter to minimum curvature.
Definition: enriched_polyhedron.h:113
double get_courbureVariance() const
Getter to the local weighted variance of maximum curvatures.
Definition: enriched_polyhedron.h:147
Wrapper for the halfedge used in the custom polyhedron.
Definition: enriched_polyhedron.h:180
double get_courbureCoVariance() const
Getter to the local weighted covariance of maximum curvatures.
Definition: enriched_polyhedron.h:155
std::size_t get_tag()
Getter to halfedge tag.
Definition: enriched_polyhedron.h:68
double getMaxDim() const
Return the maximum of the bounding box sides.
Definition: enriched_polyhedron.h:227
void set_courbureMoyenne(double value)
Setter to the local weighted average of maximum curvatures.
Definition: enriched_polyhedron.h:143
void set_tag(std::size_t tag)
Setter to halfedge tag.
Definition: enriched_polyhedron.h:72
Enriched vertex with a tag and maximum principale curvature.
Definition: enriched_polyhedron.h:80
K::Point_3 Point
Definition: Header.h:23
Enriched_vertex()
Default constructor.
Definition: enriched_polyhedron.h:88
void set_courbureCoVariance(double value)
Setter to the local weighted covariance of maximum curvatures.
Definition: enriched_polyhedron.h:159
double get_courbureMoyenne() const
Getter to the local weighted average of maximum curvatures.
Definition: enriched_polyhedron.h:134
void set_courbureVariance(double value)
Setter to the local weighted variance of maximum curvatures.
Definition: enriched_polyhedron.h:151
A redefined items class for the Polyhedron_3.
Definition: enriched_polyhedron.h:168
Enriched facet for CGAL polyhedron adding normal and tag information.
Definition: enriched_polyhedron.h:14
void set_tag(std::size_t tag)
Setter to vertex tag.
Definition: enriched_polyhedron.h:101
Polyhedron class for the MSDM computation.
Definition: enriched_polyhedron.h:189
void construct()
Build information on facet, vertices, surface and bounding box.
Definition: enriched_polyhedron.h:203
void set_kmin(double kmin)
Setter to minimum curvature.
Definition: enriched_polyhedron.h:117
Enriched_vertex(const Point &pt)
Constructor of vertex at a given location.
Definition: enriched_polyhedron.h:93
Enriched halfedge for CGAL polyhedron adding tag information.
Definition: enriched_polyhedron.h:60
Wrapper for the vertex used in the custom polyhedron.
Definition: enriched_polyhedron.h:172
std::size_t get_tag()
Getter to facet tag.
Definition: enriched_polyhedron.h:31