VTK  9.3.0
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 
39 #ifndef vtkPlanesIntersection_h
40 #define vtkPlanesIntersection_h
41 
42 #include "vtkCommonDataModelModule.h" // For export macro
43 #include "vtkPlanes.h"
44 
45 VTK_ABI_NAMESPACE_BEGIN
46 class vtkPoints;
48 class vtkCell;
49 
50 class VTKCOMMONDATAMODEL_EXPORT vtkPlanesIntersection : public vtkPlanes
51 {
53 
54 public:
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
58 
66  void SetRegionVertices(double* v, int nvertices);
68  // Retained for backward compatibility
69  int GetNumRegionVertices() { return this->GetNumberOfRegionVertices(); }
70  int GetRegionVertices(double* v, int nvertices);
71 
78 
87  static int PolygonIntersectsBBox(double bounds[6], vtkPoints* pts);
88 
97 
98 protected:
99  static void ComputeNormal(double* p1, double* p2, double* p3, double normal[3]);
100  static double EvaluatePlaneEquation(double* x, double* p);
101  static void PlaneEquation(double* n, double* x, double* p);
102  static int GoodNormal(double* n);
103  static int Invert3x3(double M[3][3]);
104 
107 
108 private:
109  int IntersectsBoundingBox(vtkPoints* R);
110  int EnclosesBoundingBox(vtkPoints* R);
111  int EvaluateFacePlane(int plane, vtkPoints* R);
112  int IntersectsProjection(vtkPoints* R, int direction);
113 
114  void SetPlaneEquations();
115  void ComputeRegionVertices();
116 
117  void planesMatrix(int p1, int p2, int p3, double M[3][3]) const;
118  int duplicate(double testv[3]) const;
119  void planesRHS(int p1, int p2, int p3, double r[3]) const;
120  int outsideRegion(double v[3]);
121 
122  // plane equations
123  double* Planes;
124 
125  // vertices of convex regions enclosed by the planes, also
126  // the ccw hull of that region projected in 3 orthog. directions
127  vtkPointsProjectedHull* RegionPts;
128 
130  void operator=(const vtkPlanesIntersection&) = delete;
131 };
132 VTK_ABI_NAMESPACE_END
133 #endif
abstract class to specify cell behavior
Definition: vtkCell.h:59
a simple class to control print indentation
Definition: vtkIndent.h:38
A vtkPlanesIntersection object is a vtkPlanes object that can compute whether the arbitrary convex re...
static vtkPlanesIntersection * Convert3DCell(vtkCell *cell)
Another convenience function provided by this class, returns the vtkPlanesIntersection object represe...
static int PolygonIntersectsBBox(double bounds[6], vtkPoints *pts)
A convenience function provided by this class, returns 1 if the polygon defined in pts intersects the...
int GetRegionVertices(double *v, int nvertices)
static vtkPlanesIntersection * New()
void SetRegionVertices(double *v, int nvertices)
static void ComputeNormal(double *p1, double *p2, double *p3, double normal[3])
static int GoodNormal(double *n)
static int Invert3x3(double M[3][3])
static double EvaluatePlaneEquation(double *x, double *p)
~vtkPlanesIntersection() override
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, type information, and printing.
void SetRegionVertices(vtkPoints *pts)
It helps if you know the vertices of the convex region.
static void PlaneEquation(double *n, double *x, double *p)
int IntersectsRegion(vtkPoints *R)
Return 1 if the axis aligned box defined by R intersects the region defined by the planes,...
implicit function for convex set of planes
Definition: vtkPlanes.h:51
the convex hull of the orthogonal projection of the vtkPoints in the 3 coordinate directions
represent and manipulate 3D points
Definition: vtkPoints.h:38
@ direction
Definition: vtkX3D.h:260