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
74#ifndef vtkPCANormalEstimation_h
75#define vtkPCANormalEstimation_h
76
77#include "vtkFiltersPointsModule.h" // For export macro
79#include "vtkSmartPointer.h" // For vtkSmartPointer
80#include "vtkStaticPointLocator.h" // For default locator
81
82VTK_ABI_NAMESPACE_BEGIN
84class vtkIdList;
85
86class VTKFILTERSPOINTS_EXPORT vtkPCANormalEstimation : public vtkPolyDataAlgorithm
87{
88public:
90
96 void PrintSelf(ostream& os, vtkIndent indent) override;
98
102 typedef enum
103 {
104 KNN = 0,
105 RADIUS = 1
106 } NeighborSearchMode;
107
109
123 vtkSetMacro(SearchMode, int);
124 vtkGetMacro(SearchMode, int);
125 void SetSearchModeToKNN() { this->SetSearchMode(KNN); }
126 void SetSearchModeToRadius() { this->SetSearchMode(RADIUS); }
128
130
136 vtkSetClampMacro(SampleSize, int, 1, VTK_INT_MAX);
137 vtkGetMacro(SampleSize, int);
139
141
147 vtkSetMacro(Radius, double);
148 vtkGetMacro(Radius, double);
150
154 enum Style
155 {
156 AS_COMPUTED = 0,
157 POINT = 1,
158 GRAPH_TRAVERSAL = 3
159 };
160
162
174 vtkSetMacro(NormalOrientation, int);
175 vtkGetMacro(NormalOrientation, int);
176 void SetNormalOrientationToAsComputed() { this->SetNormalOrientation(AS_COMPUTED); }
177 void SetNormalOrientationToPoint() { this->SetNormalOrientation(POINT); }
178 void SetNormalOrientationToGraphTraversal() { this->SetNormalOrientation(GRAPH_TRAVERSAL); }
180
182
188 vtkSetVector3Macro(OrientationPoint, double);
189 vtkGetVectorMacro(OrientationPoint, double, 3);
191
193
196 vtkSetMacro(FlipNormals, bool);
197 vtkGetMacro(FlipNormals, bool);
198 vtkBooleanMacro(FlipNormals, bool);
200
202
208 vtkGetObjectMacro(Locator, vtkAbstractPointLocator);
210
211protected:
214
215 // IVars
216 int SampleSize = 25;
217 double Radius = 0.; // Radius is not checked by default (in meter)
220 int NormalOrientation = vtkPCANormalEstimation::POINT;
221 double OrientationPoint[3] = { 0. };
222 bool FlipNormals = false;
223
224 // Methods used to produce consistent normal orientations
226 vtkPoints* inPts, float* normals, char* pointMap, vtkIdList* wave, vtkIdList* wave2);
227
228 // Pipeline management
230 int FillInputPortInformation(int port, vtkInformation* info) override;
231
232private:
234 void operator=(const vtkPCANormalEstimation&) = delete;
235};
236
237VTK_ABI_NAMESPACE_END
238#endif
abstract class to quickly locate points in 3-space
list of point or cell ids
Definition vtkIdList.h:32
a simple class to control print indentation
Definition vtkIndent.h:38
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:38
Superclass for algorithms that produce only polydata as output.
Hold a reference to a vtkObjectBase instance.
static vtkStaticPointLocator * New()
Construct with automatic computation of divisions, averaging 5 points per bucket.
#define VTK_INT_MAX
Definition vtkType.h:144