00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
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   
00112   double *Plane;
00113 
00114   
00115   
00116   vtkPointsProjectedHull *regionPts;
00117 
00118   vtkPlanesIntersection(const vtkPlanesIntersection&); 
00119   void operator=(const vtkPlanesIntersection&); 
00120 };
00121 #endif
00122 
00123