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 
44 #ifndef vtkPlanesIntersection_h
45 #define vtkPlanesIntersection_h
46 
47 #include "vtkCommonDataModelModule.h" // For export macro
48 #include "vtkPlanes.h"
49 
50 class vtkPoints;
52 class vtkCell;
53 
55 {
56  vtkTypeMacro(vtkPlanesIntersection, vtkPlanes);
57 
58 public:
59  void PrintSelf(ostream& os, vtkIndent indent);
60 
61  static vtkPlanesIntersection *New();
62 
66  void SetRegionVertices(vtkPoints *pts);
67  void SetRegionVertices(double *v, int nvertices);
68  int GetNumberOfRegionVertices();
69  // Retained for backward compatibility
71  {
72  return this->GetNumberOfRegionVertices();
73  }
74  int GetRegionVertices(double *v, int nvertices);
75 
79  int IntersectsRegion(vtkPoints *R);
80 
85  static int PolygonIntersectsBBox(double bounds[6], vtkPoints *pts);
86 
92  static vtkPlanesIntersection *Convert3DCell(vtkCell *cell);
93 
94 protected:
95 
96  static void ComputeNormal(double *p1, double *p2, double *p3, double normal[3]);
97  static double EvaluatePlaneEquation(double *x, double *p);
98  static void PlaneEquation(double *n, double *x, double *p);
99  static int GoodNormal(double *n);
100  static int Invert3x3(double M[3][3]);
101 
104 
105 private:
106 
107  int IntersectsBoundingBox(vtkPoints *R);
108  int EnclosesBoundingBox(vtkPoints *R);
109  int EvaluateFacePlane(int plane, vtkPoints *R);
110  int IntersectsProjection(vtkPoints *R, int direction);
111 
112  void SetPlaneEquations();
113  void ComputeRegionVertices();
114 
115  void planesMatrix(int p1, int p2, int p3, double M[3][3]) const;
116  int duplicate(double testv[3]) const;
117  void planesRHS(int p1, int p2, int p3, double r[3]) const;
118  int outsideRegion(double v[3]) ;
119 
120  // plane equations
121  double *Plane;
122 
123  // vertices of convex regions enclosed by the planes, also
124  // the ccw hull of that region projected in 3 orthog. directions
125  vtkPointsProjectedHull *RegionPts;
126 
127  vtkPlanesIntersection(const vtkPlanesIntersection&); // Not implemented
128  void operator=(const vtkPlanesIntersection&); // Not implemented
129 };
130 #endif
131 
132 
void PrintSelf(ostream &os, vtkIndent indent)
static vtkPlanes * New()
vtkPlane * Plane
Definition: vtkPlanes.h:116
implicit function for convex set of planes
Definition: vtkPlanes.h:53
A vtkPlanesIntersection object is a vtkPlanes object that can compute whether the arbitrary convex re...
abstract class to specify cell behavior
Definition: vtkCell.h:58
a simple class to control print indentation
Definition: vtkIndent.h:38
the convex hull of the orthogonal projection of the vtkPoints in the 3 coordinate directions ...
#define M(row, col)
#define VTKCOMMONDATAMODEL_EXPORT
represent and manipulate 3D points
Definition: vtkPoints.h:38