MEPP2 Project
Collapse_info.h
Go to the documentation of this file.
1 // Copyright (c) 2012-2022 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as
6 // published by the Free Software Foundation; either version 3 of
7 // the License, or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 
12 #pragma once
13 
14 #include <boost/graph/graph_traits.hpp>
16 #include <boost/graph/properties.hpp>
18 #include <vector>
19 #include <map>
20 
21 namespace FEVV {
22 namespace Filters {
27 template<
28  typename HalfedgeGraph,
29  typename PointMap,
30  typename vertex_descriptor =
32  typename halfedge_descriptor =
33  typename boost::graph_traits< HalfedgeGraph >::halfedge_descriptor,
36  typename Geometry = typename FEVV::Geometry_traits< HalfedgeGraph > >
38 {
39 private:
40  HalfedgeGraph &_g;
41  const Geometry _gt;
42  PointMap &_pm;
44  // information set during the edge collapses
49  _v3;
52 
55 
57 
59  // information set during the topology information generation
60  bool _reverse;
61 
67  // information set during the geometry information generation (residuals)
68  std::vector< Vector >
70  int _num_collapse; // only for debug purpose
77 public:
78  Collapse_info(HalfedgeGraph &g, PointMap &pm) : _g(g), _gt(Geometry(_g)), _pm(pm)
79  {
80  _reverse = false;
81  }
83 
84  vertex_descriptor get_vkept() const { return _vkept; }
85 
89  vertex_descriptor get_v3() const { return _v3; }
90 
94  vertex_descriptor get_v4() const { return _v4; }
95 
97  const Point& get_pos_vt() const { return _pos_vt; }
99  const Point& get_pos_vs() const { return _pos_vs; }
101  const Point& get_pos_vkept() const { return _pos_vkept; }
102  const std::vector< Vector >& get_error_prediction() const { return _error_prediction; }
103 
106  bool get_reverse() const { return _reverse; }
107 
108  int get_num_collapse() const { return _num_collapse; }
109  void set_num_collapse(int nb) { _num_collapse = nb; }
110 
114  void record_reverse(bool rev) { _reverse = rev; }
115 
116  void record_v3_v4(halfedge_descriptor h)
117  {
118  _v3 = boost::graph_traits< HalfedgeGraph >::null_vertex();
119  _v4 = boost::graph_traits< HalfedgeGraph >::null_vertex();
120  if(!CGAL::is_border(h, _g))
121  {
122  _v4 = source(prev(h, _g), _g);
123  }
124 
125  if(!CGAL::is_border(opposite(h, _g), _g))
126  {
127  _v3 = source(prev(opposite(h, _g), _g), _g);
128  }
129  }
130 
131  void record_vt_vs_pos(const Point& v1, const Point& v2)
132  {
133  _pos_vt = v1;
134  _pos_vs = v2;
135  }
136 
138  {
139  _vkept = vkept;
140  }
141 
144  void record_error_prediction(const std::vector< Vector >& pred)
145  {
146  _error_prediction = pred;
147  }
148 
150  {
151  _pos_vkept = get(_pm, vkept);
152  }
153 };
154 
155 } // namespace Filters
156 } // namespace FEVV
FEVV::Filters::Collapse_info::get_vkept
vertex_descriptor get_vkept() const
Definition: Collapse_info.h:84
FEVV::Filters::Collapse_info::_reverse
bool _reverse
Definition: Collapse_info.h:60
Parameters.h
FEVV::Filters::Collapse_info::record_error_prediction
void record_error_prediction(const std::vector< Vector > &pred)
Definition: Collapse_info.h:144
FEVV::Filters::Collapse_info::record_v3_v4
void record_v3_v4(halfedge_descriptor h)
Definition: Collapse_info.h:116
FEVV::Filters::Collapse_info::get_reverse
bool get_reverse() const
Definition: Collapse_info.h:106
FEVV::Filters::Collapse_info::get_error_prediction
const std::vector< Vector > & get_error_prediction() const
Definition: Collapse_info.h:102
FEVV::Filters::Collapse_info
Class used to store information on a single edge collapse operation.
Definition: Collapse_info.h:38
FEVV::DataStructures::AIF::opposite
boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::halfedge_descriptor opposite(typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::halfedge_descriptor h, const FEVV::DataStructures::AIF::AIFMesh &sm)
Returns the halfedge with source and target swapped.
Definition: Graph_traits_aif.h:625
FEVV::Geometry_traits
Refer to Geometry_traits_documentation_dummy for further documentation on provided types and algorith...
Definition: Geometry_traits.h:162
FEVV::Filters::Collapse_info::get_pos_vkept
const Point & get_pos_vkept() const
Get edge kept position.
Definition: Collapse_info.h:101
FEVV::Filters::Collapse_info::Collapse_info
Collapse_info(HalfedgeGraph &g, PointMap &pm)
Definition: Collapse_info.h:78
FEVV::Filters::Collapse_info::record_vkept
void record_vkept(vertex_descriptor vkept)
Definition: Collapse_info.h:137
FEVV::Filters::Collapse_info::get_num_collapse
int get_num_collapse() const
Definition: Collapse_info.h:108
FEVV::Filters::Collapse_info::_pos_vt
Point _pos_vt
Definition: Collapse_info.h:54
FEVV::DataStructures::AIF::source
boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::vertex_descriptor source(typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::edge_descriptor e, const FEVV::DataStructures::AIF::AIFMesh &)
Returns the source vertex of e.
Definition: Graph_traits_aif.h:387
FEVV::Filters::Collapse_info::_v4
vertex_descriptor _v4
Definition: Collapse_info.h:51
FEVV::Filters::Collapse_info::record_vt_vs_pos
void record_vt_vs_pos(const Point &v1, const Point &v2)
Definition: Collapse_info.h:131
FEVV::Filters::Collapse_info::get_pos_vs
const Point & get_pos_vs() const
Get edge source vertex position.
Definition: Collapse_info.h:99
FEVV::Filters::Collapse_info::get_pos_vt
const Point & get_pos_vt() const
Get edge target vertex position.
Definition: Collapse_info.h:97
FEVV::get
FEVV::PCLPointCloudPointMap::value_type get(const FEVV::PCLPointCloudPointMap &pm, FEVV::PCLPointCloudPointMap::key_type key)
Specialization of get(point_map, key) for PCLPointCloud.
Definition: Graph_properties_pcl_point_cloud.h:117
FEVV::Filters::Collapse_info::record_pos_vkept
void record_pos_vkept(vertex_descriptor vkept)
Definition: Collapse_info.h:149
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
FEVV::Filters::Collapse_info::set_num_collapse
void set_num_collapse(int nb)
Definition: Collapse_info.h:109
Geometry_traits.h
FEVV::Filters::Collapse_info::_g
HalfedgeGraph & _g
Definition: Collapse_info.h:40
FEVV::DataStructures::AIF::AIFVector
Definition: AIFProperties.h:173
FEVV::Filters::Collapse_info::_vkept
vertex_descriptor _vkept
Definition: Collapse_info.h:45
FEVV::Filters::Collapse_info::_pm
PointMap & _pm
Definition: Collapse_info.h:42
FEVV::Filters::Collapse_info::get_v4
vertex_descriptor get_v4() const
Definition: Collapse_info.h:94
FEVV::Filters::Collapse_info::get_v3
vertex_descriptor get_v3() const
Definition: Collapse_info.h:89
FEVV::DataStructures::AIF::prev
boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::halfedge_descriptor prev(typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::halfedge_descriptor h, const FEVV::DataStructures::AIF::AIFMesh &sm)
Returns the previous halfedge around its face.
Definition: Graph_traits_aif.h:612
FEVV::Filters::Collapse_info::_pos_vs
Point _pos_vs
Definition: Collapse_info.h:54
FEVV::Filters::Collapse_info::_error_prediction
std::vector< Vector > _error_prediction
Definition: Collapse_info.h:69
msdm2::vertex_descriptor
boost::graph_traits< MeshT >::vertex_descriptor vertex_descriptor
Definition: msdm2_surfacemesh.h:33
FEVV::Filters::Collapse_info::~Collapse_info
~Collapse_info()
Definition: Collapse_info.h:82
FEVV::Filters::Collapse_info::_gt
const Geometry _gt
Definition: Collapse_info.h:41
FEVV::Filters::Collapse_info::_pos_vkept
Point _pos_vkept
target and source vertex positions
Definition: Collapse_info.h:56
FEVV::Filters::Collapse_info::_num_collapse
int _num_collapse
Definition: Collapse_info.h:76
FEVV::DataStructures::AIF::AIFPoint
Definition: AIFProperties.h:31
FEVV::Filters::Collapse_info::_v3
vertex_descriptor _v3
Definition: Collapse_info.h:49
FEVV::Filters::Collapse_info::record_reverse
void record_reverse(bool rev)
Definition: Collapse_info.h:114