VTK
|
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 "vtkExtractSelectionBase.h" 00042 00043 class vtkPlanes; 00044 class vtkInformation; 00045 class vtkInformationVector; 00046 class vtkCell; 00047 class vtkPoints; 00048 class vtkDoubleArray; 00049 00050 class VTK_GRAPHICS_EXPORT vtkExtractSelectedFrustum : public vtkExtractSelectionBase 00051 { 00052 public: 00053 static vtkExtractSelectedFrustum *New(); 00054 vtkTypeMacro(vtkExtractSelectedFrustum, vtkExtractSelectionBase); 00055 void PrintSelf(ostream& os, vtkIndent indent); 00056 00058 unsigned long GetMTime(); 00059 00061 00062 virtual void SetFrustum(vtkPlanes*); 00063 vtkGetObjectMacro(Frustum,vtkPlanes); 00065 00070 void CreateFrustum(double vertices[32]); 00071 00073 00075 vtkGetObjectMacro(ClipPoints, vtkPoints); 00077 00079 00080 vtkSetMacro(FieldType,int); 00081 vtkGetMacro(FieldType,int); 00083 00085 00087 vtkSetMacro(ContainingCells,int); 00088 vtkGetMacro(ContainingCells,int); 00090 00092 int OverallBoundsTest(double *bounds); 00093 00095 00097 vtkSetMacro(ShowBounds,int); 00098 vtkGetMacro(ShowBounds,int); 00099 vtkBooleanMacro(ShowBounds,int); 00101 00103 00104 vtkSetMacro(InsideOut,int); 00105 vtkGetMacro(InsideOut,int); 00106 vtkBooleanMacro(InsideOut,int); 00108 00109 protected: 00110 vtkExtractSelectedFrustum(vtkPlanes *f=NULL); 00111 ~vtkExtractSelectedFrustum(); 00112 00113 // sets up output dataset 00114 virtual int RequestDataObject(vtkInformation* request, 00115 vtkInformationVector** inputVector, 00116 vtkInformationVector* outputVector); 00117 00118 //execution 00119 virtual int RequestData(vtkInformation *, 00120 vtkInformationVector **, vtkInformationVector *); 00121 int ABoxFrustumIsect(double bounds[], vtkCell *cell); 00122 int FrustumClipPolygon(int nverts, 00123 double *ivlist, double *wvlist, double *ovlist); 00124 void PlaneClipPolygon(int nverts, double *ivlist, 00125 int pid, int &noverts, double *ovlist); 00126 void PlaneClipEdge(double *V0, double *V1, 00127 int pid, int &noverts, double *overts); 00128 int IsectDegenerateCell(vtkCell *cell); 00129 00130 00131 //used in CreateFrustum 00132 void ComputePlane(int idx, 00133 double v0[3], double v1[2], double v2[3], 00134 vtkPoints *points, vtkDoubleArray *norms); 00135 00136 //modes 00137 int FieldType; 00138 int ContainingCells; 00139 int InsideOut; 00140 00141 //used internally 00142 vtkPlanes *Frustum; 00143 int np_vertids[6][2]; 00144 00145 //for debugging 00146 vtkPoints *ClipPoints; 00147 int NumRejects; 00148 int NumIsects; 00149 int NumAccepts; 00150 int ShowBounds; 00151 00152 private: 00153 vtkExtractSelectedFrustum(const vtkExtractSelectedFrustum&); // Not implemented. 00154 void operator=(const vtkExtractSelectedFrustum&); // Not implemented. 00155 00156 }; 00157 00158 #endif 00159 00160