51 #define OM_PROPERTY_VISUALIZER_VECTOR_FIELD_DIFFERENCE_CC 53 #include "OMPropertyVisualizerVectorFieldDifference.hh" 55 template <
typename MeshT>
58 propertyInfo2(_propertyInfo2)
60 if (PropertyVisualizer::widget)
delete PropertyVisualizer::widget;
62 w->paramVectorFieldDifference->setTitle(QString(
"3D Vector Field Difference Parameters of ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
63 PropertyVisualizer::widget = w;
66 template <
typename MeshT>
74 template<
typename MeshT>
75 float scalarFn_norm_of_diff(
const typename MeshT::Point &a,
const typename MeshT::Point &b) {
76 return (a - b).norm();
79 template<
typename MeshT>
80 float scalarFn_diff_of_norms(
const typename MeshT::Point &a,
const typename MeshT::Point &b) {
81 return std::fabs(a.norm() - b.norm());
84 template<
typename MeshT>
85 float scalarFn_4_symm_diff(
const typename MeshT::Point &a,
const typename MeshT::Point &b) {
86 double alpha = std::acos((a|b) / a.norm() / b.norm());
87 alpha -= std::floor((alpha + M_PI_4) / M_PI_2) * M_PI_2;
88 return std::fabs(alpha);
92 template<
typename Mesh,
typename Prop1,
typename Prop2,
float (*ScalarFn)(const
typename Prop1::value_type &, const
typename Prop2::value_type &)>
96 mesh(mesh), prop1(prop1), prop2(prop2) { }
98 template<
typename Handle>
99 float operator() (
const Handle &handle)
const {
100 return ScalarFn(mesh.property(prop1, handle), mesh.property(prop2, handle));
109 template<
typename MeshT,
typename IteratorT,
typename PropHandleType,
float (*ScalarFn)(const
typename MeshT::Po
int &, const
typename MeshT::Po
int &)>
112 IteratorT primitivesBegin, IteratorT primitivesEnd) {
113 PropHandleType prop1, prop2;
114 if (!mesh->get_property_handle(prop1, p1.propName()))
return;
115 if (!mesh->get_property_handle(prop2, p2.propName()))
return;
117 std::vector<float> scalars;
118 std::transform(primitivesBegin, primitivesEnd, std::back_inserter(scalars),
121 const float min = *std::min_element(scalars.begin(), scalars.end());
122 const float max = *std::max_element(scalars.begin(), scalars.end());
125 for (std::vector<float>::iterator i = scalars.begin(); i != scalars.end(); ++i)
126 mesh->set_color(*(primitivesBegin++),colCod(*i));
131 template <
typename MeshT>
135 const PropertyInfo p1 = PropertyVisualizer::propertyInfo;
138 if (!mesh->has_face_colors())
139 mesh->request_face_colors();
141 if (w->vecFieldDiff_4symm_rb->isChecked())
143 if (w->vecFieldDiff_diff_norm_rb->isChecked())
145 if (w->vecFieldDiff_norm_diff_rb->isChecked())
152 template <
typename MeshT>
156 const PropertyInfo p1 = PropertyVisualizer::propertyInfo;
159 if (!mesh->has_edge_colors())
160 mesh->request_edge_colors();
162 if (w->vecFieldDiff_4symm_rb->isChecked())
164 if (w->vecFieldDiff_diff_norm_rb->isChecked())
166 if (w->vecFieldDiff_norm_diff_rb->isChecked())
173 template <
typename MeshT>
177 const PropertyInfo p1 = PropertyVisualizer::propertyInfo;
180 if (!mesh->has_halfedge_colors())
181 mesh->request_halfedge_colors();
183 if (w->vecFieldDiff_4symm_rb->isChecked())
185 if (w->vecFieldDiff_diff_norm_rb->isChecked())
187 if (w->vecFieldDiff_norm_diff_rb->isChecked())
194 template <
typename MeshT>
198 const PropertyInfo p1 = PropertyVisualizer::propertyInfo;
201 if (!mesh->has_vertex_colors())
202 mesh->request_vertex_colors();
204 if (w->vecFieldDiff_4symm_rb->isChecked())
206 if (w->vecFieldDiff_diff_norm_rb->isChecked())
208 if (w->vecFieldDiff_norm_diff_rb->isChecked())
Cellection of information about a property.
DrawMode HALFEDGES_COLORED
draw halfedges with colors (without shading)
virtual QString getPropertyText(unsigned int index)
Returns the value of a property in text form.
DrawMode SOLID_FACES_COLORED
draw colored, but not lighted faces using face colors
DrawMode EDGES_COLORED
draw edges with colors (without shading)
DrawMode SOLID_POINTS_COLORED
draw colored, but not lighted faces using interpolated vertex colors
Class for generating nice colors for doubles.
void setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode &_mode, int _viewer)
Set the draw Mode of a Viewer. .