VTK  9.3.20240425
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
183#ifndef vtkGlyph3D_h
184#define vtkGlyph3D_h
185
186#include "vtkFiltersCoreModule.h" // For export macro
187#include "vtkPolyDataAlgorithm.h"
188
189#define VTK_SCALE_BY_SCALAR 0
190#define VTK_SCALE_BY_VECTOR 1
191#define VTK_SCALE_BY_VECTORCOMPONENTS 2
192#define VTK_DATA_SCALING_OFF 3
193
194#define VTK_COLOR_BY_SCALE 0
195#define VTK_COLOR_BY_SCALAR 1
196#define VTK_COLOR_BY_VECTOR 2
197
198#define VTK_USE_VECTOR 0
199#define VTK_USE_NORMAL 1
200#define VTK_VECTOR_ROTATION_OFF 2
201#define VTK_FOLLOW_CAMERA_DIRECTION 3
202
203#define VTK_INDEXING_OFF 0
204#define VTK_INDEXING_BY_SCALAR 1
205#define VTK_INDEXING_BY_VECTOR 2
206
207VTK_ABI_NAMESPACE_BEGIN
208class vtkTransform;
209
210class VTKFILTERSCORE_EXPORT vtkGlyph3D : public vtkPolyDataAlgorithm
211{
212public:
214 void PrintSelf(ostream& os, vtkIndent indent) override;
215
222 static vtkGlyph3D* New();
223
230 void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
231
238 void SetSourceData(int id, vtkPolyData* pd);
239
241
246 void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
248 {
249 this->SetSourceConnection(0, algOutput);
250 }
252
256 vtkPolyData* GetSource(int id = 0);
257
259
262 vtkSetMacro(Scaling, vtkTypeBool);
263 vtkBooleanMacro(Scaling, vtkTypeBool);
264 vtkGetMacro(Scaling, vtkTypeBool);
266
268
271 vtkSetMacro(ScaleMode, int);
272 vtkGetMacro(ScaleMode, int);
273 void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
274 void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
276 {
277 this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
278 }
280 const char* GetScaleModeAsString();
282
284
287 vtkSetMacro(ColorMode, int);
288 vtkGetMacro(ColorMode, int);
289 void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
290 void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
291 void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
292 const char* GetColorModeAsString();
294
296
299 vtkSetMacro(ScaleFactor, double);
300 vtkGetMacro(ScaleFactor, double);
302
304
307 vtkSetVector2Macro(Range, double);
308 vtkGetVectorMacro(Range, double, 2);
310
312
315 vtkSetMacro(Orient, vtkTypeBool);
316 vtkBooleanMacro(Orient, vtkTypeBool);
317 vtkGetMacro(Orient, vtkTypeBool);
319
321
325 vtkSetMacro(Clamping, vtkTypeBool);
326 vtkBooleanMacro(Clamping, vtkTypeBool);
327 vtkGetMacro(Clamping, vtkTypeBool);
329
331
334 vtkSetMacro(VectorMode, int);
335 vtkGetMacro(VectorMode, int);
336 void SetVectorModeToUseVector() { this->SetVectorMode(VTK_USE_VECTOR); }
337 void SetVectorModeToUseNormal() { this->SetVectorMode(VTK_USE_NORMAL); }
340 const char* GetVectorModeAsString();
342
344
348 vtkSetVectorMacro(FollowedCameraPosition, double, 3);
349 vtkGetVectorMacro(FollowedCameraPosition, double, 3);
351
353
356 vtkSetVectorMacro(FollowedCameraViewUp, double, 3);
357 vtkGetVectorMacro(FollowedCameraViewUp, double, 3);
359
361
368 vtkSetMacro(IndexMode, int);
369 vtkGetMacro(IndexMode, int);
370 void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
371 void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
372 void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
373 const char* GetIndexModeAsString();
375
377
383 vtkSetMacro(GeneratePointIds, vtkTypeBool);
384 vtkGetMacro(GeneratePointIds, vtkTypeBool);
385 vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
387
389
393 vtkSetStringMacro(PointIdsName);
394 vtkGetStringMacro(PointIdsName);
396
398
403 vtkSetMacro(FillCellData, vtkTypeBool);
404 vtkGetMacro(FillCellData, vtkTypeBool);
405 vtkBooleanMacro(FillCellData, vtkTypeBool);
407
412 virtual int IsPointVisible(vtkDataSet*, vtkIdType) { return 1; }
413
415
421 vtkGetObjectMacro(SourceTransform, vtkTransform);
423
428
430
435 vtkSetMacro(OutputPointsPrecision, int);
436 vtkGetMacro(OutputPointsPrecision, int);
438
439protected:
441 ~vtkGlyph3D() override;
442
446
448
450
455 virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
456 virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output,
457 vtkDataArray* inSScalars, vtkDataArray* inVectors);
459
460 vtkPolyData** Source; // Geometry to copy to each point
461 vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
462 int ScaleMode; // Scale by scalar value or vector magnitude
463 int ColorMode; // new scalars based on scale, scalar or vector
464 double ScaleFactor; // Scale factor to use to scale geometry
465 double Range[2]; // Range to use to perform scalar scaling
466 int Orient; // boolean controls whether to "orient" data
467 int VectorMode; // Orient/scale via normal or via vector data
468 double
469 FollowedCameraPosition[3]; // glyphs face towards this point in VTK_FOLLOW_CAMERA_DIRECTION mode
470 double FollowedCameraViewUp[3]; // glyph up direction in VTK_FOLLOW_CAMERA_DIRECTION mode
471 vtkTypeBool Clamping; // whether to clamp scale factor
472 int IndexMode; // what to use to index into glyph table
473 vtkTypeBool GeneratePointIds; // produce input points ids for each output point
474 vtkTypeBool FillCellData; // whether to fill output cell data
478
479private:
480 vtkGlyph3D(const vtkGlyph3D&) = delete;
481 void operator=(const vtkGlyph3D&) = delete;
482};
483
488{
489 if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
490 {
491 return "ScaleByScalar";
492 }
493 else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
494 {
495 return "ScaleByVector";
496 }
497 else
498 {
499 return "DataScalingOff";
500 }
501}
502
507{
508 if (this->ColorMode == VTK_COLOR_BY_SCALAR)
509 {
510 return "ColorByScalar";
511 }
512 else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
513 {
514 return "ColorByVector";
515 }
516 else
517 {
518 return "ColorByScale";
519 }
520}
521
526{
527 if (this->VectorMode == VTK_USE_VECTOR)
528 {
529 return "UseVector";
530 }
531 else if (this->VectorMode == VTK_USE_NORMAL)
532 {
533 return "UseNormal";
534 }
535 else if (this->VectorMode == VTK_FOLLOW_CAMERA_DIRECTION)
536 {
537 return "FollowCameraDirection";
538 }
539 else
540 {
541 return "VectorRotationOff";
542 }
543}
544
549{
550 if (this->IndexMode == VTK_INDEXING_OFF)
551 {
552 return "IndexingOff";
553 }
554 else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
555 {
556 return "IndexingByScalar";
557 }
558 else
559 {
560 return "IndexingByVector";
561 }
562}
563
564VTK_ABI_NAMESPACE_END
565#endif
Proxy object to connect input/output ports.
abstract superclass for arrays of numeric data
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
copy oriented and scaled glyph geometry to every input point
Definition vtkGlyph3D.h:211
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition vtkGlyph3D.h:370
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:274
int OutputPointsPrecision
Definition vtkGlyph3D.h:477
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
Definition vtkGlyph3D.h:337
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition vtkGlyph3D.h:525
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:275
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition vtkGlyph3D.h:372
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:273
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:290
void SetSourceTransform(vtkTransform *)
When set, this is use to transform the source polydata before using it to generate the glyph.
const char * GetIndexModeAsString()
Return the index mode as a character string.
Definition vtkGlyph3D.h:548
vtkTypeBool Scaling
Definition vtkGlyph3D.h:461
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:487
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
Definition vtkGlyph3D.h:336
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:279
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:412
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition vtkGlyph3D.h:506
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.
vtkPolyData * GetSource(int id=0)
Get a pointer to a source object at a specified table location.
vtkTypeBool Clamping
Definition vtkGlyph3D.h:471
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:289
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:291
vtkTypeBool FillCellData
Definition vtkGlyph3D.h:474
vtkPolyData ** Source
Definition vtkGlyph3D.h:460
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
Definition vtkGlyph3D.h:247
~vtkGlyph3D() override
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
vtkPolyData * GetSource(int idx, vtkInformationVector *sourceInfo)
void SetVectorModeToFollowCameraDirection()
Specify whether to use vector or normal to perform vector operations.
Definition vtkGlyph3D.h:339
char * PointIdsName
Definition vtkGlyph3D.h:475
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
double ScaleFactor
Definition vtkGlyph3D.h:464
vtkTransform * SourceTransform
Definition vtkGlyph3D.h:476
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition vtkGlyph3D.h:371
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition vtkGlyph3D.h:230
void SetVectorModeToVectorRotationOff()
Specify whether to use vector or normal to perform vector operations.
Definition vtkGlyph3D.h:338
vtkTypeBool GeneratePointIds
Definition vtkGlyph3D.h:473
virtual bool Execute(vtkDataSet *input, vtkInformationVector *sourceVector, vtkPolyData *output)
Method called in RequestData() to do the actual data processing.
static vtkGlyph3D * New()
Construct object with scaling on, scaling mode is by scalar value, scale factor = 1....
a simple class to control print indentation
Definition vtkIndent.h:108
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
describes linear transformations via a 4x4 matrix
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_COLOR_BY_VECTOR
Definition vtkGlyph3D.h:196
#define VTK_FOLLOW_CAMERA_DIRECTION
Definition vtkGlyph3D.h:201
#define VTK_SCALE_BY_SCALAR
Definition vtkGlyph3D.h:189
#define VTK_INDEXING_BY_SCALAR
Definition vtkGlyph3D.h:204
#define VTK_DATA_SCALING_OFF
Definition vtkGlyph3D.h:192
#define VTK_VECTOR_ROTATION_OFF
Definition vtkGlyph3D.h:200
#define VTK_COLOR_BY_SCALAR
Definition vtkGlyph3D.h:195
#define VTK_USE_VECTOR
Definition vtkGlyph3D.h:198
#define VTK_USE_NORMAL
Definition vtkGlyph3D.h:199
#define VTK_INDEXING_BY_VECTOR
Definition vtkGlyph3D.h:205
#define VTK_SCALE_BY_VECTOR
Definition vtkGlyph3D.h:190
#define VTK_INDEXING_OFF
Definition vtkGlyph3D.h:203
#define VTK_COLOR_BY_SCALE
Definition vtkGlyph3D.h:194
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition vtkGlyph3D.h:191
int vtkIdType
Definition vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270