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
83 #ifndef vtkGlyph3D_h
84 #define vtkGlyph3D_h
85 
86 #include "vtkFiltersCoreModule.h" // For export macro
87 #include "vtkPolyDataAlgorithm.h"
88 
89 #define VTK_SCALE_BY_SCALAR 0
90 #define VTK_SCALE_BY_VECTOR 1
91 #define VTK_SCALE_BY_VECTORCOMPONENTS 2
92 #define VTK_DATA_SCALING_OFF 3
93 
94 #define VTK_COLOR_BY_SCALE 0
95 #define VTK_COLOR_BY_SCALAR 1
96 #define VTK_COLOR_BY_VECTOR 2
97 
98 #define VTK_USE_VECTOR 0
99 #define VTK_USE_NORMAL 1
100 #define VTK_VECTOR_ROTATION_OFF 2
101 #define VTK_FOLLOW_CAMERA_DIRECTION 3
102 
103 #define VTK_INDEXING_OFF 0
104 #define VTK_INDEXING_BY_SCALAR 1
105 #define VTK_INDEXING_BY_VECTOR 2
106 
107 VTK_ABI_NAMESPACE_BEGIN
108 class vtkTransform;
109 
110 class VTKFILTERSCORE_EXPORT vtkGlyph3D : public vtkPolyDataAlgorithm
111 {
112 public:
114  void PrintSelf(ostream& os, vtkIndent indent) override;
115 
122  static vtkGlyph3D* New();
123 
130  void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
131 
138  void SetSourceData(int id, vtkPolyData* pd);
139 
141 
146  void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
148  {
149  this->SetSourceConnection(0, algOutput);
150  }
152 
156  vtkPolyData* GetSource(int id = 0);
157 
159 
162  vtkSetMacro(Scaling, vtkTypeBool);
163  vtkBooleanMacro(Scaling, vtkTypeBool);
164  vtkGetMacro(Scaling, vtkTypeBool);
166 
168 
171  vtkSetMacro(ScaleMode, int);
172  vtkGetMacro(ScaleMode, int);
173  void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
174  void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
176  {
177  this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
178  }
179  void SetScaleModeToDataScalingOff() { this->SetScaleMode(VTK_DATA_SCALING_OFF); }
180  const char* GetScaleModeAsString();
182 
184 
187  vtkSetMacro(ColorMode, int);
188  vtkGetMacro(ColorMode, int);
189  void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
190  void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
191  void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
192  const char* GetColorModeAsString();
194 
196 
199  vtkSetMacro(ScaleFactor, double);
200  vtkGetMacro(ScaleFactor, double);
202 
204 
207  vtkSetVector2Macro(Range, double);
208  vtkGetVectorMacro(Range, double, 2);
210 
212 
215  vtkSetMacro(Orient, vtkTypeBool);
216  vtkBooleanMacro(Orient, vtkTypeBool);
217  vtkGetMacro(Orient, vtkTypeBool);
219 
221 
225  vtkSetMacro(Clamping, vtkTypeBool);
226  vtkBooleanMacro(Clamping, vtkTypeBool);
227  vtkGetMacro(Clamping, vtkTypeBool);
229 
231 
234  vtkSetMacro(VectorMode, int);
235  vtkGetMacro(VectorMode, int);
236  void SetVectorModeToUseVector() { this->SetVectorMode(VTK_USE_VECTOR); }
237  void SetVectorModeToUseNormal() { this->SetVectorMode(VTK_USE_NORMAL); }
240  const char* GetVectorModeAsString();
242 
244 
248  vtkSetVectorMacro(FollowedCameraPosition, double, 3);
249  vtkGetVectorMacro(FollowedCameraPosition, double, 3);
251 
253 
256  vtkSetVectorMacro(FollowedCameraViewUp, double, 3);
257  vtkGetVectorMacro(FollowedCameraViewUp, double, 3);
259 
261 
268  vtkSetMacro(IndexMode, int);
269  vtkGetMacro(IndexMode, int);
270  void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
271  void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
272  void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
273  const char* GetIndexModeAsString();
275 
277 
283  vtkSetMacro(GeneratePointIds, vtkTypeBool);
284  vtkGetMacro(GeneratePointIds, vtkTypeBool);
285  vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
287 
289 
293  vtkSetStringMacro(PointIdsName);
294  vtkGetStringMacro(PointIdsName);
296 
298 
303  vtkSetMacro(FillCellData, vtkTypeBool);
304  vtkGetMacro(FillCellData, vtkTypeBool);
305  vtkBooleanMacro(FillCellData, vtkTypeBool);
307 
312  virtual int IsPointVisible(vtkDataSet*, vtkIdType) { return 1; }
313 
315 
321  vtkGetObjectMacro(SourceTransform, vtkTransform);
323 
327  vtkMTimeType GetMTime() override;
328 
330 
335  vtkSetMacro(OutputPointsPrecision, int);
336  vtkGetMacro(OutputPointsPrecision, int);
338 
339 protected:
341  ~vtkGlyph3D() override;
342 
346 
348 
350 
355  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
356  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output,
357  vtkDataArray* inSScalars, vtkDataArray* inVectors);
359 
360  vtkPolyData** Source; // Geometry to copy to each point
361  vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
362  int ScaleMode; // Scale by scalar value or vector magnitude
363  int ColorMode; // new scalars based on scale, scalar or vector
364  double ScaleFactor; // Scale factor to use to scale geometry
365  double Range[2]; // Range to use to perform scalar scaling
366  int Orient; // boolean controls whether to "orient" data
367  int VectorMode; // Orient/scale via normal or via vector data
368  double
369  FollowedCameraPosition[3]; // glyphs face towards this point in VTK_FOLLOW_CAMERA_DIRECTION mode
370  double FollowedCameraViewUp[3]; // glyph up direction in VTK_FOLLOW_CAMERA_DIRECTION mode
371  vtkTypeBool Clamping; // whether to clamp scale factor
372  int IndexMode; // what to use to index into glyph table
373  vtkTypeBool GeneratePointIds; // produce input points ids for each output point
374  vtkTypeBool FillCellData; // whether to fill output cell data
378 
379 private:
380  vtkGlyph3D(const vtkGlyph3D&) = delete;
381  void operator=(const vtkGlyph3D&) = delete;
382 };
383 
388 {
389  if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
390  {
391  return "ScaleByScalar";
392  }
393  else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
394  {
395  return "ScaleByVector";
396  }
397  else
398  {
399  return "DataScalingOff";
400  }
401 }
402 
407 {
408  if (this->ColorMode == VTK_COLOR_BY_SCALAR)
409  {
410  return "ColorByScalar";
411  }
412  else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
413  {
414  return "ColorByVector";
415  }
416  else
417  {
418  return "ColorByScale";
419  }
420 }
421 
426 {
427  if (this->VectorMode == VTK_USE_VECTOR)
428  {
429  return "UseVector";
430  }
431  else if (this->VectorMode == VTK_USE_NORMAL)
432  {
433  return "UseNormal";
434  }
435  else if (this->VectorMode == VTK_FOLLOW_CAMERA_DIRECTION)
436  {
437  return "FollowCameraDirection";
438  }
439  else
440  {
441  return "VectorRotationOff";
442  }
443 }
444 
449 {
450  if (this->IndexMode == VTK_INDEXING_OFF)
451  {
452  return "IndexingOff";
453  }
454  else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
455  {
456  return "IndexingByScalar";
457  }
458  else
459  {
460  return "IndexingByVector";
461  }
462 }
463 
464 VTK_ABI_NAMESPACE_END
465 #endif
Proxy object to connect input/output ports.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:111
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:270
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:174
int OutputPointsPrecision
Definition: vtkGlyph3D.h:377
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:237
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition: vtkGlyph3D.h:425
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:175
int ScaleMode
Definition: vtkGlyph3D.h:362
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:272
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:173
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:190
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:363
const char * GetIndexModeAsString()
Return the index mode as a character string.
Definition: vtkGlyph3D.h:448
static vtkGlyph3D * New()
Construct object with scaling on, scaling mode is by scalar value, scale factor = 1....
vtkTypeBool Scaling
Definition: vtkGlyph3D.h:361
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:387
int VectorMode
Definition: vtkGlyph3D.h:367
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:236
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:179
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:312
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition: vtkGlyph3D.h:406
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:371
int IndexMode
Definition: vtkGlyph3D.h:372
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:189
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:191
vtkTypeBool FillCellData
Definition: vtkGlyph3D.h:374
vtkPolyData ** Source
Definition: vtkGlyph3D.h:360
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
Definition: vtkGlyph3D.h:147
~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:239
char * PointIdsName
Definition: vtkGlyph3D.h:375
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
double ScaleFactor
Definition: vtkGlyph3D.h:364
vtkTransform * SourceTransform
Definition: vtkGlyph3D.h:376
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:271
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition: vtkGlyph3D.h:130
void SetVectorModeToVectorRotationOff()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:238
vtkTypeBool GeneratePointIds
Definition: vtkGlyph3D.h:373
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:38
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:89
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
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:96
#define VTK_FOLLOW_CAMERA_DIRECTION
Definition: vtkGlyph3D.h:101
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:89
#define VTK_INDEXING_BY_SCALAR
Definition: vtkGlyph3D.h:104
#define VTK_DATA_SCALING_OFF
Definition: vtkGlyph3D.h:92
#define VTK_VECTOR_ROTATION_OFF
Definition: vtkGlyph3D.h:100
#define VTK_COLOR_BY_SCALAR
Definition: vtkGlyph3D.h:95
#define VTK_USE_VECTOR
Definition: vtkGlyph3D.h:98
#define VTK_USE_NORMAL
Definition: vtkGlyph3D.h:99
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:105
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:90
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:103
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:94
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition: vtkGlyph3D.h:91
int vtkIdType
Definition: vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270