VTK  9.2.6
vtkPlanesIntersection.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPlanesIntersection.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm 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  Copyright (c) Sandia Corporation
17  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
18 ----------------------------------------------------------------------------*/
19 
45 #ifndef vtkPlanesIntersection_h
46 #define vtkPlanesIntersection_h
47 
48 #include "vtkCommonDataModelModule.h" // For export macro
49 #include "vtkPlanes.h"
50 
51 class vtkPoints;
53 class vtkCell;
54 
55 class VTKCOMMONDATAMODEL_EXPORT vtkPlanesIntersection : public vtkPlanes
56 {
57  vtkTypeMacro(vtkPlanesIntersection, vtkPlanes);
58 
59 public:
60  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
62  static vtkPlanesIntersection* New();
63 
70  void SetRegionVertices(vtkPoints* pts);
71  void SetRegionVertices(double* v, int nvertices);
72  int GetNumberOfRegionVertices();
73  // Retained for backward compatibility
74  int GetNumRegionVertices() { return this->GetNumberOfRegionVertices(); }
75  int GetRegionVertices(double* v, int nvertices);
76 
82  int IntersectsRegion(vtkPoints* R);
83 
92  static int PolygonIntersectsBBox(double bounds[6], vtkPoints* pts);
93 
101  static vtkPlanesIntersection* Convert3DCell(vtkCell* cell);
102 
103 protected:
104  static void ComputeNormal(double* p1, double* p2, double* p3, double normal[3]);
105  static double EvaluatePlaneEquation(double* x, double* p);
106  static void PlaneEquation(double* n, double* x, double* p);
107  static int GoodNormal(double* n);
108  static int Invert3x3(double M[3][3]);
109 
111  ~vtkPlanesIntersection() override;
112 
113 private:
114  int IntersectsBoundingBox(vtkPoints* R);
115  int EnclosesBoundingBox(vtkPoints* R);
116  int EvaluateFacePlane(int plane, vtkPoints* R);
117  int IntersectsProjection(vtkPoints* R, int direction);
118 
119  void SetPlaneEquations();
120  void ComputeRegionVertices();
121 
122  void planesMatrix(int p1, int p2, int p3, double M[3][3]) const;
123  int duplicate(double testv[3]) const;
124  void planesRHS(int p1, int p2, int p3, double r[3]) const;
125  int outsideRegion(double v[3]);
126 
127  // plane equations
128  double* Planes;
129 
130  // vertices of convex regions enclosed by the planes, also
131  // the ccw hull of that region projected in 3 orthog. directions
132  vtkPointsProjectedHull* RegionPts;
133 
135  void operator=(const vtkPlanesIntersection&) = delete;
136 };
137 #endif
static vtkPlanes * New()
Standard methods for instantiation, type information, and printing.
implicit function for convex set of planes
Definition: vtkPlanes.h:52
A vtkPlanesIntersection object is a vtkPlanes object that can compute whether the arbitrary convex re...
abstract class to specify cell behavior
Definition: vtkCell.h:60
a simple class to control print indentation
Definition: vtkIndent.h:39
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:39