1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkBoundedPointSource.h 5 6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 7 All rights reserved. 8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 9 10 This software is distributed WITHOUT ANY WARRANTY; without even 11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 12 PURPOSE. See the above copyright notice for more information. 13 14 =========================================================================*/ 15 /** 16 * @class vtkBoundedPointSource 17 * @brief create a random cloud of points within a 18 * specified bounding box 19 * 20 * 21 * vtkBoundedPointSource is a source object that creates a user-specified 22 * number of points within a specified bounding box. The points are scattered 23 * randomly throughout the box. Optionally, the user can produce a 24 * vtkPolyVertex cell as well as random scalar values within a specified 25 * range. The class is typically used for debugging and testing, as well as 26 * seeding streamlines. 27 */ 28 29 #ifndef vtkBoundedPointSource_h 30 #define vtkBoundedPointSource_h 31 32 #include "vtkFiltersPointsModule.h" // For export macro 33 #include "vtkPolyDataAlgorithm.h" 34 35 class VTKFILTERSPOINTS_EXPORT vtkBoundedPointSource : public vtkPolyDataAlgorithm 36 { 37 public: 38 //@{ 39 /** 40 * Standard methods for instantiation, type information and printing. 41 */ 42 static vtkBoundedPointSource *New(); 43 vtkTypeMacro(vtkBoundedPointSource,vtkPolyDataAlgorithm); 44 void PrintSelf(ostream& os, vtkIndent indent) override; 45 //@} 46 47 //@{ 48 /** 49 * Set the number of points to generate. 50 */ 51 vtkSetClampMacro(NumberOfPoints,vtkIdType,1,VTK_ID_MAX); 52 vtkGetMacro(NumberOfPoints,vtkIdType); 53 //@} 54 55 //@{ 56 /** 57 * Set the bounding box for the point distribution. By default the bounds is 58 * (-1,1,-1,1,-1,1). 59 */ 60 vtkSetVector6Macro(Bounds,double); 61 vtkGetVectorMacro(Bounds,double,6); 62 //@} 63 64 //@{ 65 /** 66 * Set/get the desired precision for the output points. 67 * vtkAlgorithm::SINGLE_PRECISION - Output single-precision floating point. 68 * vtkAlgorithm::DOUBLE_PRECISION - Output double-precision floating point. 69 */ 70 vtkSetMacro(OutputPointsPrecision,int); 71 vtkGetMacro(OutputPointsPrecision,int); 72 //@} 73 74 //@{ 75 /** 76 * Indicate whether to produce a vtkPolyVertex cell to go along with the 77 * output vtkPoints generated. By default a cell is NOT produced. Some filters 78 * do not need the vtkPolyVertex which just consumes a lot of memory. 79 */ 80 vtkSetMacro(ProduceCellOutput, bool); 81 vtkGetMacro(ProduceCellOutput, bool); 82 vtkBooleanMacro(ProduceCellOutput, bool); 83 //@} 84 85 //@{ 86 /** 87 * Indicate whether to produce random point scalars in the output. By default 88 * this is off. 89 */ 90 vtkSetMacro(ProduceRandomScalars, bool); 91 vtkGetMacro(ProduceRandomScalars, bool); 92 vtkBooleanMacro(ProduceRandomScalars, bool); 93 //@} 94 95 //@{ 96 /** 97 * Set the range in which the random scalars should be produced. By default the 98 * scalar range is (0,1). 99 */ 100 vtkSetVector2Macro(ScalarRange,double); 101 vtkGetVectorMacro(ScalarRange,double,2); 102 //@} 103 104 protected: 105 vtkBoundedPointSource(); ~vtkBoundedPointSource()106 ~vtkBoundedPointSource() override {} 107 108 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override; 109 110 vtkIdType NumberOfPoints; 111 double Bounds[6]; 112 int OutputPointsPrecision; 113 bool ProduceCellOutput; 114 bool ProduceRandomScalars; 115 double ScalarRange[2]; 116 117 private: 118 vtkBoundedPointSource(const vtkBoundedPointSource&) = delete; 119 void operator=(const vtkBoundedPointSource&) = delete; 120 }; 121 122 #endif 123