45 #define OM_PROPERTY_VISUALIZER_VECTOR_FIELD_DIFFERENCE_CC 47 #include "OMPropertyVisualizerVectorFieldDifference.hh" 49 template <
typename MeshT>
52 propertyInfo2(_propertyInfo2)
54 if (PropertyVisualizer::widget)
delete PropertyVisualizer::widget;
56 w->paramVectorFieldDifference->setTitle(QString(
"3D Vector Field Difference Parameters of ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
57 PropertyVisualizer::widget = w;
60 template <
typename MeshT>
68 template<
typename MeshT>
69 float scalarFn_norm_of_diff(
const typename MeshT::Point &a,
const typename MeshT::Point &b) {
70 return (a - b).norm();
73 template<
typename MeshT>
74 float scalarFn_diff_of_norms(
const typename MeshT::Point &a,
const typename MeshT::Point &b) {
75 return std::fabs(a.norm() - b.norm());
78 template<
typename MeshT>
79 float scalarFn_4_symm_diff(
const typename MeshT::Point &a,
const typename MeshT::Point &b) {
80 double alpha = std::acos((a|b) / a.norm() / b.norm());
81 alpha -= std::floor((alpha + M_PI_4) / M_PI_2) * M_PI_2;
82 return std::fabs(alpha);
86 template<
typename Mesh,
typename Prop1,
typename Prop2,
float (*ScalarFn)(const
typename Prop1::value_type &, const
typename Prop2::value_type &)>
90 mesh(mesh), prop1(prop1), prop2(prop2) { }
92 template<
typename Handle>
93 float operator() (
const Handle &handle)
const {
94 return ScalarFn(mesh.property(prop1, handle), mesh.property(prop2, handle));
103 template<
typename MeshT,
typename IteratorT,
typename PropHandleType,
float (*ScalarFn)(const
typename MeshT::Po
int &, const
typename MeshT::Po
int &)>
106 IteratorT primitivesBegin, IteratorT primitivesEnd) {
107 PropHandleType prop1, prop2;
108 if (!mesh->get_property_handle(prop1, p1.propName()))
return;
109 if (!mesh->get_property_handle(prop2, p2.propName()))
return;
111 std::vector<float> scalars;
112 std::transform(primitivesBegin, primitivesEnd, std::back_inserter(scalars),
115 const float min = *std::min_element(scalars.begin(), scalars.end());
116 const float max = *std::max_element(scalars.begin(), scalars.end());
119 for (std::vector<float>::iterator i = scalars.begin(); i != scalars.end(); ++i)
120 mesh->set_color(*(primitivesBegin++),colCod(*i));
125 template <
typename MeshT>
129 const PropertyInfo p1 = PropertyVisualizer::propertyInfo;
132 if (!mesh->has_face_colors())
133 mesh->request_face_colors();
135 if (w->vecFieldDiff_4symm_rb->isChecked())
137 if (w->vecFieldDiff_diff_norm_rb->isChecked())
139 if (w->vecFieldDiff_norm_diff_rb->isChecked())
146 template <
typename MeshT>
150 const PropertyInfo p1 = PropertyVisualizer::propertyInfo;
153 if (!mesh->has_edge_colors())
154 mesh->request_edge_colors();
156 if (w->vecFieldDiff_4symm_rb->isChecked())
158 if (w->vecFieldDiff_diff_norm_rb->isChecked())
160 if (w->vecFieldDiff_norm_diff_rb->isChecked())
167 template <
typename MeshT>
171 const PropertyInfo p1 = PropertyVisualizer::propertyInfo;
174 if (!mesh->has_halfedge_colors())
175 mesh->request_halfedge_colors();
177 if (w->vecFieldDiff_4symm_rb->isChecked())
179 if (w->vecFieldDiff_diff_norm_rb->isChecked())
181 if (w->vecFieldDiff_norm_diff_rb->isChecked())
188 template <
typename MeshT>
192 const PropertyInfo p1 = PropertyVisualizer::propertyInfo;
195 if (!mesh->has_vertex_colors())
196 mesh->request_vertex_colors();
198 if (w->vecFieldDiff_4symm_rb->isChecked())
200 if (w->vecFieldDiff_diff_norm_rb->isChecked())
202 if (w->vecFieldDiff_norm_diff_rb->isChecked())
DrawMode HALFEDGES_COLORED
draw halfedges with colors (without shading)
DrawMode SOLID_POINTS_COLORED
draw colored, but not lighted faces using interpolated vertex colors
Cellection of information about a property.
DrawMode SOLID_FACES_COLORED
draw colored, but not lighted faces using face colors
DrawMode EDGES_COLORED
draw edges with colors (without shading)
Class for generating nice colors for doubles.
QString getPropertyText(unsigned int index) override
Returns the value of a property in text form.