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
41 #endif // FEVV_USE_CGAL
42 #ifdef FEVV_USE_OPENMESH
44 #endif // FEVV_USE_OPENMESH
47 #endif // FEVV_USE_AIF
58 #if(FEVV_USE_QT5) // see at the end of .cpp for QT4
59 Q_PLUGIN_METADATA(IID
"CurvaturePlugin")
70 void init()
override {
init(
true,
false, 0.001, 2,
false,
true); }
72 void init(
bool _forceCompute,
76 bool _displayMinDirections,
77 bool _displayMaxDirections)
102 std::cerr <<
"BaseWindow is null or not initialized." << std::endl;
884 template<
typename HalfedgeGraph,
885 typename VertexCurvatureMap,
886 typename VertexColorMap,
889 VertexCurvatureMap &v_cm,
890 VertexColorMap &v_colorm,
891 double MinNrmMinCurvature,
892 double MaxNrmMinCurvature,
893 double MinNrmMaxCurvature,
894 double MaxNrmMaxCurvature,
897 typedef boost::graph_traits< HalfedgeGraph > GraphTraits;
898 typedef typename GraphTraits::vertex_iterator vertex_iterator;
907 vertex_iterator vi = iterator_pair.first;
908 vertex_iterator vi_end = iterator_pair.second;
909 for(; vi != vi_end; ++vi)
912 R = (v_cm[*vi].KminCurv - MinNrmMinCurvature) /
913 (MaxNrmMinCurvature - MinNrmMinCurvature) * 255;
914 else if(ColorField == 2)
915 R = (v_cm[*vi].KmaxCurv - MinNrmMaxCurvature) /
916 (MaxNrmMaxCurvature - MinNrmMaxCurvature) * 255;
922 indiceLut = floor(R);
930 template<
typename HalfedgeGraph,
typename VertexCurvatureMap,
typename GuiPropertiesMap >
932 GuiPropertiesMap &m_gpm,
933 VertexCurvatureMap &v_cm,
934 double &MinNrmMinCurvature,
935 double &MaxNrmMinCurvature,
936 double &MinNrmMaxCurvature,
937 double &MaxNrmMaxCurvature)
939 std::cout <<
"Asking to Curvature mesh ! " << std::endl;
941 auto pm =
get(boost::vertex_point, *_mesh);
965 auto gui_props =
get(m_gpm, 0);
968 put(m_gpm, 0, gui_props);
970 std::cout <<
"Curvature mesh, isGeod: " << *
value_isGeod
976 template<
typename HalfedgeGraph >
978 HalfedgeGraph *_mesh,
981 bool *Cmin_max =
new bool(
false);
982 bool *Dmin_max =
new bool(
false);
996 if(dial1.exec() == QDialog::Accepted)
1026 using VertexCurvatureMapHG =
1030 std::pair< BaseAdapterVisu *, HalfedgeGraph * >,
1031 std::tuple< VertexCurvatureMapHG, std::array< double, 4 > > >
1045 typedef boost::graph_traits< HalfedgeGraph > GraphTraits;
1046 typedef typename GraphTraits::edge_iterator edge_iterator;
1047 edge_iterator eb, ee;
1048 for(boost::tie(eb, ee) =
edges(*_mesh); eb != ee; ++eb)
1049 put(e_colormHG, *eb, VectorHG(1., 1., 1.));
1055 const std::pair< BaseAdapterVisu *, HalfedgeGraph * > p =
1056 std::make_pair(_adapter, _mesh);
1063 map_v_cmHG[p] = std::make_tuple(
1067 std::array< double, 4 >());
1071 std::get< 0 >(map_v_cmHG[p]),
1072 std::get< 1 >(map_v_cmHG[p])[0],
1073 std::get< 1 >(map_v_cmHG[p])[1],
1074 std::get< 1 >(map_v_cmHG[p])[2],
1075 std::get< 1 >(map_v_cmHG[p])[3]);
1079 VertexCurvatureMapHG curvMap = std::get< 0 >(map_v_cmHG[p]);
1082 auto vit_end =
vertices(*_mesh).second;
1083 for(; vit != vit_end; ++vit)
1086 auto curvData =
get(curvMap, *vit);
1087 std::cout <<
"vertex #" << v_count << std::endl;
1088 std::cout <<
"KmaxCurv = " << curvData.KmaxCurv << std::endl;
1089 std::cout <<
"KminCurv = " << curvData.KminCurv << std::endl;
1090 std::cout <<
"VKmaxCurv = " << curvData.VKmaxCurv[0] <<
" "
1091 << curvData.VKmaxCurv[1] <<
" " << curvData.VKmaxCurv[2]
1093 std::cout <<
"VKminCurv = " << curvData.VKminCurv[0] <<
" "
1094 << curvData.VKminCurv[1] <<
" " << curvData.VKminCurv[2]
1104 std::get< 0 >(map_v_cmHG[p]),
1106 std::get< 1 >(map_v_cmHG[p])[0],
1107 std::get< 1 >(map_v_cmHG[p])[1],
1108 std::get< 1 >(map_v_cmHG[p])[2],
1109 std::get< 1 >(map_v_cmHG[p])[3],
1115 using VertexCustomVectorMap =
1117 HalfedgeGraph >::pmap_type;
1119 using VertexCustomVectorColorMap =
1121 HalfedgeGraph >::pmap_type;
1123 using VertexCustomVectorParamMap =
1125 HalfedgeGraph >::pmap_type;
1127 using vertex_iterator =
typename GraphTraits::vertex_iterator;
1129 VertexCustomVectorMap v_CVm;
1132 VertexCustomVectorColorMap v_CVCm;
1135 VertexCustomVectorParamMap v_CVPm;
1138 VertexCurvatureMapHG curvMap = std::get< 0 >(map_v_cmHG[p]);
1140 auto iterator_pair =
vertices(*_mesh);
1141 vertex_iterator vi = iterator_pair.first;
1142 vertex_iterator vi_end = iterator_pair.second;
1143 for (; vi != vi_end; ++vi)
1145 auto curvData =
get(curvMap, *vi);
1149 v_CVm[*vi] = VectorHG(curvData.VKminCurv[0], curvData.VKminCurv[1], curvData.VKminCurv[2]);
1150 v_CVCm[*vi] = VectorHG(139/255.0f, 195/255.0f, 74/255.0f);
1154 v_CVm[*vi] = VectorHG(curvData.VKmaxCurv[0], curvData.VKmaxCurv[1], curvData.VKmaxCurv[2]);
1155 v_CVCm[*vi] = VectorHG(243/255.0f, 156/255.0f, 18/255.0f);
1158 v_CVPm[*vi] = VectorHG(0.25f, 0.25f, 0.08f);
1190 #ifdef FEVV_USE_OPENMESH
1195 applyHG< MeshOpenMesh >(_adapter, _mesh, pmaps_bag);
1199 #ifdef FEVV_USE_CGAL
1200 void apply(BaseAdapterVisu *_adapter,
1204 applyHG< MeshLCC >(_adapter, _mesh, pmaps_bag);
1207 void apply(BaseAdapterVisu *_adapter,
1211 applyHG< MeshSurface >(_adapter, _mesh, pmaps_bag);
1214 void apply(BaseAdapterVisu *_adapter,
1218 applyHG< MeshPolyhedron >(_adapter, _mesh, pmaps_bag);
1223 void apply(BaseAdapterVisu *_adapter,
1227 applyHG< MeshAIF >(_adapter, _mesh, pmaps_bag);
1234 return QStringList() <<
"CurvaturePlugin";