VTK  9.5.20251105
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#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
189
190#define VTK_SCALE_BY_SCALAR 0
191#define VTK_SCALE_BY_VECTOR 1
192#define VTK_SCALE_BY_VECTORCOMPONENTS 2
193#define VTK_DATA_SCALING_OFF 3
194
195#define VTK_COLOR_BY_SCALE 0
196#define VTK_COLOR_BY_SCALAR 1
197#define VTK_COLOR_BY_VECTOR 2
198
199#define VTK_USE_VECTOR 0
200#define VTK_USE_NORMAL 1
201#define VTK_VECTOR_ROTATION_OFF 2
202#define VTK_FOLLOW_CAMERA_DIRECTION 3
203
204#define VTK_INDEXING_OFF 0
205#define VTK_INDEXING_BY_SCALAR 1
206#define VTK_INDEXING_BY_VECTOR 2
207
208VTK_ABI_NAMESPACE_BEGIN
209class vtkTransform;
210
211class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkGlyph3D : public vtkPolyDataAlgorithm
212{
213public:
215 void PrintSelf(ostream& os, vtkIndent indent) override;
216
223 static vtkGlyph3D* New();
224
231 void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
232
239 void SetSourceData(int id, vtkPolyData* pd);
240
242
247 void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
249 {
250 this->SetSourceConnection(0, algOutput);
251 }
253
257 vtkPolyData* GetSource(int id = 0);
258
260
263 vtkSetMacro(Scaling, vtkTypeBool);
264 vtkBooleanMacro(Scaling, vtkTypeBool);
265 vtkGetMacro(Scaling, vtkTypeBool);
267
269
272 vtkSetMacro(ScaleMode, int);
273 vtkGetMacro(ScaleMode, int);
274 void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
275 void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
277 {
278 this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
279 }
281 const char* GetScaleModeAsString();
283
285
288 vtkSetMacro(ColorMode, int);
289 vtkGetMacro(ColorMode, int);
290 void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
291 void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
292 void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
293 const char* GetColorModeAsString();
295
297
300 vtkSetMacro(ScaleFactor, double);
301 vtkGetMacro(ScaleFactor, double);
303
305
308 vtkSetVector2Macro(Range, double);
309 vtkGetVectorMacro(Range, double, 2);
311
313
316 vtkSetMacro(Orient, vtkTypeBool);
317 vtkBooleanMacro(Orient, vtkTypeBool);
318 vtkGetMacro(Orient, vtkTypeBool);
320
322
326 vtkSetMacro(Clamping, vtkTypeBool);
327 vtkBooleanMacro(Clamping, vtkTypeBool);
328 vtkGetMacro(Clamping, vtkTypeBool);
330
332
335 vtkSetMacro(VectorMode, int);
336 vtkGetMacro(VectorMode, int);
337 void SetVectorModeToUseVector() { this->SetVectorMode(VTK_USE_VECTOR); }
338 void SetVectorModeToUseNormal() { this->SetVectorMode(VTK_USE_NORMAL); }
341 const char* GetVectorModeAsString();
343
345
349 vtkSetVectorMacro(FollowedCameraPosition, double, 3);
350 vtkGetVectorMacro(FollowedCameraPosition, double, 3);
352
354
357 vtkSetVectorMacro(FollowedCameraViewUp, double, 3);
358 vtkGetVectorMacro(FollowedCameraViewUp, double, 3);
360
362
369 vtkSetMacro(IndexMode, int);
370 vtkGetMacro(IndexMode, int);
371 void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
372 void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
373 void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
374 const char* GetIndexModeAsString();
376
378
384 vtkSetMacro(GeneratePointIds, vtkTypeBool);
385 vtkGetMacro(GeneratePointIds, vtkTypeBool);
386 vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
388
390
394 vtkSetStringMacro(PointIdsName);
395 vtkGetStringMacro(PointIdsName);
397
399
404 vtkSetMacro(FillCellData, vtkTypeBool);
405 vtkGetMacro(FillCellData, vtkTypeBool);
406 vtkBooleanMacro(FillCellData, vtkTypeBool);
408
413 virtual int IsPointVisible(vtkDataSet*, vtkIdType) { return 1; }
414
416
422 vtkGetObjectMacro(SourceTransform, vtkTransform);
424
429
431
436 vtkSetMacro(OutputPointsPrecision, int);
437 vtkGetMacro(OutputPointsPrecision, int);
439
440protected:
442 ~vtkGlyph3D() override;
443
447
449
451
456 virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
457 virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output,
458 vtkDataArray* inSScalars, vtkDataArray* inVectors);
460
461 vtkPolyData** Source; // Geometry to copy to each point
462 vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
463 int ScaleMode; // Scale by scalar value or vector magnitude
464 int ColorMode; // new scalars based on scale, scalar or vector
465 double ScaleFactor; // Scale factor to use to scale geometry
466 double Range[2]; // Range to use to perform scalar scaling
467 int Orient; // boolean controls whether to "orient" data
468 int VectorMode; // Orient/scale via normal or via vector data
469 double
470 FollowedCameraPosition[3]; // glyphs face towards this point in VTK_FOLLOW_CAMERA_DIRECTION mode
471 double FollowedCameraViewUp[3]; // glyph up direction in VTK_FOLLOW_CAMERA_DIRECTION mode
472 vtkTypeBool Clamping; // whether to clamp scale factor
473 int IndexMode; // what to use to index into glyph table
474 vtkTypeBool GeneratePointIds; // produce input points ids for each output point
475 vtkTypeBool FillCellData; // whether to fill output cell data
479
480private:
481 vtkGlyph3D(const vtkGlyph3D&) = delete;
482 void operator=(const vtkGlyph3D&) = delete;
483};
484
489{
490 if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
491 {
492 return "ScaleByScalar";
493 }
494 else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
495 {
496 return "ScaleByVector";
497 }
498 else
499 {
500 return "DataScalingOff";
501 }
502}
503
508{
509 if (this->ColorMode == VTK_COLOR_BY_SCALAR)
510 {
511 return "ColorByScalar";
512 }
513 else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
514 {
515 return "ColorByVector";
516 }
517 else
518 {
519 return "ColorByScale";
520 }
521}
522
527{
528 if (this->VectorMode == VTK_USE_VECTOR)
529 {
530 return "UseVector";
531 }
532 else if (this->VectorMode == VTK_USE_NORMAL)
533 {
534 return "UseNormal";
535 }
536 else if (this->VectorMode == VTK_FOLLOW_CAMERA_DIRECTION)
537 {
538 return "FollowCameraDirection";
539 }
540 else
541 {
542 return "VectorRotationOff";
543 }
544}
545
550{
551 if (this->IndexMode == VTK_INDEXING_OFF)
552 {
553 return "IndexingOff";
554 }
555 else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
556 {
557 return "IndexingByScalar";
558 }
559 else
560 {
561 return "IndexingByVector";
562 }
563}
564
565VTK_ABI_NAMESPACE_END
566#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:212
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition vtkGlyph3D.h:371
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:275
int OutputPointsPrecision
Definition vtkGlyph3D.h:478
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
Definition vtkGlyph3D.h:338
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition vtkGlyph3D.h:526
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:276
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition vtkGlyph3D.h:373
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:274
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:291
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:549
vtkTypeBool Scaling
Definition vtkGlyph3D.h:462
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:488
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
Definition vtkGlyph3D.h:337
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:280
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:413
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition vtkGlyph3D.h:507
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:472
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:290
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:292
vtkTypeBool FillCellData
Definition vtkGlyph3D.h:475
vtkPolyData ** Source
Definition vtkGlyph3D.h:461
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
Definition vtkGlyph3D.h:248
~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:340
char * PointIdsName
Definition vtkGlyph3D.h:476
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
double ScaleFactor
Definition vtkGlyph3D.h:465
vtkTransform * SourceTransform
Definition vtkGlyph3D.h:477
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition vtkGlyph3D.h:372
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition vtkGlyph3D.h:231
void SetVectorModeToVectorRotationOff()
Specify whether to use vector or normal to perform vector operations.
Definition vtkGlyph3D.h:339
vtkTypeBool GeneratePointIds
Definition vtkGlyph3D.h:474
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:197
#define VTK_FOLLOW_CAMERA_DIRECTION
Definition vtkGlyph3D.h:202
#define VTK_SCALE_BY_SCALAR
Definition vtkGlyph3D.h:190
#define VTK_INDEXING_BY_SCALAR
Definition vtkGlyph3D.h:205
#define VTK_DATA_SCALING_OFF
Definition vtkGlyph3D.h:193
#define VTK_VECTOR_ROTATION_OFF
Definition vtkGlyph3D.h:201
#define VTK_COLOR_BY_SCALAR
Definition vtkGlyph3D.h:196
#define VTK_USE_VECTOR
Definition vtkGlyph3D.h:199
#define VTK_USE_NORMAL
Definition vtkGlyph3D.h:200
#define VTK_INDEXING_BY_VECTOR
Definition vtkGlyph3D.h:206
#define VTK_SCALE_BY_VECTOR
Definition vtkGlyph3D.h:191
#define VTK_INDEXING_OFF
Definition vtkGlyph3D.h:204
#define VTK_COLOR_BY_SCALE
Definition vtkGlyph3D.h:195
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition vtkGlyph3D.h:192
int vtkIdType
Definition vtkType.h:367
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:322
#define VTK_MARSHALAUTO