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