VTK
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 {
54  vtkTypeMacro(vtkPlanesIntersection, vtkPlanes);
55 
56 public:
57  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
59  static vtkPlanesIntersection *New();
60 
67  void SetRegionVertices(vtkPoints *pts);
68  void SetRegionVertices(double *v, int nvertices);
69  int GetNumberOfRegionVertices();
70  // Retained for backward compatibility
72  {
73  return this->GetNumberOfRegionVertices();
74  }
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 
105  static void ComputeNormal(double *p1, double *p2, double *p3, double normal[3]);
106  static double EvaluatePlaneEquation(double *x, double *p);
107  static void PlaneEquation(double *n, double *x, double *p);
108  static int GoodNormal(double *n);
109  static int Invert3x3(double M[3][3]);
110 
112  ~vtkPlanesIntersection() override;
113 
114 private:
115 
116  int IntersectsBoundingBox(vtkPoints *R);
117  int EnclosesBoundingBox(vtkPoints *R);
118  int EvaluateFacePlane(int plane, vtkPoints *R);
119  int IntersectsProjection(vtkPoints *R, int direction);
120 
121  void SetPlaneEquations();
122  void ComputeRegionVertices();
123 
124  void planesMatrix(int p1, int p2, int p3, double M[3][3]) const;
125  int duplicate(double testv[3]) const;
126  void planesRHS(int p1, int p2, int p3, double r[3]) const;
127  int outsideRegion(double v[3]) ;
128 
129  // plane equations
130  double *Planes;
131 
132  // vertices of convex regions enclosed by the planes, also
133  // the ccw hull of that region projected in 3 orthog. directions
134  vtkPointsProjectedHull *RegionPts;
135 
137  void operator=(const vtkPlanesIntersection&) = delete;
138 };
139 #endif
140 
141 
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkPlanes::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::direction
Definition: vtkX3D.h:260
vtkPlanes
implicit function for convex set of planes
Definition: vtkPlanes.h:49
vtkPlanesIntersection::GetNumRegionVertices
int GetNumRegionVertices()
Definition: vtkPlanesIntersection.h:71
vtkPlanesIntersection
A vtkPlanesIntersection object is a vtkPlanes object that can compute whether the arbitrary convex re...
Definition: vtkPlanesIntersection.h:52
vtkPointsProjectedHull
the convex hull of the orthogonal projection of the vtkPoints in the 3 coordinate directions
Definition: vtkPointsProjectedHull.h:38
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:56
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkPlanes::New
static vtkPlanes * New()
Standard methods for instantiation, type information, and printing.
vtkPlanes.h