VTK  9.3.1
vtkPCANormalEstimation.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
65 #ifndef vtkPCANormalEstimation_h
66 #define vtkPCANormalEstimation_h
67 
68 #include "vtkFiltersPointsModule.h" // For export macro
69 #include "vtkPolyDataAlgorithm.h"
70 #include "vtkSmartPointer.h" // For vtkSmartPointer
71 #include "vtkStaticPointLocator.h" // For default locator
72 
73 VTK_ABI_NAMESPACE_BEGIN
75 class vtkIdList;
76 
77 class VTKFILTERSPOINTS_EXPORT vtkPCANormalEstimation : public vtkPolyDataAlgorithm
78 {
79 public:
81 
85  static vtkPCANormalEstimation* New();
87  void PrintSelf(ostream& os, vtkIndent indent) override;
89 
93  typedef enum
94  {
95  KNN = 0,
96  RADIUS = 1
97  } NeighborSearchMode;
98 
100 
114  vtkSetMacro(SearchMode, int);
115  vtkGetMacro(SearchMode, int);
116  void SetSearchModeToKNN() { this->SetSearchMode(KNN); }
117  void SetSearchModeToRadius() { this->SetSearchMode(RADIUS); }
119 
121 
127  vtkSetClampMacro(SampleSize, int, 1, VTK_INT_MAX);
128  vtkGetMacro(SampleSize, int);
130 
132 
138  vtkSetMacro(Radius, double);
139  vtkGetMacro(Radius, double);
141 
145  enum Style
146  {
147  AS_COMPUTED = 0,
148  POINT = 1,
149  GRAPH_TRAVERSAL = 3
150  };
151 
153 
165  vtkSetMacro(NormalOrientation, int);
166  vtkGetMacro(NormalOrientation, int);
167  void SetNormalOrientationToAsComputed() { this->SetNormalOrientation(AS_COMPUTED); }
168  void SetNormalOrientationToPoint() { this->SetNormalOrientation(POINT); }
169  void SetNormalOrientationToGraphTraversal() { this->SetNormalOrientation(GRAPH_TRAVERSAL); }
171 
173 
179  vtkSetVector3Macro(OrientationPoint, double);
180  vtkGetVectorMacro(OrientationPoint, double, 3);
182 
184 
187  vtkSetMacro(FlipNormals, bool);
188  vtkGetMacro(FlipNormals, bool);
189  vtkBooleanMacro(FlipNormals, bool);
191 
193 
198  void SetLocator(vtkAbstractPointLocator* locator);
199  vtkGetObjectMacro(Locator, vtkAbstractPointLocator);
201 
202 protected:
203  vtkPCANormalEstimation() = default;
204  ~vtkPCANormalEstimation() override;
205 
206  // IVars
207  int SampleSize = 25;
208  double Radius = 0.; // Radius is not checked by default (in meter)
210  int SearchMode = vtkPCANormalEstimation::KNN;
211  int NormalOrientation = vtkPCANormalEstimation::POINT;
212  double OrientationPoint[3] = { 0. };
213  bool FlipNormals = false;
214 
215  // Methods used to produce consistent normal orientations
216  void TraverseAndFlip(
217  vtkPoints* inPts, float* normals, char* pointMap, vtkIdList* wave, vtkIdList* wave2);
218 
219  // Pipeline management
221  int FillInputPortInformation(int port, vtkInformation* info) override;
222 
223 private:
225  void operator=(const vtkPCANormalEstimation&) = delete;
226 };
227 
228 VTK_ABI_NAMESPACE_END
229 #endif
Store vtkAlgorithm input/output information.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
#define VTK_INT_MAX
Definition: vtkType.h:144
void SetNormalOrientationToPoint()
Configure how the filter addresses consistency in normal oreientation.
static vtkPolyDataAlgorithm * New()
void SetNormalOrientationToGraphTraversal()
Configure how the filter addresses consistency in normal oreientation.
Superclass for algorithms that produce only polydata as output.
generate point normals using local tangent planes
void SetSearchModeToKNN()
Configure how the filter selects the neighbor points used to calculate the PCA.
a simple class to control print indentation
Definition: vtkIndent.h:28
abstract class to quickly locate points in 3-space
list of point or cell ids
Definition: vtkIdList.h:22
static vtkStaticPointLocator * New()
Construct with automatic computation of divisions, averaging 5 points per bucket. ...
void SetNormalOrientationToAsComputed()
Configure how the filter addresses consistency in normal oreientation.
Style
This enum is used to control how normals oriented is controlled.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Store zero or more vtkInformation instances.
void SetSearchModeToRadius()
Configure how the filter selects the neighbor points used to calculate the PCA.
represent and manipulate 3D points
Definition: vtkPoints.h:28
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.