vtkSuperquadricTensorGlyphFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: $RCSfile$
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
16 // .NAME vtkSuperquadricTensorGlyphFilter - scale and orient superquadric glyph according to tensor eigenvalues and eigenvectors
17 
18 // .SECTION Description
19 // vtkSuperquadricTensorGlyphFilter is a filter that generates a superquadric
20 // glyph at every point in the input data set. The glyphs are oriented and
21 // scaled according to eigenvalues and eigenvectors of "tensor" data of the
22 // input data set, interpreting the entries of the 3x3 matrix as principal axes
23 // of the superquadric and their norm as the length of these axes. Set both
24 // roundness values to 0.0 to get rectangular glyphs, set them to 1.0 to get
25 // ellipsoidal glyphs, set theta roundness to 1.0 and phi roundness to 0.0 to
26 // get cylindrical glyphs. Other values lead to superquadric glyphs which are
27 // in general favorable as they can be distinguished easily for all view
28 // angles. The Superquadric Tensor Glyph filter operates on any type of data
29 // set. Its output is polygonal.
30 
31 // .SECTION Thanks
32 // This plugin has been developed and contributed by Sven Buijssen, TU
33 // Dortmund, Germany.
34 // Thanks to Bryn Lloyd (blloyd@vision.ee.ethz.ch) at ETH Zuerich for
35 // developing and sharing vtkTensorGlyphFilter, the ancestor of this
36 // filter. That filter's output (i.e. spheres) can be mimicked by setting both
37 // ThetaRoundness and PhiRoundness to 1.0.
38 // Thanks to Gordon Kindlmann for pointing out at VisSym04 that superquadrics
39 // can be put to a good use to visualize tensors and for pointing out to me
40 // an insufficient initial implementation of this filter.
41 
42 // .SECTION See Also
43 // vtkTensorGlyph
44 
45 #ifndef vtkSuperquadricTensorGlyphFilter_h
46 #define vtkSuperquadricTensorGlyphFilter_h
47 
48 #include "vtkPolyDataAlgorithm.h"
49 
51 {
52 public:
54  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
57  // Description:
58  // Set the number of points in the longitude direction. Initial value is 16.
60 
61  // Description:
62  // Set the number of points in the latitude direction. Initial value is 16.
64 
65  // Description:
66  // Set Superquadric east/west roundness.
67  // Values range from 0 (rectangular) to 1 (circular) to higher orders.
68  // Initial value is 1.0.
70 
71  // Description:
72  // Set Superquadric north/south roundness.
73  // Values range from 0 (rectangular) to 1 (circular) to higher orders.
74  // Initial value is 1.0.
76 
77  // Description:
78  // Set/Get roundness for superquadric in case settings are chosen per tensor. Initial value is 1.5.
79  vtkGetMacro(Gamma, double);
80  vtkSetMacro(Gamma, double);
81 
82  // Description:
83  // If true, then set theta and phi roundness settings for superquadric per tensor. False by default.
87 
88  // Description:
89  // If true, then extract eigenvalues from tensor. False by default.
93 
94  // Description:
95  // Turn on/off coloring of glyph with input scalar data or
96  // eigenvalues. If false, or input scalar data not present, then the
97  // scalars from the source object are passed through the filter.
101 
102 //BTX
103  enum
104  {
107  };
108 //ETX
109 
110  // Description:
111  // Set the color mode to be used for the glyphs. This can be set to
112  // use the input scalars (default) or to use the eigenvalues at the
113  // point. If ThreeGlyphs is set and the eigenvalues are chosen for
114  // coloring then each glyph is colored by the corresponding
115  // eigenvalue and if not set the color corresponding to the largest
116  // eigenvalue is chosen. The recognized values are:
117  // COLOR_BY_SCALARS = 0 (default)
118  // COLOR_BY_EIGENVALUES = 1
122  {this->SetColorMode(COLOR_BY_SCALARS);};
124  {this->SetColorMode(COLOR_BY_EIGENVALUES);};
125 
126  // Description:
127  // Set the scale factor of the superquadric. Default is 1.
129 
130  // Description:
131  // Turn on/off scalar clamping. If scalar clamping is on, the ivar
132  // MaxScaleFactor is used to control the maximum scale factor. (This is
133  // useful to prevent uncontrolled scaling near singularities.)
137 
138  // Description:
139  // Set/Get the maximum allowable scale factor. This value is compared to the
140  // combination of the scale factor times the eigenvalue. If less, the scale
141  // factor is reset to the MaxScaleFactor. The boolean ClampScaling has to
142  // be "on" for this to work.
145 
146 
147 protected:
150 
151  /* implementation of algorithm */
152  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
153  virtual int FillInputPortInformation(int port, vtkInformation* info) override;
154  void SetActiveTensors(int, int, int, int, const char *);
155 
159  double PhiRoundness;
160  double ScaleFactor;
161  double Gamma;
164  int ColorGlyphs; // Boolean controls coloring with input scalar data
165  int ColorMode; // The coloring mode to use for the glyphs.
166  int ClampScaling; // Boolean controls whether scaling is clamped.
167  double MaxScaleFactor; // Maximum scale factor (ScaleFactor*eigenvalue)
168 
169 private:
171  void operator=(const vtkSuperquadricTensorGlyphFilter&); // Not implemented.
172 };
173 
174 #endif
Definition: vtkSuperquadricTensorGlyphFilter.h:51
void SetColorModeToScalars()
Definition: vtkSuperquadricTensorGlyphFilter.h:121
vtkSetMacro(PhiRoundness, double)
vtkBooleanMacro(FixedThetaPhiRoundness, int)
vtkSuperquadricTensorGlyphFilter(const vtkSuperquadricTensorGlyphFilter &)
vtkBooleanMacro(ClampScaling, int)
vtkSetMacro(ExtractEigenvalues, int)
double ThetaRoundness
Definition: vtkSuperquadricTensorGlyphFilter.h:158
vtkSetMacro(ScaleFactor, double)
int ThetaResolution
Definition: vtkSuperquadricTensorGlyphFilter.h:156
double Gamma
Definition: vtkSuperquadricTensorGlyphFilter.h:161
vtkTypeMacro(vtkSuperquadricTensorGlyphFilter, vtkPolyDataAlgorithm)
vtkSetMacro(PhiResolution, int)
int ColorMode
Definition: vtkSuperquadricTensorGlyphFilter.h:165
int ExtractEigenvalues
Definition: vtkSuperquadricTensorGlyphFilter.h:163
vtkSetMacro(ThetaResolution, int)
@ COLOR_BY_EIGENVALUES
Definition: vtkSuperquadricTensorGlyphFilter.h:106
@ COLOR_BY_SCALARS
Definition: vtkSuperquadricTensorGlyphFilter.h:105
void SetColorModeToEigenvalues()
Definition: vtkSuperquadricTensorGlyphFilter.h:123
double PhiRoundness
Definition: vtkSuperquadricTensorGlyphFilter.h:159
int PhiResolution
Definition: vtkSuperquadricTensorGlyphFilter.h:157
vtkGetMacro(FixedThetaPhiRoundness, int)
double MaxScaleFactor
Definition: vtkSuperquadricTensorGlyphFilter.h:167
vtkBooleanMacro(ExtractEigenvalues, int)
vtkGetMacro(ExtractEigenvalues, int)
vtkGetMacro(ClampScaling, int)
int FixedThetaPhiRoundness
Definition: vtkSuperquadricTensorGlyphFilter.h:162
vtkGetMacro(MaxScaleFactor, double)
void PrintSelf(ostream &os, vtkIndent indent) override
int ColorGlyphs
Definition: vtkSuperquadricTensorGlyphFilter.h:164
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
vtkBooleanMacro(ColorGlyphs, int)
void SetActiveTensors(int, int, int, int, const char *)
virtual int FillInputPortInformation(int port, vtkInformation *info) override
vtkSetClampMacro(ColorMode, int, COLOR_BY_SCALARS, COLOR_BY_EIGENVALUES)
vtkSetMacro(ThetaRoundness, double)
static vtkSuperquadricTensorGlyphFilter * New()
int ClampScaling
Definition: vtkSuperquadricTensorGlyphFilter.h:166
vtkSetMacro(FixedThetaPhiRoundness, int)
double ScaleFactor
Definition: vtkSuperquadricTensorGlyphFilter.h:160
void operator=(const vtkSuperquadricTensorGlyphFilter &)
vtkSetMacro(MaxScaleFactor, double)
vtkSetMacro(ClampScaling, int)