VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkPlanesIntersection.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /*---------------------------------------------------------------------------- 00016 Copyright (c) Sandia Corporation 00017 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details. 00018 ----------------------------------------------------------------------------*/ 00019 00041 #ifndef __vtkPlanesIntersection_h 00042 #define __vtkPlanesIntersection_h 00043 00044 #include "vtkPlanes.h" 00045 00046 class vtkPoints; 00047 class vtkPointsProjectedHull; 00048 class vtkCell; 00049 00050 class VTK_FILTERING_EXPORT vtkPlanesIntersection : public vtkPlanes 00051 { 00052 vtkTypeMacro(vtkPlanesIntersection, vtkPlanes); 00053 00054 public: 00055 void PrintSelf(ostream& os, vtkIndent indent); 00056 00057 static vtkPlanesIntersection *New(); 00058 00062 void SetRegionVertices(vtkPoints *pts); 00063 void SetRegionVertices(double *v, int nvertices); 00064 int GetNumRegionVertices(); 00065 int GetRegionVertices(double *v, int nvertices); 00066 00070 int IntersectsRegion(vtkPoints *R); 00071 00076 static int PolygonIntersectsBBox(double bounds[6], vtkPoints *pts); 00077 00083 static vtkPlanesIntersection *Convert3DCell(vtkCell *cell); 00084 00085 protected: 00086 00087 static void ComputeNormal(double *p1, double *p2, double *p3, double normal[3]); 00088 static double EvaluatePlaneEquation(double *x, double *p); 00089 static void PlaneEquation(double *n, double *x, double *p); 00090 static int GoodNormal(double *n); 00091 static int Invert3x3(double M[3][3]); 00092 00093 vtkPlanesIntersection(); 00094 ~vtkPlanesIntersection(); 00095 00096 private: 00097 00098 int IntersectsBoundingBox(vtkPoints *R); 00099 int EnclosesBoundingBox(vtkPoints *R); 00100 int EvaluateFacePlane(int plane, vtkPoints *R); 00101 int IntersectsProjection(vtkPoints *R, int direction); 00102 00103 void SetPlaneEquations(); 00104 void ComputeRegionVertices(); 00105 00106 void planesMatrix(int p1, int p2, int p3, double M[3][3]) const; 00107 int duplicate(double testv[3]) const; 00108 void planesRHS(int p1, int p2, int p3, double r[3]) const; 00109 int outsideRegion(double v[3]) ; 00110 00111 // plane equations 00112 double *Plane; 00113 00114 // vertices of convex regions enclosed by the planes, also 00115 // the ccw hull of that region projected in 3 orthog. directions 00116 vtkPointsProjectedHull *regionPts; 00117 00118 vtkPlanesIntersection(const vtkPlanesIntersection&); // Not implemented 00119 void operator=(const vtkPlanesIntersection&); // Not implemented 00120 }; 00121 #endif 00122 00123