VTK  9.3.0
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 
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 
199  vtkGetObjectMacro(Locator, vtkAbstractPointLocator);
201 
202 protected:
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
217  vtkPoints* inPts, float* normals, char* pointMap, vtkIdList* wave, vtkIdList* wave2);
218 
219  // Pipeline management
222 
223 private:
225  void operator=(const vtkPCANormalEstimation&) = delete;
226 };
227 
228 VTK_ABI_NAMESPACE_END
229 #endif
abstract class to quickly locate points in 3-space
list of point or cell ids
Definition: vtkIdList.h:23
a simple class to control print indentation
Definition: vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
generate point normals using local tangent planes
void SetSearchModeToRadius()
Configure how the filter selects the neighbor points used to calculate the PCA.
void SetLocator(vtkAbstractPointLocator *locator)
Specify a point locator.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiating, obtaining type information, and printing information.
~vtkPCANormalEstimation() override
void SetNormalOrientationToPoint()
Configure how the filter addresses consistency in normal oreientation.
void TraverseAndFlip(vtkPoints *inPts, float *normals, char *pointMap, vtkIdList *wave, vtkIdList *wave2)
void SetNormalOrientationToAsComputed()
Configure how the filter addresses consistency in normal oreientation.
vtkPCANormalEstimation()=default
void SetSearchModeToKNN()
Configure how the filter selects the neighbor points used to calculate the PCA.
static vtkPCANormalEstimation * New()
Standard methods for instantiating, obtaining type information, and printing information.
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.
void SetNormalOrientationToGraphTraversal()
Configure how the filter addresses consistency in normal oreientation.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
represent and manipulate 3D points
Definition: vtkPoints.h:29
Superclass for algorithms that produce only polydata as output.
static vtkStaticPointLocator * New()
Construct with automatic computation of divisions, averaging 5 points per bucket.
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
#define VTK_INT_MAX
Definition: vtkType.h:144