VTK  9.7.20261112
vtkVoronoiFlower3D.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
184
185#ifndef vtkVoronoiFlower3D_h
186#define vtkVoronoiFlower3D_h
187
188#include "vtkAbstractPointLocator.h" // For the point locator
189#include "vtkDataSetAlgorithm.h"
190#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_8_0
191#include "vtkFiltersMeshingModule.h" // For export macro
192#include "vtkIdTypeArray.h" // for PointsOfInterest
193#include "vtkSmartPointer.h" // For self-destructing data members
194#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
195
196VTK_ABI_NAMESPACE_BEGIN
198
199class VTKFILTERSMESHING_EXPORT VTK_MARSHALAUTO vtkVoronoiFlower3D : public vtkDataSetAlgorithm
200{
201public:
203
208 void PrintSelf(ostream& os, vtkIndent indent) override;
210
212
220 {
221 VORONOI = 0, // 3D Voronoi tessellation; output cells are polyhedra (vtkPolyhedron)
222 DELAUNAY = 1, // 3D Delaunay tesselation; cells are tetraheda (vtkTetra)
223 ADJACENCY_GRAPH = 2, // the graph edges connecting neighboring Voronoi hulls
225 3, // all polygonal faces including interior. Duplicate faces are not produced.
226 BOUNDARY = 4, // produce polygonal faces on the boundary of the Voronoi tessellation
228 5, // faces forming the surface net (i.e., faces on the boundaries between regions)
229 SPEED_TEST = 6, // no output, just compute Voronoi hulls (for performance testing)
230 };
231
239 vtkSetClampMacro(OutputType, int, VORONOI, SPEED_TEST);
240 vtkGetMacro(OutputType, int);
249
251
258 vtkSetClampMacro(Padding, double, 0.0001, 0.25);
259 vtkGetMacro(Padding, double);
261
263
272 vtkSetMacro(PassPointData, vtkTypeBool);
273 vtkGetMacro(PassPointData, vtkTypeBool);
274 vtkBooleanMacro(PassPointData, vtkTypeBool);
276
278
293 {
294 NO_CELL_SCALARS = 0, // Don't produce any cell scalars
295 POINT_IDS = 1, // Output cell scalars are the generating point id (default)
296 REGION_IDS = 2, // The region the cell primitives originated from (if region ids available)
297 NUMBER_FACES = 3, // The number of faces in the Voronoi hull
298 PRIM_IDS = 4, // The ids of the hull face primitives
300 5, // Scalars are the thread id used to produce output. This may change between runs.
301 RANDOM = 6 // Scalars are pseudo random numbers between [0,64).
302 };
303
304
306
315 vtkSetMacro(GenerateCellScalars, int);
316 vtkGetMacro(GenerateCellScalars, int);
325
327
334 vtkGetMacro(MergePoints, vtkTypeBool);
335 vtkSetMacro(MergePoints, vtkTypeBool);
336 vtkBooleanMacro(MergePoints, vtkTypeBool);
338
340
350 vtkIdType FindHull(double x[3]);
352
354
358 vtkSetClampMacro(PruneTolerance, double, 0.0, 0.5);
359 vtkGetMacro(PruneTolerance, double);
361
363
372 vtkSetSmartPointerMacro(PointLocator, vtkAbstractPointLocator);
373 vtkGetSmartPointerMacro(PointLocator, vtkAbstractPointLocator);
375
380 VTK_DEPRECATED_IN_9_8_0("Use GetPointLocator() instead")
382
384
391 vtkSetMacro(Validate, vtkTypeBool);
392 vtkGetMacro(Validate, vtkTypeBool);
393 vtkBooleanMacro(Validate, vtkTypeBool);
395
397
405 vtkSetClampMacro(BatchSize, unsigned int, 1, VTK_INT_MAX);
406 vtkGetMacro(BatchSize, unsigned int);
408
410
414 vtkGetMacro(BoundaryCapping, vtkTypeBool);
415 vtkSetMacro(BoundaryCapping, vtkTypeBool);
416 vtkBooleanMacro(BoundaryCapping, vtkTypeBool);
418
420
435 vtkSetClampMacro(PointOfInterest, vtkIdType, -1, VTK_ID_MAX);
436 vtkGetMacro(PointOfInterest, vtkIdType);
437 vtkSetObjectMacro(PointsOfInterest, vtkIdTypeArray);
438 vtkGetObjectMacro(PointsOfInterest, vtkIdTypeArray);
439 vtkSetClampMacro(MaximumNumberOfHullClips, vtkIdType, 1, VTK_ID_MAX);
440 vtkGetMacro(MaximumNumberOfHullClips, vtkIdType);
442
444
451 {
452 NO_POINT_SCALARS = 0, // Don't produce any point scalars (default)
453 FLOWER_RADII = 1 // Output point scalars are the Voronoi flower radii
454 };
455 vtkGetMacro(GeneratePointScalars, int);
457
463 int GetMaximumNumberOfPoints() { return this->MaximumNumberOfPoints; }
464
470 int GetMaximumNumberOfFaces() { return this->MaximumNumberOfFaces; }
471
477 int GetNumberOfThreads() { return this->NumberOfThreads; }
478
484 int GetNumberOfPrunes() { return this->NumberOfPrunes; }
485
490
495 template <typename T>
496 void UpdateExecutionInformation(T* voro);
497
498protected:
500 ~vtkVoronoiFlower3D() override = default;
501
502 // Satisfy pipeline-related API
504 int FillInputPortInformation(int port, vtkInformation* info) override;
505 int FillOutputPortInformation(int port, vtkInformation* info) override;
506
507private:
508 vtkVoronoiFlower3D(const vtkVoronoiFlower3D&) = delete;
509 void operator=(const vtkVoronoiFlower3D&) = delete;
510
511 int OutputType; // specification of the filter output
512 double Padding; // amount to pad out input points bounding box
513 vtkTypeBool Validate; // Choose to validate and repair output
514 vtkTypeBool PassPointData; // indicate whether to pass input point data to output
515 int GeneratePointScalars; // indicate whether point scalars are to be produced
516 int GenerateCellScalars; // indicate whether cell scalars are to be produced
517 vtkTypeBool MergePoints; // merge near coincident points or not
518 vtkIdType PointOfInterest; // specify a single input point to process
519 vtkSmartPointer<vtkIdTypeArray> PointsOfInterest; // list of points of interest
520 vtkIdType MaximumNumberOfHullClips; // limit the number of hull clips
521 vtkSmartPointer<vtkAbstractPointLocator> PointLocator; // locator for finding proximal points
522 double PruneTolerance; // the prune spokes tolerance
523 unsigned int BatchSize; // process data in batches of specified size
524 vtkTypeBool BoundaryCapping; // cap the domain boundary if OutputType is SURFACE_NET
525
529 int NumberOfThreads; // report on the number of threads used during processing
530 int MaximumNumberOfPoints; // maximum number of points found in any hull
531 int MaximumNumberOfFaces; // maximum number of faces found in any hull
532 int NumberOfPrunes; // If spoke pruning is enabled, report number of pruning operations
533};
534
535//------------------------------------------------------------------------------
536template <typename T>
538{
539 this->NumberOfThreads = voro->GetNumberOfThreads();
540 this->MaximumNumberOfPoints = voro->GetMaximumNumberOfPoints();
541 this->MaximumNumberOfFaces = voro->GetMaximumNumberOfFaces();
542 this->NumberOfPrunes = voro->GetNumberOfPrunes();
543}
544
545VTK_ABI_NAMESPACE_END
546#endif
abstract class to quickly locate points in 3-space
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Hold a reference to a vtkObjectBase instance.
quickly locate points in 3-space
void SetOutputTypeToBoundary()
Used to control the filter output.
int GetNumberOfPrunes()
Return the number of prunes performed during execution.
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
void SetGenerateCellScalarsToNumberFaces()
Indicate whether to create a cell scalar array as part of the output.
GenerateCellScalarsStrategy
Specify how to generate cell scalars for the outputs.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, type information, and printing.
~vtkVoronoiFlower3D() override=default
virtual void SetGenerateCellScalars(int)
Indicate whether to create a cell scalar array as part of the output.
void SetGenerateCellScalarsToPointIds()
Indicate whether to create a cell scalar array as part of the output.
vtkIdType FindHull(double x[3])
The following method–FindHull()–can be used to locate/query the Voronoi hull containing a point x (i....
OutputTypeOptions
Used to control the filter output.
GeneratePointScalarsStrategy
Used internally to generate point scalars for the output.
int GetNumberOfThreads()
Return the number of threads actually used during execution.
void SetOutputTypeToPolygonalComplex()
Used to control the filter output.
int GetMaximumNumberOfPoints()
Return the maximum number of points in any Voronoi hull.
void SetOutputTypeToVoronoi()
Used to control the filter output.
vtkStaticPointLocator * GetLocator()
Return the point locator if it is a vtkStaticPointLocator, nullptr otherwise.
void SetGenerateCellScalarsToThreadIds()
Indicate whether to create a cell scalar array as part of the output.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkMTimeType GetMTime() override
Get the MTime of this object also considering the locator.
virtual void SetOutputType(int)
Specify the type of output the filter creates.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to do its work.
void UpdateExecutionInformation(T *voro)
Method used to update this filter's execution parameters after the internal, templated instance of vt...
void SetOutputTypeToDelaunay()
Used to control the filter output.
void SetGenerateCellScalarsToPrimIds()
Indicate whether to create a cell scalar array as part of the output.
void SetOutputTypeToAdjacencyGraph()
Used to control the filter output.
static vtkVoronoiFlower3D * New()
Standard methods for instantiation, type information, and printing.
int GetMaximumNumberOfFaces()
Return the maximum number of faces in any Voronoi hull.
void SetGenerateCellScalarsToRegionIds()
Indicate whether to create a cell scalar array as part of the output.
void SetGenerateCellScalarsToNone()
Indicate whether to create a cell scalar array as part of the output.
void SetOutputTypeToSurfaceNet()
Used to control the filter output.
void SetGenerateCellScalarsToRandom()
Indicate whether to create a cell scalar array as part of the output.
void SetOutputTypeToSpeedTest()
Used to control the filter output.
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DEPRECATED_IN_9_8_0(reason)
int vtkIdType
Definition vtkType.h:366
#define VTK_ID_MAX
Definition vtkType.h:370
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:321
#define VTK_INT_MAX
Definition vtkType.h:195
#define VTK_MARSHALAUTO