VTK
dox/Filters/Extraction/vtkExtractSelectedFrustum.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkExtractSelectedFrustum.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 =========================================================================*/
00038 #ifndef __vtkExtractSelectedFrustum_h
00039 #define __vtkExtractSelectedFrustum_h
00040 
00041 #include "vtkFiltersExtractionModule.h" // For export macro
00042 #include "vtkExtractSelectionBase.h"
00043 
00044 class vtkPlanes;
00045 class vtkInformation;
00046 class vtkInformationVector;
00047 class vtkCell;
00048 class vtkPoints;
00049 class vtkDoubleArray;
00050 
00051 class VTKFILTERSEXTRACTION_EXPORT vtkExtractSelectedFrustum : public vtkExtractSelectionBase
00052 {
00053 public:
00054   static vtkExtractSelectedFrustum *New();
00055   vtkTypeMacro(vtkExtractSelectedFrustum, vtkExtractSelectionBase);
00056   void PrintSelf(ostream& os, vtkIndent indent);
00057 
00059   unsigned long GetMTime();
00060 
00062 
00063   virtual void SetFrustum(vtkPlanes*);
00064   vtkGetObjectMacro(Frustum,vtkPlanes);
00066 
00071   void CreateFrustum(double vertices[32]);
00072 
00074 
00076   vtkGetObjectMacro(ClipPoints, vtkPoints);
00078 
00080 
00081   vtkSetMacro(FieldType,int);
00082   vtkGetMacro(FieldType,int);
00084 
00086 
00088   vtkSetMacro(ContainingCells,int);
00089   vtkGetMacro(ContainingCells,int);
00091 
00093   int OverallBoundsTest(double *bounds);
00094 
00096 
00098   vtkSetMacro(ShowBounds,int);
00099   vtkGetMacro(ShowBounds,int);
00100   vtkBooleanMacro(ShowBounds,int);
00102 
00104 
00105   vtkSetMacro(InsideOut,int);
00106   vtkGetMacro(InsideOut,int);
00107   vtkBooleanMacro(InsideOut,int);
00109 
00110 protected:
00111   vtkExtractSelectedFrustum(vtkPlanes *f=NULL);
00112   ~vtkExtractSelectedFrustum();
00113 
00114   // sets up output dataset
00115   virtual int RequestDataObject(vtkInformation* request,
00116                                 vtkInformationVector** inputVector,
00117                                 vtkInformationVector* outputVector);
00118 
00119   //execution
00120   virtual int RequestData(vtkInformation *,
00121                           vtkInformationVector **, vtkInformationVector *);
00122   int ABoxFrustumIsect(double bounds[], vtkCell *cell);
00123   int FrustumClipPolygon(int nverts,
00124                          double *ivlist, double *wvlist, double *ovlist);
00125   void PlaneClipPolygon(int nverts, double *ivlist,
00126                         int pid, int &noverts, double *ovlist);
00127   void PlaneClipEdge(double *V0, double *V1,
00128                      int pid, int &noverts, double *overts);
00129   int IsectDegenerateCell(vtkCell *cell);
00130 
00131 
00132   //used in CreateFrustum
00133   void ComputePlane(int idx,
00134                     double v0[3], double v1[2], double v2[3],
00135                     vtkPoints *points, vtkDoubleArray *norms);
00136 
00137   //modes
00138   int FieldType;
00139   int ContainingCells;
00140   int InsideOut;
00141 
00142   //used internally
00143   vtkPlanes *Frustum;
00144   int np_vertids[6][2];
00145 
00146   //for debugging
00147   vtkPoints *ClipPoints;
00148   int NumRejects;
00149   int NumIsects;
00150   int NumAccepts;
00151   int ShowBounds;
00152 
00153 private:
00154   vtkExtractSelectedFrustum(const vtkExtractSelectedFrustum&);  // Not implemented.
00155   void operator=(const vtkExtractSelectedFrustum&);  // Not implemented.
00156 
00157 };
00158 
00159 #endif
00160 
00161