Go to the documentation of this file.
14 #ifndef _SCL_SECURE_NO_WARNINGS
15 #define _SCL_SECURE_NO_WARNINGS
21 #include <QStringList>
24 #ifndef Q_MOC_RUN // MT : very important to avoid the error : ' Parse error at
42 #endif // FEVV_USE_CGAL
43 #ifdef FEVV_USE_OPENMESH
45 #endif // FEVV_USE_OPENMESH
48 #endif // FEVV_USE_AIF
59 #if(FEVV_USE_QT5) // see at the end of .cpp for QT4
60 Q_PLUGIN_METADATA(IID
"CMDMPlugin")
96 std::cerr <<
"BaseWindow is null or not initialized." << std::endl;
109 auto pm_degrad =
get(boost::vertex_point, m_degraded);
110 auto pm_original =
get(boost::vertex_point, m_original);
114 FaceNormalMap fnm_degrad;
117 std::cout <<
"use existing face-normal map for degraded mesh"
124 std::cout <<
"create face-normal map for degraded mesh" << std::endl;
132 FaceNormalMap fnm_original;
135 std::cout <<
"use existing face-normal map for original mesh"
142 std::cout <<
"create face-normal map for original mesh" << std::endl;
148 m_original, pm_original, fnm_original);
154 if(
has_map(pmaps_bag_degraded, std::string(
"v:cmdm")))
157 boost::any_cast< vertex_cmdm_map >(pmaps_bag_degraded.at(
"v:cmdm"));
162 FEVV::make_vertex_property_map< MeshSurface, double >(m_degraded);
163 pmaps_bag_degraded[
"v:cmdm"] = cmdm_pmap;
182 template<
typename HalfedgeGraph >
191 QMessageBox::information(
192 0,
"",
QObject::tr(
"CMDM only works with surface_mesh"));
197 template<
typename HalfedgeGraph >
209 QMessageBox::information(
210 0,
"",
QObject::tr(
"An error occur during CMDM filter processing."));
215 std::vector< FEVV::PMapsContainer * > properties_maps =
218 if(mixed_meshes.
size() == 2)
221 if(mixed_meshes[0].second == mixed_meshes[1].second)
225 if(dialog.exec() == QDialog::Accepted)
231 auto m1 =
static_cast< HalfedgeGraph *
>(mixed_meshes[0].first);
232 auto pmaps_bag1 = properties_maps[0];
233 auto m2 =
static_cast< HalfedgeGraph *
>(mixed_meshes[1].first);
234 auto pmaps_bag2 = properties_maps[1];
241 double CMDM = 0, CMDM_1_2 = 0, CMDM_2_1 = 0;
246 process(*m2, *pmaps_bag2, *m1, *pmaps_bag1, CMDM_1_2, cmdm_pmap_deg,
252 process(*m1, *pmaps_bag1, *m2, *pmaps_bag2, CMDM_2_1, cmdm_pmap_orig,
258 CMDM = (CMDM_1_2 + CMDM_2_1) / 2.;
260 std::cout <<
"CMDM = " << CMDM << std::endl;
265 double max_cmdm_1_2, min_cmdm_1_2, max_cmdm_2_1, min_cmdm_2_1;
301 QMessageBox::information(
305 "CMDM needs 2 meshes with diffuse colors.\nUse MSDM2 Plugin"
306 "for meshes having geometry characteristics only."));
311 QMessageBox::information(
314 QObject::tr(
"CMDM filter can not be applied on meshes "
315 "with different datastructures."));
320 QMessageBox::information(0,
323 "with the same datastructure."));
336 #ifdef FEVV_USE_OPENMESH
341 applyHG< MeshOpenMesh >(_adapter, _mesh, pmaps_bag);
346 void apply(BaseAdapterVisu *_adapter,
350 applyHG< MeshLCC >(_adapter, _mesh, pmaps_bag);
353 void apply(BaseAdapterVisu *_adapter,
357 applyHG< MeshSurface >(_adapter, _mesh, pmaps_bag);
360 void apply(BaseAdapterVisu *_adapter,
364 applyHG< MeshPolyhedron >(_adapter, _mesh, pmaps_bag);
369 void apply(BaseAdapterVisu *_adapter,
373 applyHG< MeshAIF >(_adapter, _mesh, pmaps_bag);
380 return QStringList() <<
"CMDMPlugin";
QStringList Generic_plugins() const override
virtual bool isInit() const
void put_property_map(PropertyT p, const MeshT &, PMapsContainer &pmaps, const typename PMap_traits< PropertyT, MeshT >::pmap_type &pmap)
void compute_min_max_vertices(const HalfedgeGraph &g, const PropertyMap &prop_map, MapType &min_metric, MapType &max_metric)
Compute min and max value of a numerical property map for the vertices of a mesh.
PMap_traits< PropertyT, MeshT >::pmap_type get_property_map(PropertyT p, const MeshT &, const PMapsContainer &pmaps)
CGAL::Linear_cell_complex_for_combinatorial_map< 2, 3, CGALLCCTraits, CGALItem > MeshLCC
double tr(double &n)
Truncate a number to 1/1000 (only if BOOLEAN_OPERATIONS_DEBUG is enable)
bool has_map(const PMapsContainer &pmaps, const std::string &map_name)
(refer to Property Maps API)
This class is intended to provide some standard message boxes to all plugins.
void applyHG(BaseAdapterVisu *_adapter, HalfedgeGraph *, FEVV::PMapsContainer *)
virtual Viewer * getViewer()
Functions to retrieve the name of the datastructure according to the mesh type.
CGAL::Surface_mesh< CGALPoint > MeshSurface
void process(MeshSurface &m_degraded, FEVV::PMapsContainer &pmaps_bag_degraded, MeshSurface &m_original, FEVV::PMapsContainer &pmaps_bag_original, double &CMDM, vertex_cmdm_map &cmdm_pmap, VertexColorMap &v_cm)
typename FEVV::PMap_traits< FEVV::vertex_color_t, FEVV::MeshSurface >::pmap_type VertexColorMap
SimpleWindow is a specialization of QMainWindow. This class the Main Window.
std::map< std::string, boost::any > PMapsContainer
void color_vertices_from_map(const HalfedgeGraph &g, const PropertyMap &prop_map, ColorMap &color_pmap, const MapType min_metric, const MapType max_metric, const ColorMeshLUT &colors=make_LUT())
Fill the color map for the vertices of a mesh using a numerical property map.
void draw_or_redraw_mesh(HalfedgeGraph *_g, PMapsContainer *_pmaps, bool _redraw=false, bool _recomputeNT_if_redraw=false, std::string _mesh_filename=std::string(""), bool _recreateOSGobj_if_redraw=true, float _step=0.)
ColorMeshLUT make_LUT(bool color_in_0_255=true, unsigned int colors_nbr=256, float h1=240, float h2=0)
Create a RGB LUT based on an HSV range. Default range creates a blue-cyan-green-yellow-red gradient.
FEVV::PCLPointCloudPointMap::value_type get(const FEVV::PCLPointCloudPointMap &pm, FEVV::PCLPointCloudPointMap::key_type key)
Specialization of get(point_map, key) for PCLPointCloud.
SimpleViewer is a specialization of osgViewer::CompositeViewer. This class is a widget where we are a...
MixedMeshesVector getMeshes()
void onModificationParam(std::string _pluginName, BasePlugin *_plugin)
Interfaces for plugins These interfaces will be used for different plugins.
std::vector< float > ColorMeshLUT
void getProcess(bool &one_two, bool &two_one, int &scales, bool &colors)
void calculate_face_normals(const HalfedgeGraph &g, const PointMap &pm, FaceNormalMap fnm, const GeometryTraits >)
Calculate "some" normal of all the faces of the considered mesh and populate the argument provided Fa...
std::vector< PMapsContainer * > get_properties_maps()
typename Vertex_pmap_traits< MeshT, ValueT >::pmap_type Vertex_pmap
FEVV::Filters::ColorMeshLUT LUT_CourbureClust
OpenMesh::PolyMesh_ArrayKernelT< MyTraits > MeshOpenMesh
void addParameters(BaseWindow *_window) override
virtual void apply(BaseAdapterVisu *, void *, FEVV::PMapsContainer *) override
double process_CMDM_multires(const HalfedgeGraph &m_poly_degrad, const PointMap &pm_degrad, const FaceNormalMap &fnm_degrad, FEVV::PMapsContainer &pmaps_degrad, const HalfedgeGraph &m_poly_original, const PointMap &pm_original, const FaceNormalMap &fnm_original, FEVV::PMapsContainer &pmaps_original, const int nb_level, VertexCMDMMap &cmdm_pmap, const double maxdim, double &CMDM_value)
void process(HalfedgeGraph &, FEVV::PMapsContainer &, HalfedgeGraph &, FEVV::PMapsContainer &, double &, vertex_cmdm_map &, VertexColorMap &)
bool Generic_plugin(const QString &) override
CGAL::Polyhedron_3< CGALKernel, CGAL::Polyhedron_items_with_id_3 > MeshPolyhedron
FEVV::Vertex_pmap< MeshSurface, double > vertex_cmdm_map
PMap_traits< PropertyT, MeshT >::pmap_type make_property_map(PropertyT, const MeshT &m)
FEVV::DataStructures::AIF::AIFMesh MeshAIF