Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
vtkTensorGlyphColor.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkTensorGlyphColor.h
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 * @class vtkTensorGlyphColor
17 * @brief scale and orient glyph(s) according to eigenvalues and eigenvectors of symmetrical part
18 * of tensor
19 *
20 * vtkTensorGlyphColor is a filter that copies a geometric representation
21 * (specified as polygonal data) to every input point. The geometric
22 * representation, or glyph, can be scaled and/or rotated according to
23 * the tensor at the input point. Scaling and rotation is controlled
24 * by the eigenvalues/eigenvectors of the symmetrical part of the tensor
25 * as follows:
26 * For each tensor, the eigenvalues (and associated eigenvectors) are sorted
27 * to determine the major, medium, and minor eigenvalues/eigenvectors.
28 * The eigenvalue decomposition only makes sense for symmetric tensors,
29 * hence the need to only consider the symmetric part of the tensor, which is
30 * 1/2 (T + T.transposed()).
31 *
32 * If the boolean variable ThreeGlyphs is not set the major eigenvalue
33 * scales the glyph in the x-direction, the medium in the y-direction,
34 * and the minor in the z-direction. Then, the glyph is rotated so
35 * that the glyph's local x-axis lies along the major eigenvector,
36 * y-axis along the medium eigenvector, and z-axis along the minor.
37 *
38 * If the boolean variable ThreeGlyphs is set three glyphs are produced,
39 * each of them oriented along an eigenvector and scaled according to the
40 * corresponding eigenvector.
41 *
42 * If the boolean variable Symmetric is set each glyph is mirrored (2 or 6
43 * glyphs will be produced)
44 *
45 * The x-axis of the source glyph will correspond to the eigenvector
46 * on output. Point (0,0,0) in the source will be placed in the data point.
47 * Variable Length will normally correspond to the distance from the
48 * origin to the tip of the source glyph along the x-axis,
49 * but can be changed to produce other results when Symmetric is on,
50 * e.g. glyphs that do not touch or that overlap.
51 *
52 * Please note that when Symmetric is false it will generally be better
53 * to place the source glyph from (-0.5,0,0) to (0.5,0,0), i.e. centred
54 * at the origin. When symmetric is true the placement from (0,0,0) to
55 * (1,0,0) will generally be more convenient.
56 *
57 * A scale factor is provided to control the amount of scaling. Also, you
58 * can turn off scaling completely if desired. The boolean variable
59 * ClampScaling controls the maximum scaling (in conjunction with
60 * MaxScaleFactor.) This is useful in certain applications where
61 * singularities or large order of magnitude differences exist in
62 * the eigenvalues.
63 *
64 * If the boolean variable ColorGlyphs is set to true the glyphs are
65 * colored. The glyphs can be colored using the input scalars
66 * (SetColorModeToScalars), which is the default, or colored using the
67 * eigenvalues (SetColorModeToEigenvalues).
68 *
69 * Another instance variable, ExtractEigenvalues, has been provided to
70 * control extraction of eigenvalues/eigenvectors. If this boolean is
71 * false, then eigenvalues/eigenvectors are not extracted, and the
72 * columns of the tensor are taken as the eigenvectors (the norm of
73 * column, always positive, is the eigenvalue). This allows
74 * additional capability over the vtkGlyph3D object. That is, the
75 * glyph can be oriented in three directions instead of one.
76 *
77 * @par Thanks:
78 * Thanks to Jose Paulo Moitinho de Almeida for enhancements.
79 *
80 * @sa
81 * vtkGlyph3D vtkPointLoad vtkHyperStreamline
82 */
83
84#ifndef vtkTensorGlyphColor_h
85#define vtkTensorGlyphColor_h
86
87#include <vtkPolyDataAlgorithm.h>
88
89class vtkTensorGlyphColor : public vtkPolyDataAlgorithm
90{
91 public:
93 vtkPolyDataAlgorithm) void PrintSelf(ostream& os, vtkIndent indent) override;
94
95 /**
96 * Construct object with scaling on and scale factor 1.0. Eigenvalues are
97 * extracted, glyphs are colored with input scalar data, and logarithmic
98 * scaling is turned off.
99 */
101
102 //@{
103 /**
104 * Specify the geometry to copy to each point.
105 * Note that this method does not connect the pipeline. The algorithm will
106 * work on the input data as it is without updating the producer of the data.
107 * See SetSourceConnection for connecting the pipeline.
108 */
109 void SetSourceData(vtkPolyData* source);
110 vtkPolyData* GetSource();
111 //@}
112
113 //@{
114 /**
115 * Specify a source object at a specified table location. New style.
116 * Source connection is stored in port 1. This method is equivalent
117 * to SetInputConnection(1, id, outputPort).
118 */
119 void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
120 void SetSourceConnection(vtkAlgorithmOutput* algOutput)
121 {
122 this->SetSourceConnection(0, algOutput);
123 }
124 //@}
125
126 //@{
127 /**
128 * Turn on/off scaling of glyph with eigenvalues.
129 */
130 vtkSetMacro(Scaling, vtkTypeBool);
131 vtkGetMacro(Scaling, vtkTypeBool);
133 //@}
134
135 //@{
136 /**
137 * Specify scale factor to scale object by. (Scale factor always affects
138 * output even if scaling is off.)
139 */
142 //@}
143
144 //@{
145 /**
146 * Turn on/off drawing three glyphs
147 */
151 //@}
152
153 //@{
154 /**
155 * Turn on/off drawing a mirror of each glyph
156 */
157 vtkSetMacro(Symmetric, vtkTypeBool);
158 vtkGetMacro(Symmetric, vtkTypeBool);
160 //@}
161
162 //@{
163 /**
164 * Set/Get the distance, along x, from the origin to the end of the
165 * source glyph. It is used to draw the symmetric glyphs.
166 */
169 //@}
170
171 //@{
172 /**
173 * Turn on/off extraction of eigenvalues from tensor.
174 */
178 //@}
179
180 //@{
181 /**
182 * Turn on/off coloring of glyph with input scalar data or
183 * eigenvalues. If false, or input scalar data not present, then the
184 * scalars from the source object are passed through the filter.
185 */
189 //@}
190
191 enum
192 {
195 };
196
197 //@{
198 /**
199 * Set the color mode to be used for the glyphs. This can be set to
200 * use the input scalars (default) or to use the eigenvalues at the
201 * point. If ThreeGlyphs is set and the eigenvalues are chosen for
202 * coloring then each glyph is colored by the corresponding
203 * eigenvalue and if not set the color corresponding to the largest
204 * eigenvalue is chosen. The recognized values are:
205 * COLOR_BY_SCALARS = 0 (default)
206 * COLOR_BY_EIGENVALUES = 1
207 */
210 void SetColorModeToScalars() { this->SetColorMode(COLOR_BY_SCALARS); };
211 void SetColorModeToEigenvalues() { this->SetColorMode(COLOR_BY_EIGENVALUES); };
212 //@}
213
214 //@{
215 /**
216 * Turn on/off scalar clamping. If scalar clamping is on, the ivar
217 * MaxScaleFactor is used to control the maximum scale factor. (This is
218 * useful to prevent uncontrolled scaling near singularities.)
219 */
223 //@}
224
225 //@{
226 /**
227 * Set/Get the maximum allowable scale factor. This value is compared to the
228 * combination of the scale factor times the eigenvalue. If less, the scale
229 * factor is reset to the MaxScaleFactor. The boolean ClampScaling has to
230 * be "on" for this to work.
231 */
234 //@}
235
236 protected:
240 void operator=(const vtkTensorGlyphColor&) = delete;
241
242 int RequestUpdateExtent(vtkInformation*, vtkInformationVector**,
243 vtkInformationVector*) override;
244 int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
245 int FillInputPortInformation(int port, vtkInformation* info) override;
246
247 vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
248 double ScaleFactor; // Scale factor to use to scale geometry
249 vtkTypeBool ExtractEigenvalues; // Boolean controls eigenfunction extraction
250 vtkTypeBool ColorGlyphs; // Boolean controls coloring with input scalar data
251 int ColorMode; // The coloring mode to use for the glyphs.
252 vtkTypeBool ClampScaling; // Boolean controls whether scaling is clamped.
253 double MaxScaleFactor; // Maximum scale factor (ScaleFactor*eigenvalue)
254 vtkTypeBool ThreeGlyphs; // Boolean controls drawing 1 or 3 glyphs
255 vtkTypeBool Symmetric; // Boolean controls drawing a "mirror" of each glyph
256 double Length; // Distance, in x, from the origin to the end of the glyph
257};
258
259#endif
scale and orient glyph(s) according to eigenvalues and eigenvectors of symmetrical part of tensor
vtkGetMacro(Length, double)
vtkGetMacro(ColorMode, int)
int FillInputPortInformation(int port, vtkInformation *info) override
vtkGetMacro(Scaling, vtkTypeBool)
~vtkTensorGlyphColor() override
vtkSetMacro(ClampScaling, vtkTypeBool)
vtkTensorGlyphColor(const vtkTensorGlyphColor &)=delete
vtkSetMacro(MaxScaleFactor, double)
vtkGetMacro(MaxScaleFactor, double)
vtkSetMacro(ScaleFactor, double)
vtkSetMacro(Length, double)
vtkSetMacro(ColorGlyphs, vtkTypeBool)
vtkBooleanMacro(ThreeGlyphs, vtkTypeBool)
vtkBooleanMacro(ExtractEigenvalues, vtkTypeBool)
vtkSetMacro(ThreeGlyphs, vtkTypeBool)
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
vtkBooleanMacro(Symmetric, vtkTypeBool)
vtkBooleanMacro(Scaling, vtkTypeBool)
vtkGetMacro(ThreeGlyphs, vtkTypeBool)
vtkGetMacro(ExtractEigenvalues, vtkTypeBool)
vtkGetMacro(Symmetric, vtkTypeBool)
vtkGetMacro(ScaleFactor, double)
void operator=(const vtkTensorGlyphColor &)=delete
static vtkTensorGlyphColor * New()
vtkBooleanMacro(ClampScaling, vtkTypeBool)
void SetSourceData(vtkPolyData *source)
vtkSetMacro(Symmetric, vtkTypeBool)
vtkTypeMacro(vtkTensorGlyphColor, vtkPolyDataAlgorithm) void PrintSelf(ostream &os
vtkSetMacro(Scaling, vtkTypeBool)
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
vtkBooleanMacro(ColorGlyphs, vtkTypeBool)
vtkSetClampMacro(ColorMode, int, COLOR_BY_SCALARS, COLOR_BY_EIGENVALUES)
vtkGetMacro(ColorGlyphs, vtkTypeBool)
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
vtkSetMacro(ExtractEigenvalues, vtkTypeBool)
void SetSourceConnection(int id, vtkAlgorithmOutput *algOutput)
vtkGetMacro(ClampScaling, vtkTypeBool)