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 
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 {
44 
45 public:
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
49 
57  void SetRegionVertices(double* v, int nvertices);
59  // Retained for backward compatibility
60  int GetNumRegionVertices() { return this->GetNumberOfRegionVertices(); }
61  int GetRegionVertices(double* v, int nvertices);
62 
69 
78  static int PolygonIntersectsBBox(double bounds[6], vtkPoints* pts);
79 
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 
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
abstract class to specify cell behavior
Definition: vtkCell.h:50
a simple class to control print indentation
Definition: vtkIndent.h:29
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:42
the convex hull of the orthogonal projection of the vtkPoints in the 3 coordinate directions
represent and manipulate 3D points
Definition: vtkPoints.h:29
@ direction
Definition: vtkX3D.h:260