VTK
dox/Graphics/vtkClipHyperOctree.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkClipHyperOctree.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 =========================================================================*/
00062 #ifndef __vtkClipHyperOctree_h
00063 #define __vtkClipHyperOctree_h
00064 
00065 #include "vtkUnstructuredGridAlgorithm.h"
00066 
00067 class vtkImplicitFunction;
00068 class vtkIncrementalPointLocator;
00069 class vtkHyperOctreeCursor;
00070 class vtkHyperOctree;
00071 class vtkUnsignedCharArray;
00072 class vtkIdTypeArray;
00073 class vtkCellArray;
00074 class vtkCellData;
00075 class vtkPointData;
00076 class vtkOrderedTriangulator;
00077 class vtkDoubleArray;
00078 class vtkTetra;
00079 class vtkPoints;
00080 class vtkPolygon;
00081 class vtkHyperOctreeClipCutPointsGrabber;
00082 
00083 class VTK_GRAPHICS_EXPORT vtkClipHyperOctree : public vtkUnstructuredGridAlgorithm
00084 {
00085 public:
00086   vtkTypeMacro(vtkClipHyperOctree,vtkUnstructuredGridAlgorithm);
00087   void PrintSelf(ostream& os, vtkIndent indent);
00088 
00091   static vtkClipHyperOctree *New();
00092 
00094 
00097   vtkSetMacro(Value,double);
00098   vtkGetMacro(Value,double);
00100   
00102 
00107   vtkSetMacro(InsideOut,int);
00108   vtkGetMacro(InsideOut,int);
00109   vtkBooleanMacro(InsideOut,int);
00111 
00113 
00116   virtual void SetClipFunction(vtkImplicitFunction*);
00117   vtkGetObjectMacro(ClipFunction,vtkImplicitFunction);
00119 
00121 
00125   vtkSetMacro(GenerateClipScalars,int);
00126   vtkGetMacro(GenerateClipScalars,int);
00127   vtkBooleanMacro(GenerateClipScalars,int);
00129 
00131 
00133   vtkSetMacro(GenerateClippedOutput,int);
00134   vtkGetMacro(GenerateClippedOutput,int);
00135   vtkBooleanMacro(GenerateClippedOutput,int);
00137   
00139   vtkUnstructuredGrid *GetClippedOutput();
00140 
00142 
00144   void SetLocator(vtkIncrementalPointLocator *locator);
00145   vtkGetObjectMacro(Locator,vtkIncrementalPointLocator);
00147 
00150   void CreateDefaultLocator();
00151 
00153   unsigned long GetMTime();
00154 
00155 protected:
00156   vtkClipHyperOctree(vtkImplicitFunction *cf=NULL);
00157   ~vtkClipHyperOctree();
00158 
00159   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00160   
00162 
00164   void ClipNode(vtkHyperOctreeCursor *cursor,
00165                 int level,
00166                 double bounds[6]);
00168   
00169   virtual int FillInputPortInformation(int port, vtkInformation *info);
00170   vtkImplicitFunction *ClipFunction;
00171   
00172   vtkIncrementalPointLocator *Locator;
00173   vtkIncrementalPointLocator *Locator2; // used for the clipped output
00174   
00175   int InsideOut;
00176   double Value;
00177   int GenerateClipScalars;
00178 
00179   int GenerateClippedOutput;
00180   
00181   vtkHyperOctree *Input;
00182   vtkUnstructuredGrid *Output;
00183   vtkUnstructuredGrid *ClippedOutput;
00184   
00185   vtkUnsignedCharArray *Types[2];
00186   vtkIdTypeArray *Locs[2];
00187   vtkCellArray *Conn[2];
00188   vtkCellData *InCD;
00189   vtkCellData *OutCD[2];
00190   vtkPointData *OutPD[2];
00191   vtkOrderedTriangulator *Triangulator;
00192   
00193   vtkHyperOctreeCursor *Sibling; // to avoid allocation in the loop
00194   
00195   vtkDoubleArray *CellScalars;
00196   vtkTetra *Tetra;
00197   vtkDoubleArray *TetScalars;
00198   
00199   vtkPoints *Pts;
00200   vtkPolygon *Polygon;
00201   
00202   vtkIdType CellTypeCounter[65536]; // up-to-65536 points per octant
00203   vtkIdType TotalCounter;
00204   vtkIdType TemplateCounter; // record the number of octants that succceed
00205   // to use the template triangulator
00206   
00207   vtkHyperOctreeClipCutPointsGrabber *Grabber;
00208   
00209 private:
00210   vtkClipHyperOctree(const vtkClipHyperOctree&);  // Not implemented.
00211   void operator=(const vtkClipHyperOctree&);  // Not implemented.
00212 };
00213 
00214 #endif