1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkPCACurvatureEstimation.h 5 6 Copyright (c) Kitware, Inc. 7 All rights reserved. 8 See LICENSE file for details. 9 10 This software is distributed WITHOUT ANY WARRANTY; without even 11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 12 PURPOSE. See the above copyright notice for more information. 13 14 =========================================================================*/ 15 /** 16 * @class vtkPCACurvatureEstimation 17 * @brief generate curvature estimates using 18 * principal component analysis 19 * 20 * 21 * vtkPCACurvatureEstimation generates point normals using PCA (principal 22 * component analysis). Basically this estimates a local tangent plane 23 * around sample point p by considering a small neighborhood of points 24 * around p, and fitting a plane to the neighborhood (via PCA). A good 25 * introductory reference is Hoppe's "Surface reconstruction from 26 * unorganized points." 27 * 28 * To use this filter, specify a neighborhood size. This may have to be set 29 * via experimentation. Optionally a point locator can be specified (instead 30 * of the default locator), which is used to accelerate searches around a 31 * sample point. Finally, the user should specify how to generate 32 * consistently-oriented normals. As computed by PCA, normals may point in 33 * +/- orientation, which may not be consistent with neighboring normals. 34 * 35 * The output of this filter is the same as the input except that a normal 36 * per point is produced. (Note that these are unit normals.) While any 37 * vtkPointSet type can be provided as input, the output is represented by an 38 * explicit representation of points via a vtkPolyData. This output polydata 39 * will populate its instance of vtkPoints, but no cells will be defined 40 * (i.e., no vtkVertex or vtkPolyVertex are contained in the output). 41 * 42 * @warning 43 * This class has been threaded with vtkSMPTools. Using TBB or other 44 * non-sequential type (set in the CMake variable 45 * VTK_SMP_IMPLEMENTATION_TYPE) may improve performance significantly. 46 * 47 * @sa 48 * vtkPCANormalEstimation 49 */ 50 51 #ifndef vtkPCACurvatureEstimation_h 52 #define vtkPCACurvatureEstimation_h 53 54 #include "vtkFiltersPointsModule.h" // For export macro 55 #include "vtkPolyDataAlgorithm.h" 56 57 class vtkAbstractPointLocator; 58 59 60 class VTKFILTERSPOINTS_EXPORT vtkPCACurvatureEstimation : public vtkPolyDataAlgorithm 61 { 62 public: 63 //@{ 64 /** 65 * Standard methods for instantiating, obtaining type information, and 66 * printing information. 67 */ 68 static vtkPCACurvatureEstimation *New(); 69 vtkTypeMacro(vtkPCACurvatureEstimation,vtkPolyDataAlgorithm); 70 void PrintSelf(ostream& os, vtkIndent indent) override; 71 //@} 72 73 //@{ 74 /** 75 * For each sampled point, specify the number of the closest, surrounding 76 * points used to estimate the normal (the so called k-neighborhood). By 77 * default 25 points are used. Smaller numbers may speed performance at the 78 * cost of accuracy. 79 */ 80 vtkSetClampMacro(SampleSize,int,1,VTK_INT_MAX); 81 vtkGetMacro(SampleSize,int); 82 //@} 83 84 //@{ 85 /** 86 * Specify a point locator. By default a vtkStaticPointLocator is 87 * used. The locator performs efficient searches to locate points 88 * around a sample point. 89 */ 90 void SetLocator(vtkAbstractPointLocator *locator); 91 vtkGetObjectMacro(Locator,vtkAbstractPointLocator); 92 //@} 93 94 protected: 95 vtkPCACurvatureEstimation(); 96 ~vtkPCACurvatureEstimation() override; 97 98 // IVars 99 int SampleSize; 100 vtkAbstractPointLocator *Locator; 101 102 int RequestData(vtkInformation *, vtkInformationVector **, 103 vtkInformationVector *) override; 104 int FillInputPortInformation(int port, vtkInformation *info) override; 105 106 private: 107 vtkPCACurvatureEstimation(const vtkPCACurvatureEstimation&) = delete; 108 void operator=(const vtkPCACurvatureEstimation&) = delete; 109 110 }; 111 112 #endif 113