VTK  9.7.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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
31 
32 VTK_ABI_NAMESPACE_BEGIN
33 class vtkGenericCell;
34 class vtkPolyData;
35 class vtkPlane;
36 
38  : public vtkImplicitFunction
39 {
40 public:
41  enum class NormType
42  {
43  L0 = 0,
44  L2 = 2
45  };
46 
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
54  vtkMTimeType GetMTime() override;
55 
61  double EvaluateFunction(double x[3]) override;
62 
67  void EvaluateGradient(double x[3], double g[3]) override;
68 
73  void SetInput(vtkPolyData* input);
74 
76 
80  vtkGetMacro(Tolerance, double);
81  vtkSetMacro(Tolerance, double);
83 
85 
90  NormType GetNorm() const { return Norm; }
91  void SetNorm(NormType n)
92  {
93  Norm = n;
94  Modified();
95  }
96 #ifndef __VTK_WRAP_JAVA__
97  // The Java wrappers cannot resolve this signature from the one above,
98  // see https://gitlab.kitware.com/vtk/vtk/-/issues/17744
99  void SetNorm(int n)
100  {
101  Norm = static_cast<NormType>(n);
102  Modified();
103  }
104 #endif
105 
108 
113  vtkGetSmartPointerMacro(Locator, vtkAbstractCellLocator);
114  vtkSetSmartPointerMacro(Locator, vtkAbstractCellLocator);
116 
117 protected:
119  ~vtkImplicitProjectOnPlaneDistance() override = default;
120 
125  void CreateDefaultLocator();
126 
127  double Tolerance;
129 
133 
134  // Stored here to avoid multiple allocation / dealloction
136  double Bounds[6];
137 
138 private:
140  void operator=(const vtkImplicitProjectOnPlaneDistance&) = delete;
141 };
142 
143 VTK_ABI_NAMESPACE_END
144 #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:318
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:71
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:31
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...
#define VTK_MARSHALAUTO
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.