VTK  9.2.6
vtkGlyph3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGlyph3D.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 =========================================================================*/
86 #ifndef vtkGlyph3D_h
87 #define vtkGlyph3D_h
88 
89 #include "vtkFiltersCoreModule.h" // For export macro
90 #include "vtkPolyDataAlgorithm.h"
91 
92 #define VTK_SCALE_BY_SCALAR 0
93 #define VTK_SCALE_BY_VECTOR 1
94 #define VTK_SCALE_BY_VECTORCOMPONENTS 2
95 #define VTK_DATA_SCALING_OFF 3
96 
97 #define VTK_COLOR_BY_SCALE 0
98 #define VTK_COLOR_BY_SCALAR 1
99 #define VTK_COLOR_BY_VECTOR 2
100 
101 #define VTK_USE_VECTOR 0
102 #define VTK_USE_NORMAL 1
103 #define VTK_VECTOR_ROTATION_OFF 2
104 #define VTK_FOLLOW_CAMERA_DIRECTION 3
105 
106 #define VTK_INDEXING_OFF 0
107 #define VTK_INDEXING_BY_SCALAR 1
108 #define VTK_INDEXING_BY_VECTOR 2
109 
110 class vtkTransform;
111 
112 class VTKFILTERSCORE_EXPORT vtkGlyph3D : public vtkPolyDataAlgorithm
113 {
114 public:
116  void PrintSelf(ostream& os, vtkIndent indent) override;
117 
124  static vtkGlyph3D* New();
125 
132  void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
133 
140  void SetSourceData(int id, vtkPolyData* pd);
141 
143 
148  void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
150  {
151  this->SetSourceConnection(0, algOutput);
152  }
154 
158  vtkPolyData* GetSource(int id = 0);
159 
161 
164  vtkSetMacro(Scaling, vtkTypeBool);
165  vtkBooleanMacro(Scaling, vtkTypeBool);
166  vtkGetMacro(Scaling, vtkTypeBool);
168 
170 
173  vtkSetMacro(ScaleMode, int);
174  vtkGetMacro(ScaleMode, int);
175  void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
176  void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
178  {
179  this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
180  }
181  void SetScaleModeToDataScalingOff() { this->SetScaleMode(VTK_DATA_SCALING_OFF); }
182  const char* GetScaleModeAsString();
184 
186 
189  vtkSetMacro(ColorMode, int);
190  vtkGetMacro(ColorMode, int);
191  void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
192  void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
193  void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
194  const char* GetColorModeAsString();
196 
198 
201  vtkSetMacro(ScaleFactor, double);
202  vtkGetMacro(ScaleFactor, double);
204 
206 
209  vtkSetVector2Macro(Range, double);
210  vtkGetVectorMacro(Range, double, 2);
212 
214 
217  vtkSetMacro(Orient, vtkTypeBool);
218  vtkBooleanMacro(Orient, vtkTypeBool);
219  vtkGetMacro(Orient, vtkTypeBool);
221 
223 
227  vtkSetMacro(Clamping, vtkTypeBool);
228  vtkBooleanMacro(Clamping, vtkTypeBool);
229  vtkGetMacro(Clamping, vtkTypeBool);
231 
233 
236  vtkSetMacro(VectorMode, int);
237  vtkGetMacro(VectorMode, int);
238  void SetVectorModeToUseVector() { this->SetVectorMode(VTK_USE_VECTOR); }
239  void SetVectorModeToUseNormal() { this->SetVectorMode(VTK_USE_NORMAL); }
242  const char* GetVectorModeAsString();
244 
246 
250  vtkSetVectorMacro(FollowedCameraPosition, double, 3);
251  vtkGetVectorMacro(FollowedCameraPosition, double, 3);
253 
255 
258  vtkSetVectorMacro(FollowedCameraViewUp, double, 3);
259  vtkGetVectorMacro(FollowedCameraViewUp, double, 3);
261 
263 
270  vtkSetMacro(IndexMode, int);
271  vtkGetMacro(IndexMode, int);
272  void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
273  void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
274  void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
275  const char* GetIndexModeAsString();
277 
279 
285  vtkSetMacro(GeneratePointIds, vtkTypeBool);
286  vtkGetMacro(GeneratePointIds, vtkTypeBool);
287  vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
289 
291 
295  vtkSetStringMacro(PointIdsName);
296  vtkGetStringMacro(PointIdsName);
298 
300 
305  vtkSetMacro(FillCellData, vtkTypeBool);
306  vtkGetMacro(FillCellData, vtkTypeBool);
307  vtkBooleanMacro(FillCellData, vtkTypeBool);
309 
314  virtual int IsPointVisible(vtkDataSet*, vtkIdType) { return 1; }
315 
317 
322  void SetSourceTransform(vtkTransform*);
323  vtkGetObjectMacro(SourceTransform, vtkTransform);
325 
329  vtkMTimeType GetMTime() override;
330 
332 
337  vtkSetMacro(OutputPointsPrecision, int);
338  vtkGetMacro(OutputPointsPrecision, int);
340 
341 protected:
342  vtkGlyph3D();
343  ~vtkGlyph3D() override;
344 
347  int FillInputPortInformation(int, vtkInformation*) override;
348 
349  vtkPolyData* GetSource(int idx, vtkInformationVector* sourceInfo);
350 
352 
357  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
358  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output,
359  vtkDataArray* inSScalars, vtkDataArray* inVectors);
361 
362  vtkPolyData** Source; // Geometry to copy to each point
363  vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
364  int ScaleMode; // Scale by scalar value or vector magnitude
365  int ColorMode; // new scalars based on scale, scalar or vector
366  double ScaleFactor; // Scale factor to use to scale geometry
367  double Range[2]; // Range to use to perform scalar scaling
368  int Orient; // boolean controls whether to "orient" data
369  int VectorMode; // Orient/scale via normal or via vector data
370  double
371  FollowedCameraPosition[3]; // glyphs face towards this point in VTK_FOLLOW_CAMERA_DIRECTION mode
372  double FollowedCameraViewUp[3]; // glyph up direction in VTK_FOLLOW_CAMERA_DIRECTION mode
373  vtkTypeBool Clamping; // whether to clamp scale factor
374  int IndexMode; // what to use to index into glyph table
375  vtkTypeBool GeneratePointIds; // produce input points ids for each output point
376  vtkTypeBool FillCellData; // whether to fill output cell data
380 
381 private:
382  vtkGlyph3D(const vtkGlyph3D&) = delete;
383  void operator=(const vtkGlyph3D&) = delete;
384 };
385 
390 {
391  if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
392  {
393  return "ScaleByScalar";
394  }
395  else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
396  {
397  return "ScaleByVector";
398  }
399  else
400  {
401  return "DataScalingOff";
402  }
403 }
404 
409 {
410  if (this->ColorMode == VTK_COLOR_BY_SCALAR)
411  {
412  return "ColorByScalar";
413  }
414  else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
415  {
416  return "ColorByVector";
417  }
418  else
419  {
420  return "ColorByScale";
421  }
422 }
423 
428 {
429  if (this->VectorMode == VTK_USE_VECTOR)
430  {
431  return "UseVector";
432  }
433  else if (this->VectorMode == VTK_USE_NORMAL)
434  {
435  return "UseNormal";
436  }
437  else if (this->VectorMode == VTK_FOLLOW_CAMERA_DIRECTION)
438  {
439  return "FollowCameraDirection";
440  }
441  else
442  {
443  return "VectorRotationOff";
444  }
445 }
446 
451 {
452  if (this->IndexMode == VTK_INDEXING_OFF)
453  {
454  return "IndexingOff";
455  }
456  else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
457  {
458  return "IndexingByScalar";
459  }
460  else
461  {
462  return "IndexingByVector";
463  }
464 }
465 
466 #endif
#define VTK_FOLLOW_CAMERA_DIRECTION
Definition: vtkGlyph3D.h:104
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:177
#define VTK_USE_NORMAL
Definition: vtkGlyph3D.h:102
const char * GetIndexModeAsString()
Return the index mode as a character string.
Definition: vtkGlyph3D.h:450
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition: vtkGlyph3D.h:132
void SetScaleModeToScaleByVector()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:176
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:191
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:273
vtkTransform * SourceTransform
Definition: vtkGlyph3D.h:378
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition: vtkGlyph3D.h:94
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:175
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
int ScaleMode
Definition: vtkGlyph3D.h:364
int OutputPointsPrecision
Definition: vtkGlyph3D.h:379
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition: vtkGlyph3D.h:408
#define VTK_COLOR_BY_VECTOR
Definition: vtkGlyph3D.h:99
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:92
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
int vtkIdType
Definition: vtkType.h:332
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:93
char * PointIdsName
Definition: vtkGlyph3D.h:377
#define VTK_USE_VECTOR
Definition: vtkGlyph3D.h:101
void SetColorModeToColorByVector()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:193
Proxy object to connect input/output ports.
#define VTK_COLOR_BY_SCALAR
Definition: vtkGlyph3D.h:98
#define VTK_DATA_SCALING_OFF
Definition: vtkGlyph3D.h:95
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:69
auto Range(IterablePtr iterable, Options &&...opts) -> typename detail::IterableTraits< typename detail::StripPointers< IterablePtr >::type >::RangeType
Generate an iterable STL proxy object for a VTK container.
Definition: vtkRange.h:85
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Superclass for algorithms that produce only polydata as output.
#define VTK_INDEXING_BY_SCALAR
Definition: vtkGlyph3D.h:107
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:272
a simple class to control print indentation
Definition: vtkIndent.h:39
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:106
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:192
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:239
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:112
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
virtual vtkMTimeType GetMTime()
Return this object's modified time.
void SetVectorModeToVectorRotationOff()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:240
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:181
#define VTK_VECTOR_ROTATION_OFF
Definition: vtkGlyph3D.h:103
vtkTypeBool GeneratePointIds
Definition: vtkGlyph3D.h:375
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition: vtkGlyph3D.h:427
const char * GetScaleModeAsString()
Return the method of scaling as a descriptive character string.
Definition: vtkGlyph3D.h:389
virtual int IsPointVisible(vtkDataSet *, vtkIdType)
This can be overwritten by subclass to return 0 when a point is blanked.
Definition: vtkGlyph3D.h:314
int IndexMode
Definition: vtkGlyph3D.h:374
void SetVectorModeToFollowCameraDirection()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:241
int ColorMode
Definition: vtkGlyph3D.h:365
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:274
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkTypeBool Clamping
Definition: vtkGlyph3D.h:373
Store zero or more vtkInformation instances.
vtkPolyData ** Source
Definition: vtkGlyph3D.h:362
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:97
vtkTypeBool Scaling
Definition: vtkGlyph3D.h:363
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
Definition: vtkGlyph3D.h:149
vtkTypeBool FillCellData
Definition: vtkGlyph3D.h:376
int VectorMode
Definition: vtkGlyph3D.h:369
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:108
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
double ScaleFactor
Definition: vtkGlyph3D.h:366
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:238