VTK  9.3.1
vtkPlanesIntersection.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 
30 #ifndef vtkPlanesIntersection_h
31 #define vtkPlanesIntersection_h
32 
33 #include "vtkCommonDataModelModule.h" // For export macro
34 #include "vtkPlanes.h"
35 
36 VTK_ABI_NAMESPACE_BEGIN
37 class vtkPoints;
39 class vtkCell;
40 
41 class VTKCOMMONDATAMODEL_EXPORT vtkPlanesIntersection : public vtkPlanes
42 {
43  vtkTypeMacro(vtkPlanesIntersection, vtkPlanes);
44 
45 public:
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
48  static vtkPlanesIntersection* New();
49 
56  void SetRegionVertices(vtkPoints* pts);
57  void SetRegionVertices(double* v, int nvertices);
58  int GetNumberOfRegionVertices();
59  // Retained for backward compatibility
60  int GetNumRegionVertices() { return this->GetNumberOfRegionVertices(); }
61  int GetRegionVertices(double* v, int nvertices);
62 
68  int IntersectsRegion(vtkPoints* R);
69 
78  static int PolygonIntersectsBBox(double bounds[6], vtkPoints* pts);
79 
87  static vtkPlanesIntersection* Convert3DCell(vtkCell* cell);
88 
89 protected:
90  static void ComputeNormal(double* p1, double* p2, double* p3, double normal[3]);
91  static double EvaluatePlaneEquation(double* x, double* p);
92  static void PlaneEquation(double* n, double* x, double* p);
93  static int GoodNormal(double* n);
94  static int Invert3x3(double M[3][3]);
95 
97  ~vtkPlanesIntersection() override;
98 
99 private:
100  int IntersectsBoundingBox(vtkPoints* R);
101  int EnclosesBoundingBox(vtkPoints* R);
102  int EvaluateFacePlane(int plane, vtkPoints* R);
103  int IntersectsProjection(vtkPoints* R, int direction);
104 
105  void SetPlaneEquations();
106  void ComputeRegionVertices();
107 
108  void planesMatrix(int p1, int p2, int p3, double M[3][3]) const;
109  int duplicate(double testv[3]) const;
110  void planesRHS(int p1, int p2, int p3, double r[3]) const;
111  int outsideRegion(double v[3]);
112 
113  // plane equations
114  double* Planes;
115 
116  // vertices of convex regions enclosed by the planes, also
117  // the ccw hull of that region projected in 3 orthog. directions
118  vtkPointsProjectedHull* RegionPts;
119 
121  void operator=(const vtkPlanesIntersection&) = delete;
122 };
123 VTK_ABI_NAMESPACE_END
124 #endif
static vtkPlanes * New()
Standard methods for instantiation, type information, and printing.
implicit function for convex set of planes
Definition: vtkPlanes.h:41
A vtkPlanesIntersection object is a vtkPlanes object that can compute whether the arbitrary convex re...
abstract class to specify cell behavior
Definition: vtkCell.h:49
a simple class to control print indentation
Definition: vtkIndent.h:28
the convex hull of the orthogonal projection of the vtkPoints in the 3 coordinate directions ...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, type information, and printing.
represent and manipulate 3D points
Definition: vtkPoints.h:28