OMToolkit  1.0
The polygonal mesh processing tool.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
OMVisualiser.h
Go to the documentation of this file.
1 //==============================================================================
15 #ifndef _OM_VISUALISER_H_
16 #define _OM_VISUALISER_H_
17 
18 #include <OpenMesh\Core\Mesh\BaseKernel.hh>
19 #include <OpenMesh\Core\IO\importer\ImporterT.hh>
21 
22 namespace OMToolkit {
23 
29 template <class Mesh, class Scalar>
31 {
32  public:
37  OMVisualiser(Mesh *mesh);
38 
44  void ComputeColors(OpenMesh::VPropHandleT<Scalar> vertexProperty, Scalar ommitExtremaPercent);
45 
51  void ComputeColors(OpenMesh::FPropHandleT<Scalar> faceProperty, Scalar ommitExtremaPercent);
52 
59  void getLegend(Scalar &maxBlue, Scalar &maxGreen, Scalar &maxRed);
60 
61  protected:
62 
68  OpenMesh::Vec4uc getColor(Scalar current);
69 
73  Mesh *m_mesh;
74 
78  OpenMesh::IO::ImporterT<Mesh> importer;
79 
83  Scalar m_maxRed;
84 
88  Scalar m_maxGreen;
89 
93  Scalar m_maxBlue;
94 
98  Scalar m_Difference;
99 }; // class OMVisualiser
100 
106 template <class Mesh, class Vector>
107 class OMVectorVisualiser : public OMVisualiser<Mesh, typename Vector::value_type>
108 {
109  protected:
113  typedef typename Vector::value_type Scalar;
114 
115  public:
120  OMVectorVisualiser(Mesh *mesh) : OMVisualiser<Mesh, Scalar>(mesh)
121  {
122  }
123 
130  bool ComputeColors(OpenMesh::VPropHandleT<Vector> vertexProperty, unsigned int vectorComponent, Scalar ommitExtremaPercent);
131 
132 };
133 
141 OpenMesh::Vec4uc getColor(float current, float min, float max);
142 
144 
145 } // namespace OMToolit
146 #endif