VTK  9.0.2
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 
42 #ifndef vtkPlanesIntersection_h
43 #define vtkPlanesIntersection_h
44 
45 #include "vtkCommonDataModelModule.h" // For export macro
46 #include "vtkPlanes.h"
47 
48 class vtkPoints;
50 class vtkCell;
51 
52 class VTKCOMMONDATAMODEL_EXPORT vtkPlanesIntersection : public vtkPlanes
53 {
55 
56 public:
57  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
60 
68  void SetRegionVertices(double* v, int nvertices);
70  // Retained for backward compatibility
71  int GetNumRegionVertices() { return this->GetNumberOfRegionVertices(); }
72  int GetRegionVertices(double* v, int nvertices);
73 
80 
89  static int PolygonIntersectsBBox(double bounds[6], vtkPoints* pts);
90 
99 
100 protected:
101  static void ComputeNormal(double* p1, double* p2, double* p3, double normal[3]);
102  static double EvaluatePlaneEquation(double* x, double* p);
103  static void PlaneEquation(double* n, double* x, double* p);
104  static int GoodNormal(double* n);
105  static int Invert3x3(double M[3][3]);
106 
109 
110 private:
111  int IntersectsBoundingBox(vtkPoints* R);
112  int EnclosesBoundingBox(vtkPoints* R);
113  int EvaluateFacePlane(int plane, vtkPoints* R);
114  int IntersectsProjection(vtkPoints* R, int direction);
115 
116  void SetPlaneEquations();
117  void ComputeRegionVertices();
118 
119  void planesMatrix(int p1, int p2, int p3, double M[3][3]) const;
120  int duplicate(double testv[3]) const;
121  void planesRHS(int p1, int p2, int p3, double r[3]) const;
122  int outsideRegion(double v[3]);
123 
124  // plane equations
125  double* Planes;
126 
127  // vertices of convex regions enclosed by the planes, also
128  // the ccw hull of that region projected in 3 orthog. directions
129  vtkPointsProjectedHull* RegionPts;
130 
132  void operator=(const vtkPlanesIntersection&) = delete;
133 };
134 #endif
abstract class to specify cell behavior
Definition: vtkCell.h:57
a simple class to control print indentation
Definition: vtkIndent.h:34
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
Methods invoked by print to print information about the object including superclasses.
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:50
the convex hull of the orthogonal projection of the vtkPoints in the 3 coordinate directions
represent and manipulate 3D points
Definition: vtkPoints.h:34
@ direction
Definition: vtkX3D.h:266