VTK  9.7.1
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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
80 
81 #define VTK_SCALE_BY_SCALAR 0
82 #define VTK_SCALE_BY_VECTOR 1
83 #define VTK_SCALE_BY_VECTORCOMPONENTS 2
84 #define VTK_DATA_SCALING_OFF 3
85 
86 #define VTK_COLOR_BY_SCALE 0
87 #define VTK_COLOR_BY_SCALAR 1
88 #define VTK_COLOR_BY_VECTOR 2
89 
90 #define VTK_USE_VECTOR 0
91 #define VTK_USE_NORMAL 1
92 #define VTK_VECTOR_ROTATION_OFF 2
93 #define VTK_FOLLOW_CAMERA_DIRECTION 3
94 
95 #define VTK_INDEXING_OFF 0
96 #define VTK_INDEXING_BY_SCALAR 1
97 #define VTK_INDEXING_BY_VECTOR 2
98 
99 VTK_ABI_NAMESPACE_BEGIN
100 class vtkTransform;
101 
102 class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkGlyph3D : public vtkPolyDataAlgorithm
103 {
104 public:
106  void PrintSelf(ostream& os, vtkIndent indent) override;
107 
114  static vtkGlyph3D* New();
115 
122  void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
123 
130  void SetSourceData(int id, vtkPolyData* pd);
131 
133 
138  void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
140  {
141  this->SetSourceConnection(0, algOutput);
142  }
144 
148  vtkPolyData* GetSource(int id = 0);
149 
151 
154  vtkSetMacro(Scaling, vtkTypeBool);
155  vtkBooleanMacro(Scaling, vtkTypeBool);
156  vtkGetMacro(Scaling, vtkTypeBool);
158 
160 
163  vtkSetMacro(ScaleMode, int);
164  vtkGetMacro(ScaleMode, int);
165  void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
166  void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
168  {
169  this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
170  }
171  void SetScaleModeToDataScalingOff() { this->SetScaleMode(VTK_DATA_SCALING_OFF); }
172  const char* GetScaleModeAsString();
174 
176 
179  vtkSetMacro(ColorMode, int);
180  vtkGetMacro(ColorMode, int);
181  void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
182  void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
183  void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
184  const char* GetColorModeAsString();
186 
188 
191  vtkSetMacro(ScaleFactor, double);
192  vtkGetMacro(ScaleFactor, double);
194 
196 
199  vtkSetVector2Macro(Range, double);
200  vtkGetVectorMacro(Range, double, 2);
202 
204 
207  vtkSetMacro(Orient, vtkTypeBool);
208  vtkBooleanMacro(Orient, vtkTypeBool);
209  vtkGetMacro(Orient, vtkTypeBool);
211 
213 
217  vtkSetMacro(Clamping, vtkTypeBool);
218  vtkBooleanMacro(Clamping, vtkTypeBool);
219  vtkGetMacro(Clamping, vtkTypeBool);
221 
223 
226  vtkSetMacro(VectorMode, int);
227  vtkGetMacro(VectorMode, int);
228  void SetVectorModeToUseVector() { this->SetVectorMode(VTK_USE_VECTOR); }
229  void SetVectorModeToUseNormal() { this->SetVectorMode(VTK_USE_NORMAL); }
232  const char* GetVectorModeAsString();
234 
236 
240  vtkSetVectorMacro(FollowedCameraPosition, double, 3);
241  vtkGetVectorMacro(FollowedCameraPosition, double, 3);
243 
245 
248  vtkSetVectorMacro(FollowedCameraViewUp, double, 3);
249  vtkGetVectorMacro(FollowedCameraViewUp, double, 3);
251 
253 
260  vtkSetMacro(IndexMode, int);
261  vtkGetMacro(IndexMode, int);
262  void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
263  void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
264  void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
265  const char* GetIndexModeAsString();
267 
269 
275  vtkSetMacro(GeneratePointIds, vtkTypeBool);
276  vtkGetMacro(GeneratePointIds, vtkTypeBool);
277  vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
279 
281 
285  vtkSetStringMacro(PointIdsName);
286  vtkGetStringMacro(PointIdsName);
288 
290 
295  vtkSetMacro(FillCellData, vtkTypeBool);
296  vtkGetMacro(FillCellData, vtkTypeBool);
297  vtkBooleanMacro(FillCellData, vtkTypeBool);
299 
304  virtual int IsPointVisible(vtkDataSet*, vtkIdType) { return 1; }
305 
307 
312  void SetSourceTransform(vtkTransform*);
313  vtkGetObjectMacro(SourceTransform, vtkTransform);
315 
319  vtkMTimeType GetMTime() override;
320 
322 
327  vtkSetMacro(OutputPointsPrecision, int);
328  vtkGetMacro(OutputPointsPrecision, int);
330 
331 protected:
332  vtkGlyph3D();
333  ~vtkGlyph3D() override;
334 
337  int FillInputPortInformation(int, vtkInformation*) override;
338 
339  vtkPolyData* GetSource(int idx, vtkInformationVector* sourceInfo);
340 
342 
347  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
348  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output,
349  vtkDataArray* inSScalars, vtkDataArray* inVectors);
351 
352  vtkPolyData** Source; // Geometry to copy to each point
353  vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
354  int ScaleMode; // Scale by scalar value or vector magnitude
355  int ColorMode; // new scalars based on scale, scalar or vector
356  double ScaleFactor; // Scale factor to use to scale geometry
357  double Range[2]; // Range to use to perform scalar scaling
358  int Orient; // boolean controls whether to "orient" data
359  int VectorMode; // Orient/scale via normal or via vector data
360  double
361  FollowedCameraPosition[3]; // glyphs face towards this point in VTK_FOLLOW_CAMERA_DIRECTION mode
362  double FollowedCameraViewUp[3]; // glyph up direction in VTK_FOLLOW_CAMERA_DIRECTION mode
363  vtkTypeBool Clamping; // whether to clamp scale factor
364  int IndexMode; // what to use to index into glyph table
365  vtkTypeBool GeneratePointIds; // produce input points ids for each output point
366  vtkTypeBool FillCellData; // whether to fill output cell data
370 
371 private:
372  vtkGlyph3D(const vtkGlyph3D&) = delete;
373  void operator=(const vtkGlyph3D&) = delete;
374 };
375 
380 {
381  if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
382  {
383  return "ScaleByScalar";
384  }
385  else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
386  {
387  return "ScaleByVector";
388  }
389  else
390  {
391  return "DataScalingOff";
392  }
393 }
394 
399 {
400  if (this->ColorMode == VTK_COLOR_BY_SCALAR)
401  {
402  return "ColorByScalar";
403  }
404  else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
405  {
406  return "ColorByVector";
407  }
408  else
409  {
410  return "ColorByScale";
411  }
412 }
413 
418 {
419  if (this->VectorMode == VTK_USE_VECTOR)
420  {
421  return "UseVector";
422  }
423  else if (this->VectorMode == VTK_USE_NORMAL)
424  {
425  return "UseNormal";
426  }
427  else if (this->VectorMode == VTK_FOLLOW_CAMERA_DIRECTION)
428  {
429  return "FollowCameraDirection";
430  }
431  else
432  {
433  return "VectorRotationOff";
434  }
435 }
436 
441 {
442  if (this->IndexMode == VTK_INDEXING_OFF)
443  {
444  return "IndexingOff";
445  }
446  else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
447  {
448  return "IndexingByScalar";
449  }
450  else
451  {
452  return "IndexingByVector";
453  }
454 }
455 
456 VTK_ABI_NAMESPACE_END
457 #endif
#define VTK_FOLLOW_CAMERA_DIRECTION
Definition: vtkGlyph3D.h:93
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:167
#define VTK_USE_NORMAL
Definition: vtkGlyph3D.h:91
const char * GetIndexModeAsString()
Return the index mode as a character string.
Definition: vtkGlyph3D.h:440
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition: vtkGlyph3D.h:122
void SetScaleModeToScaleByVector()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:166
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:181
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:263
vtkTransform * SourceTransform
Definition: vtkGlyph3D.h:368
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition: vtkGlyph3D.h:83
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:165
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
int ScaleMode
Definition: vtkGlyph3D.h:354
int OutputPointsPrecision
Definition: vtkGlyph3D.h:369
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition: vtkGlyph3D.h:398
#define VTK_COLOR_BY_VECTOR
Definition: vtkGlyph3D.h:88
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:81
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:50
int vtkIdType
Definition: vtkType.h:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:82
char * PointIdsName
Definition: vtkGlyph3D.h:367
#define VTK_USE_VECTOR
Definition: vtkGlyph3D.h:90
void SetColorModeToColorByVector()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:183
Proxy object to connect input/output ports.
#define VTK_COLOR_BY_SCALAR
Definition: vtkGlyph3D.h:87
#define VTK_DATA_SCALING_OFF
Definition: vtkGlyph3D.h:84
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
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
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:96
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:262
a simple class to control print indentation
Definition: vtkIndent.h:28
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:95
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:182
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:229
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:102
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
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:230
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:171
#define VTK_VECTOR_ROTATION_OFF
Definition: vtkGlyph3D.h:92
vtkTypeBool GeneratePointIds
Definition: vtkGlyph3D.h:365
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition: vtkGlyph3D.h:417
const char * GetScaleModeAsString()
Return the method of scaling as a descriptive character string.
Definition: vtkGlyph3D.h:379
virtual int IsPointVisible(vtkDataSet *, vtkIdType)
This can be overwritten by subclass to return 0 when a point is blanked.
Definition: vtkGlyph3D.h:304
int IndexMode
Definition: vtkGlyph3D.h:364
void SetVectorModeToFollowCameraDirection()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:231
int ColorMode
Definition: vtkGlyph3D.h:355
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:264
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkTypeBool Clamping
Definition: vtkGlyph3D.h:363
Store zero or more vtkInformation instances.
#define VTK_MARSHALAUTO
vtkPolyData ** Source
Definition: vtkGlyph3D.h:352
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:86
vtkTypeBool Scaling
Definition: vtkGlyph3D.h:353
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
Definition: vtkGlyph3D.h:139
vtkTypeBool FillCellData
Definition: vtkGlyph3D.h:366
int VectorMode
Definition: vtkGlyph3D.h:359
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:97
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
double ScaleFactor
Definition: vtkGlyph3D.h:356
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:228