VTK  9.1.0
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 
61 #ifndef vtkPlanesIntersection_h
62 #define vtkPlanesIntersection_h
63 
64 #include "vtkCommonDataModelModule.h" // For export macro
65 #include "vtkPlanes.h"
66 
67 class vtkPoints;
69 class vtkCell;
70 
71 class VTKCOMMONDATAMODEL_EXPORT vtkPlanesIntersection : public vtkPlanes
72 {
74 
75 public:
76  void PrintSelf(ostream& os, vtkIndent indent) override;
77 
79 
87  void SetRegionVertices(double* v, int nvertices);
89  // Retained for backward compatibility
90  int GetNumRegionVertices() { return this->GetNumberOfRegionVertices(); }
91  int GetRegionVertices(double* v, int nvertices);
92 
99 
108  static int PolygonIntersectsBBox(double bounds[6], vtkPoints* pts);
109 
118 
119 protected:
120  static void ComputeNormal(double* p1, double* p2, double* p3, double normal[3]);
121  static double EvaluatePlaneEquation(double* x, double* p);
122  static void PlaneEquation(double* n, double* x, double* p);
123  static int GoodNormal(double* n);
124  static int Invert3x3(double M[3][3]);
125 
128 
129 private:
130  int IntersectsBoundingBox(vtkPoints* R);
131  int EnclosesBoundingBox(vtkPoints* R);
132  int EvaluateFacePlane(int plane, vtkPoints* R);
133  int IntersectsProjection(vtkPoints* R, int direction);
134 
135  void SetPlaneEquations();
136  void ComputeRegionVertices();
137 
138  void planesMatrix(int p1, int p2, int p3, double M[3][3]) const;
139  int duplicate(double testv[3]) const;
140  void planesRHS(int p1, int p2, int p3, double r[3]) const;
141  int outsideRegion(double v[3]);
142 
143  // plane equations
144  double* Planes;
145 
146  // vertices of convex regions enclosed by the planes, also
147  // the ccw hull of that region projected in 3 orthog. directions
148  vtkPointsProjectedHull* RegionPts;
149 
151  void operator=(const vtkPlanesIntersection&) = delete;
152 };
153 #endif
abstract class to specify cell behavior
Definition: vtkCell.h:147
a simple class to control print indentation
Definition: vtkIndent.h:113
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:159
the convex hull of the orthogonal projection of the vtkPoints in the 3 coordinate directions
represent and manipulate 3D points
Definition: vtkPoints.h:143
@ direction
Definition: vtkX3D.h:266