VTK  9.4.20241123
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 "vtkConvertToPointCloud.h" // For adding cells to output polydata
138#include "vtkFiltersPointsModule.h" // For export macro
139#include "vtkPolyDataAlgorithm.h"
140#include "vtkSmartPointer.h" // For vtkSmartPointer
141#include "vtkStaticPointLocator.h" // For default locator
142
143VTK_ABI_NAMESPACE_BEGIN
145class vtkIdList;
146
147class VTKFILTERSPOINTS_EXPORT vtkPCANormalEstimation : public vtkPolyDataAlgorithm
148{
149public:
151
157 void PrintSelf(ostream& os, vtkIndent indent) override;
159
163 typedef enum
164 {
165 KNN = 0,
166 RADIUS = 1
167 } NeighborSearchMode;
168
170
184 vtkSetMacro(SearchMode, int);
185 vtkGetMacro(SearchMode, int);
186 void SetSearchModeToKNN() { this->SetSearchMode(KNN); }
187 void SetSearchModeToRadius() { this->SetSearchMode(RADIUS); }
189
191
197 vtkSetClampMacro(SampleSize, int, 1, VTK_INT_MAX);
198 vtkGetMacro(SampleSize, int);
200
202
208 vtkSetMacro(Radius, double);
209 vtkGetMacro(Radius, double);
211
215 enum Style
216 {
217 AS_COMPUTED = 0,
218 POINT = 1,
219 GRAPH_TRAVERSAL = 3
220 };
221
223
235 vtkSetMacro(NormalOrientation, int);
236 vtkGetMacro(NormalOrientation, int);
237 void SetNormalOrientationToAsComputed() { this->SetNormalOrientation(AS_COMPUTED); }
238 void SetNormalOrientationToPoint() { this->SetNormalOrientation(POINT); }
239 void SetNormalOrientationToGraphTraversal() { this->SetNormalOrientation(GRAPH_TRAVERSAL); }
241
243
249 vtkSetVector3Macro(OrientationPoint, double);
250 vtkGetVectorMacro(OrientationPoint, double, 3);
252
254
257 vtkSetMacro(FlipNormals, bool);
258 vtkGetMacro(FlipNormals, bool);
259 vtkBooleanMacro(FlipNormals, bool);
261
263
269 vtkGetObjectMacro(Locator, vtkAbstractPointLocator);
271
273
283 vtkSetMacro(CellGenerationMode, int);
284 vtkGetMacro(CellGenerationMode, int);
286
287protected:
290
291 // IVars
292 int SampleSize = 25;
293 double Radius = 0.; // Radius is not checked by default (in meter)
296 int NormalOrientation = vtkPCANormalEstimation::POINT;
297 double OrientationPoint[3] = { 0. };
298 bool FlipNormals = false;
299 int CellGenerationMode = vtkConvertToPointCloud::NO_CELLS;
300
301 // Methods used to produce consistent normal orientations
303 vtkPoints* inPts, float* normals, char* pointMap, vtkIdList* wave, vtkIdList* wave2);
304
305 // Pipeline management
307 int FillInputPortInformation(int port, vtkInformation* info) override;
308
309private:
311 void operator=(const vtkPCANormalEstimation&) = delete;
312};
313
314VTK_ABI_NAMESPACE_END
315#endif
abstract class to quickly locate points in 3-space
list of point or cell ids
Definition vtkIdList.h:133
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:139
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