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 "vtkCommonDataModelModule.h" // For export macro 00045 #include "vtkPlanes.h" 00046 00047 class vtkPoints; 00048 class vtkPointsProjectedHull; 00049 class vtkCell; 00050 00051 class VTKCOMMONDATAMODEL_EXPORT vtkPlanesIntersection : public vtkPlanes 00052 { 00053 vtkTypeMacro(vtkPlanesIntersection, vtkPlanes); 00054 00055 public: 00056 void PrintSelf(ostream& os, vtkIndent indent); 00057 00058 static vtkPlanesIntersection *New(); 00059 00063 void SetRegionVertices(vtkPoints *pts); 00064 void SetRegionVertices(double *v, int nvertices); 00065 int GetNumRegionVertices(); 00066 int GetRegionVertices(double *v, int nvertices); 00067 00071 int IntersectsRegion(vtkPoints *R); 00072 00077 static int PolygonIntersectsBBox(double bounds[6], vtkPoints *pts); 00078 00084 static vtkPlanesIntersection *Convert3DCell(vtkCell *cell); 00085 00086 protected: 00087 00088 static void ComputeNormal(double *p1, double *p2, double *p3, double normal[3]); 00089 static double EvaluatePlaneEquation(double *x, double *p); 00090 static void PlaneEquation(double *n, double *x, double *p); 00091 static int GoodNormal(double *n); 00092 static int Invert3x3(double M[3][3]); 00093 00094 vtkPlanesIntersection(); 00095 ~vtkPlanesIntersection(); 00096 00097 private: 00098 00099 int IntersectsBoundingBox(vtkPoints *R); 00100 int EnclosesBoundingBox(vtkPoints *R); 00101 int EvaluateFacePlane(int plane, vtkPoints *R); 00102 int IntersectsProjection(vtkPoints *R, int direction); 00103 00104 void SetPlaneEquations(); 00105 void ComputeRegionVertices(); 00106 00107 void planesMatrix(int p1, int p2, int p3, double M[3][3]) const; 00108 int duplicate(double testv[3]) const; 00109 void planesRHS(int p1, int p2, int p3, double r[3]) const; 00110 int outsideRegion(double v[3]) ; 00111 00112 // plane equations 00113 double *Plane; 00114 00115 // vertices of convex regions enclosed by the planes, also 00116 // the ccw hull of that region projected in 3 orthog. directions 00117 vtkPointsProjectedHull *regionPts; 00118 00119 vtkPlanesIntersection(const vtkPlanesIntersection&); // Not implemented 00120 void operator=(const vtkPlanesIntersection&); // Not implemented 00121 }; 00122 #endif 00123 00124