VTK  9.3.0
vtkGlyph3D.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
74 #ifndef vtkGlyph3D_h
75 #define vtkGlyph3D_h
76 
77 #include "vtkFiltersCoreModule.h" // For export macro
78 #include "vtkPolyDataAlgorithm.h"
79 
80 #define VTK_SCALE_BY_SCALAR 0
81 #define VTK_SCALE_BY_VECTOR 1
82 #define VTK_SCALE_BY_VECTORCOMPONENTS 2
83 #define VTK_DATA_SCALING_OFF 3
84 
85 #define VTK_COLOR_BY_SCALE 0
86 #define VTK_COLOR_BY_SCALAR 1
87 #define VTK_COLOR_BY_VECTOR 2
88 
89 #define VTK_USE_VECTOR 0
90 #define VTK_USE_NORMAL 1
91 #define VTK_VECTOR_ROTATION_OFF 2
92 #define VTK_FOLLOW_CAMERA_DIRECTION 3
93 
94 #define VTK_INDEXING_OFF 0
95 #define VTK_INDEXING_BY_SCALAR 1
96 #define VTK_INDEXING_BY_VECTOR 2
97 
98 VTK_ABI_NAMESPACE_BEGIN
99 class vtkTransform;
100 
101 class VTKFILTERSCORE_EXPORT vtkGlyph3D : public vtkPolyDataAlgorithm
102 {
103 public:
105  void PrintSelf(ostream& os, vtkIndent indent) override;
106 
113  static vtkGlyph3D* New();
114 
121  void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
122 
129  void SetSourceData(int id, vtkPolyData* pd);
130 
132 
137  void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
139  {
140  this->SetSourceConnection(0, algOutput);
141  }
143 
147  vtkPolyData* GetSource(int id = 0);
148 
150 
153  vtkSetMacro(Scaling, vtkTypeBool);
154  vtkBooleanMacro(Scaling, vtkTypeBool);
155  vtkGetMacro(Scaling, vtkTypeBool);
157 
159 
162  vtkSetMacro(ScaleMode, int);
163  vtkGetMacro(ScaleMode, int);
164  void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
165  void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
167  {
168  this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
169  }
170  void SetScaleModeToDataScalingOff() { this->SetScaleMode(VTK_DATA_SCALING_OFF); }
171  const char* GetScaleModeAsString();
173 
175 
178  vtkSetMacro(ColorMode, int);
179  vtkGetMacro(ColorMode, int);
180  void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
181  void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
182  void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
183  const char* GetColorModeAsString();
185 
187 
190  vtkSetMacro(ScaleFactor, double);
191  vtkGetMacro(ScaleFactor, double);
193 
195 
198  vtkSetVector2Macro(Range, double);
199  vtkGetVectorMacro(Range, double, 2);
201 
203 
206  vtkSetMacro(Orient, vtkTypeBool);
207  vtkBooleanMacro(Orient, vtkTypeBool);
208  vtkGetMacro(Orient, vtkTypeBool);
210 
212 
216  vtkSetMacro(Clamping, vtkTypeBool);
217  vtkBooleanMacro(Clamping, vtkTypeBool);
218  vtkGetMacro(Clamping, vtkTypeBool);
220 
222 
225  vtkSetMacro(VectorMode, int);
226  vtkGetMacro(VectorMode, int);
227  void SetVectorModeToUseVector() { this->SetVectorMode(VTK_USE_VECTOR); }
228  void SetVectorModeToUseNormal() { this->SetVectorMode(VTK_USE_NORMAL); }
231  const char* GetVectorModeAsString();
233 
235 
239  vtkSetVectorMacro(FollowedCameraPosition, double, 3);
240  vtkGetVectorMacro(FollowedCameraPosition, double, 3);
242 
244 
247  vtkSetVectorMacro(FollowedCameraViewUp, double, 3);
248  vtkGetVectorMacro(FollowedCameraViewUp, double, 3);
250 
252 
259  vtkSetMacro(IndexMode, int);
260  vtkGetMacro(IndexMode, int);
261  void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
262  void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
263  void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
264  const char* GetIndexModeAsString();
266 
268 
274  vtkSetMacro(GeneratePointIds, vtkTypeBool);
275  vtkGetMacro(GeneratePointIds, vtkTypeBool);
276  vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
278 
280 
284  vtkSetStringMacro(PointIdsName);
285  vtkGetStringMacro(PointIdsName);
287 
289 
294  vtkSetMacro(FillCellData, vtkTypeBool);
295  vtkGetMacro(FillCellData, vtkTypeBool);
296  vtkBooleanMacro(FillCellData, vtkTypeBool);
298 
303  virtual int IsPointVisible(vtkDataSet*, vtkIdType) { return 1; }
304 
306 
312  vtkGetObjectMacro(SourceTransform, vtkTransform);
314 
318  vtkMTimeType GetMTime() override;
319 
321 
326  vtkSetMacro(OutputPointsPrecision, int);
327  vtkGetMacro(OutputPointsPrecision, int);
329 
330 protected:
332  ~vtkGlyph3D() override;
333 
337 
339 
341 
346  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
347  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output,
348  vtkDataArray* inSScalars, vtkDataArray* inVectors);
350 
351  vtkPolyData** Source; // Geometry to copy to each point
352  vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
353  int ScaleMode; // Scale by scalar value or vector magnitude
354  int ColorMode; // new scalars based on scale, scalar or vector
355  double ScaleFactor; // Scale factor to use to scale geometry
356  double Range[2]; // Range to use to perform scalar scaling
357  int Orient; // boolean controls whether to "orient" data
358  int VectorMode; // Orient/scale via normal or via vector data
359  double
360  FollowedCameraPosition[3]; // glyphs face towards this point in VTK_FOLLOW_CAMERA_DIRECTION mode
361  double FollowedCameraViewUp[3]; // glyph up direction in VTK_FOLLOW_CAMERA_DIRECTION mode
362  vtkTypeBool Clamping; // whether to clamp scale factor
363  int IndexMode; // what to use to index into glyph table
364  vtkTypeBool GeneratePointIds; // produce input points ids for each output point
365  vtkTypeBool FillCellData; // whether to fill output cell data
369 
370 private:
371  vtkGlyph3D(const vtkGlyph3D&) = delete;
372  void operator=(const vtkGlyph3D&) = delete;
373 };
374 
379 {
380  if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
381  {
382  return "ScaleByScalar";
383  }
384  else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
385  {
386  return "ScaleByVector";
387  }
388  else
389  {
390  return "DataScalingOff";
391  }
392 }
393 
398 {
399  if (this->ColorMode == VTK_COLOR_BY_SCALAR)
400  {
401  return "ColorByScalar";
402  }
403  else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
404  {
405  return "ColorByVector";
406  }
407  else
408  {
409  return "ColorByScale";
410  }
411 }
412 
417 {
418  if (this->VectorMode == VTK_USE_VECTOR)
419  {
420  return "UseVector";
421  }
422  else if (this->VectorMode == VTK_USE_NORMAL)
423  {
424  return "UseNormal";
425  }
426  else if (this->VectorMode == VTK_FOLLOW_CAMERA_DIRECTION)
427  {
428  return "FollowCameraDirection";
429  }
430  else
431  {
432  return "VectorRotationOff";
433  }
434 }
435 
440 {
441  if (this->IndexMode == VTK_INDEXING_OFF)
442  {
443  return "IndexingOff";
444  }
445  else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
446  {
447  return "IndexingByScalar";
448  }
449  else
450  {
451  return "IndexingByVector";
452  }
453 }
454 
455 VTK_ABI_NAMESPACE_END
456 #endif
Proxy object to connect input/output ports.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:45
abstract class to specify dataset behavior
Definition: vtkDataSet.h:53
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:102
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:261
vtkPolyData * GetSource(int idx, vtkInformationVector *sourceInfo)
void SetSourceData(int id, vtkPolyData *pd)
Specify a source object at a specified table location.
void SetScaleModeToScaleByVector()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:165
int OutputPointsPrecision
Definition: vtkGlyph3D.h:368
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:228
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition: vtkGlyph3D.h:416
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:166
int ScaleMode
Definition: vtkGlyph3D.h:353
vtkPolyData * GetSource(int id=0)
Get a pointer to a source object at a specified table location.
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:263
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:164
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:181
void SetSourceTransform(vtkTransform *)
When set, this is use to transform the source polydata before using it to generate the glyph.
int ColorMode
Definition: vtkGlyph3D.h:354
const char * GetIndexModeAsString()
Return the index mode as a character string.
Definition: vtkGlyph3D.h:439
static vtkGlyph3D * New()
Construct object with scaling on, scaling mode is by scalar value, scale factor = 1....
vtkTypeBool Scaling
Definition: vtkGlyph3D.h:352
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const char * GetScaleModeAsString()
Return the method of scaling as a descriptive character string.
Definition: vtkGlyph3D.h:378
int VectorMode
Definition: vtkGlyph3D.h:358
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:227
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:170
vtkMTimeType GetMTime() override
Overridden to include SourceTransform's MTime.
virtual int IsPointVisible(vtkDataSet *, vtkIdType)
This can be overwritten by subclass to return 0 when a point is blanked.
Definition: vtkGlyph3D.h:303
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition: vtkGlyph3D.h:397
void SetSourceConnection(int id, vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkTypeBool Clamping
Definition: vtkGlyph3D.h:362
int IndexMode
Definition: vtkGlyph3D.h:363
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:180
virtual bool Execute(vtkDataSet *input, vtkInformationVector *sourceVector, vtkPolyData *output, vtkDataArray *inSScalars, vtkDataArray *inVectors)
Method called in RequestData() to do the actual data processing.
void SetColorModeToColorByVector()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:182
vtkTypeBool FillCellData
Definition: vtkGlyph3D.h:365
vtkPolyData ** Source
Definition: vtkGlyph3D.h:351
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
Definition: vtkGlyph3D.h:138
~vtkGlyph3D() override
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
void SetVectorModeToFollowCameraDirection()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:230
char * PointIdsName
Definition: vtkGlyph3D.h:366
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
double ScaleFactor
Definition: vtkGlyph3D.h:355
vtkTransform * SourceTransform
Definition: vtkGlyph3D.h:367
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:262
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition: vtkGlyph3D.h:121
void SetVectorModeToVectorRotationOff()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:229
vtkTypeBool GeneratePointIds
Definition: vtkGlyph3D.h:364
virtual bool Execute(vtkDataSet *input, vtkInformationVector *sourceVector, vtkPolyData *output)
Method called in RequestData() to do the actual data processing.
a simple class to control print indentation
Definition: vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:80
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:50
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:74
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_COLOR_BY_VECTOR
Definition: vtkGlyph3D.h:87
#define VTK_FOLLOW_CAMERA_DIRECTION
Definition: vtkGlyph3D.h:92
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:80
#define VTK_INDEXING_BY_SCALAR
Definition: vtkGlyph3D.h:95
#define VTK_DATA_SCALING_OFF
Definition: vtkGlyph3D.h:83
#define VTK_VECTOR_ROTATION_OFF
Definition: vtkGlyph3D.h:91
#define VTK_COLOR_BY_SCALAR
Definition: vtkGlyph3D.h:86
#define VTK_USE_VECTOR
Definition: vtkGlyph3D.h:89
#define VTK_USE_NORMAL
Definition: vtkGlyph3D.h:90
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:96
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:81
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:94
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:85
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition: vtkGlyph3D.h:82
int vtkIdType
Definition: vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270