VTK  9.3.1
vtkImplicitProjectOnPlaneDistance.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
22 #ifndef vtkImplicitProjectOnPlaneDistance_h
23 #define vtkImplicitProjectOnPlaneDistance_h
24 
25 #include "vtkImplicitFunction.h"
26 
27 #include "vtkAbstractCellLocator.h" // User defined cellLocator
28 #include "vtkFiltersCoreModule.h" // For export macro
29 #include "vtkSmartPointer.h" // It has vtkSmartPointer fields
30 
31 VTK_ABI_NAMESPACE_BEGIN
32 class vtkGenericCell;
33 class vtkPolyData;
34 class vtkPlane;
35 
36 class VTKFILTERSCORE_EXPORT vtkImplicitProjectOnPlaneDistance : public vtkImplicitFunction
37 {
38 public:
39  enum class NormType
40  {
41  L0 = 0,
42  L2 = 2
43  };
44 
47  void PrintSelf(ostream& os, vtkIndent indent) override;
48 
52  vtkMTimeType GetMTime() override;
53 
59  double EvaluateFunction(double x[3]) override;
60 
65  void EvaluateGradient(double x[3], double g[3]) override;
66 
71  void SetInput(vtkPolyData* input);
72 
74 
78  vtkGetMacro(Tolerance, double);
79  vtkSetMacro(Tolerance, double);
81 
83 
88  NormType GetNorm() const { return Norm; }
89  void SetNorm(NormType n)
90  {
91  Norm = n;
92  Modified();
93  }
94 #ifndef __VTK_WRAP_JAVA__
95  // The Java wrappers cannot resolve this signature from the one above,
96  // see https://gitlab.kitware.com/vtk/vtk/-/issues/17744
97  void SetNorm(int n)
98  {
99  Norm = static_cast<NormType>(n);
100  Modified();
101  }
102 #endif
103 
106 
111  vtkGetSmartPointerMacro(Locator, vtkAbstractCellLocator);
112  vtkSetSmartPointerMacro(Locator, vtkAbstractCellLocator);
114 
115 protected:
117  ~vtkImplicitProjectOnPlaneDistance() override = default;
118 
123  void CreateDefaultLocator();
124 
125  double Tolerance;
127 
131 
132  // Stored here to avoid multiple allocation / dealloction
134  double Bounds[6];
135 
136 private:
138  void operator=(const vtkImplicitProjectOnPlaneDistance&) = delete;
139 };
140 
141 VTK_ABI_NAMESPACE_END
142 #endif
abstract interface for implicit functions
virtual double EvaluateFunction(double x[3])=0
Evaluate function at position x-y-z and return value.
NormType GetNorm() const
Set the norm to use: L0: 0 when the projection is inside the input polygon, 1 otherwise L2: Euclidean...
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
an abstract base class for locators which find cells
vtkSmartPointer< vtkGenericCell > UnusedCell
void SetNorm(NormType n)
Set the norm to use: L0: 0 when the projection is inside the input polygon, 1 otherwise L2: Euclidean...
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
virtual void EvaluateGradient(double x[3], double g[3])=0
Evaluate function gradient at position x-y-z and pass back vector.
provides thread-safe access to cells
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkMTimeType GetMTime() override
Overload standard modified time function.
perform various plane computations
Definition: vtkPlane.h:25
virtual void Modified()
Update the modification time for this object.
void SetNorm(int n)
Set the norm to use: L0: 0 when the projection is inside the input polygon, 1 otherwise L2: Euclidean...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSmartPointer< vtkAbstractCellLocator > Locator
This class receive a plannar polygon as input.