Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkPlanesIntersection.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkPlanesIntersection.h,v $
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 
00051 #ifndef __vtkPlanesIntersection_h
00052 #define __vtkPlanesIntersection_h
00053 
00054 #include "vtkPlanes.h"
00055 
00056 class vtkPoints;
00057 class vtkRenderer;
00058 class vtkPointsProjectedHull;
00059 class vtkCell;
00060 
00061 class VTK_PARALLEL_EXPORT vtkPlanesIntersection : public vtkPlanes
00062 {
00063   vtkTypeRevisionMacro(vtkPlanesIntersection, vtkPlanes);
00064 
00065 public:
00066   void PrintSelf(ostream& os, vtkIndent indent);
00067 
00068   static vtkPlanesIntersection *New();
00069 
00073   void SetRegionVertices(vtkPoints *pts);
00074   void SetRegionVertices(double *v, int nvertices);
00075   int GetNumRegionVertices();
00076   int GetRegionVertices(double *v, int nvertices);
00077 
00081   int IntersectsRegion(vtkPoints *R);
00082 
00087   static int PolygonIntersectsBBox(double bounds[6], vtkPoints *pts);
00088 
00097   static vtkPlanesIntersection *ConvertFrustumToWorld(vtkRenderer *ren,
00098                                                       double x0, double x1, double y0, double y1);
00099 
00105   static vtkPlanesIntersection *Convert3DCell(vtkCell *cell);
00106 
00107 protected:
00108 
00109   vtkPlanesIntersection();
00110   ~vtkPlanesIntersection();
00111 
00112 private:
00113 
00114   int IntersectsBoundingBox(vtkPoints *R);
00115   int EnclosesBoundingBox(vtkPoints *R);
00116   int EvaluateFacePlane(int plane, vtkPoints *R);
00117   int IntersectsProjection(vtkPoints *R, int direction);
00118 
00119   void SetPlaneEquations();
00120   void ComputeRegionVertices();
00121 
00122   void planesMatrix(int p1, int p2, int p3, double M[3][3]) const;
00123   int duplicate(double testv[3]) const;
00124   void planesRHS(int p1, int p2, int p3, double r[3]) const;
00125   int outsideRegion(double v[3]) ;
00126 
00127   static double EvaluatePlaneEquation(double *x, double *p);
00128   static void PlaneEquation(double *n, double *x, double *p);
00129   static void ComputeNormal(double *p1, double *p2, double *p3, double normal[3]);
00130   static int GoodNormal(double *n);
00131   static void PointOnPlane(double a, double b, double c, double d, double pt[3]);
00132   static double SensibleZCoordinate(vtkRenderer *ren);
00133     
00134   static vtkPlanesIntersection *ConvertFrustumToWorldPerspective(
00135     vtkRenderer *ren,
00136     double xmin, double xmax, double ymin, double ymax);
00137   static vtkPlanesIntersection *ConvertFrustumToWorldParallel(
00138     vtkRenderer *ren,
00139     double xmin, double xmax, double ymin, double ymax);
00140     
00141     
00142   static int Invert3x3(double M[3][3]);
00143 
00144   // plane equations
00145   double *Plane;
00146 
00147   // vertices of convex regions enclosed by the planes, also
00148   //    the ccw hull of that region projected in 3 orthog. directions
00149   vtkPointsProjectedHull *regionPts;
00150 
00151   vtkPlanesIntersection(const vtkPlanesIntersection&); // Not implemented
00152   void operator=(const vtkPlanesIntersection&); // Not implemented
00153 };
00154 #endif
00155 
00156