VTK  9.3.20240328
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
134 #ifndef vtkPCANormalEstimation_h
135 #define vtkPCANormalEstimation_h
136 
137 #include "vtkFiltersPointsModule.h" // For export macro
138 #include "vtkPolyDataAlgorithm.h"
139 #include "vtkSmartPointer.h" // For vtkSmartPointer
140 #include "vtkStaticPointLocator.h" // For default locator
141 
142 VTK_ABI_NAMESPACE_BEGIN
144 class vtkIdList;
145 
146 class VTKFILTERSPOINTS_EXPORT vtkPCANormalEstimation : public vtkPolyDataAlgorithm
147 {
148 public:
150 
156  void PrintSelf(ostream& os, vtkIndent indent) override;
158 
162  typedef enum
163  {
164  KNN = 0,
165  RADIUS = 1
166  } NeighborSearchMode;
167 
169 
183  vtkSetMacro(SearchMode, int);
184  vtkGetMacro(SearchMode, int);
185  void SetSearchModeToKNN() { this->SetSearchMode(KNN); }
186  void SetSearchModeToRadius() { this->SetSearchMode(RADIUS); }
188 
190 
196  vtkSetClampMacro(SampleSize, int, 1, VTK_INT_MAX);
197  vtkGetMacro(SampleSize, int);
199 
201 
207  vtkSetMacro(Radius, double);
208  vtkGetMacro(Radius, double);
210 
214  enum Style
215  {
216  AS_COMPUTED = 0,
217  POINT = 1,
218  GRAPH_TRAVERSAL = 3
219  };
220 
222 
234  vtkSetMacro(NormalOrientation, int);
235  vtkGetMacro(NormalOrientation, int);
236  void SetNormalOrientationToAsComputed() { this->SetNormalOrientation(AS_COMPUTED); }
237  void SetNormalOrientationToPoint() { this->SetNormalOrientation(POINT); }
238  void SetNormalOrientationToGraphTraversal() { this->SetNormalOrientation(GRAPH_TRAVERSAL); }
240 
242 
248  vtkSetVector3Macro(OrientationPoint, double);
249  vtkGetVectorMacro(OrientationPoint, double, 3);
251 
253 
256  vtkSetMacro(FlipNormals, bool);
257  vtkGetMacro(FlipNormals, bool);
258  vtkBooleanMacro(FlipNormals, bool);
260 
262 
268  vtkGetObjectMacro(Locator, vtkAbstractPointLocator);
270 
271 protected:
274 
275  // IVars
276  int SampleSize = 25;
277  double Radius = 0.; // Radius is not checked by default (in meter)
279  int SearchMode = vtkPCANormalEstimation::KNN;
280  int NormalOrientation = vtkPCANormalEstimation::POINT;
281  double OrientationPoint[3] = { 0. };
282  bool FlipNormals = false;
283 
284  // Methods used to produce consistent normal orientations
286  vtkPoints* inPts, float* normals, char* pointMap, vtkIdList* wave, vtkIdList* wave2);
287 
288  // Pipeline management
291 
292 private:
294  void operator=(const vtkPCANormalEstimation&) = delete;
295 };
296 
297 VTK_ABI_NAMESPACE_END
298 #endif
abstract class to quickly locate points in 3-space
list of point or cell ids
Definition: vtkIdList.h:132
a simple class to control print indentation
Definition: vtkIndent.h:108
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:138
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