VTK
dox/Common/DataModel/vtkBSPCuts.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkBSPCuts.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 
00035 #ifndef __vtkBSPCuts_h
00036 #define __vtkBSPCuts_h
00037 
00038 #include "vtkCommonDataModelModule.h" // For export macro
00039 #include "vtkDataObject.h"
00040 
00041 class vtkKdNode;
00042 
00043 class VTKCOMMONDATAMODEL_EXPORT vtkBSPCuts : public vtkDataObject
00044 {
00045 public:
00046   static vtkBSPCuts *New();
00047   vtkTypeMacro(vtkBSPCuts, vtkDataObject);
00048   void PrintSelf(ostream& os, vtkIndent indent);
00049 
00062   void CreateCuts(double *bounds,
00063                   int ncuts, int *dim, double *coord,
00064                   int *lower, int *upper,
00065                   double *lowerDataCoord, double *upperDataCoord,
00066                   int *npoints);
00067 
00070   void CreateCuts(vtkKdNode *kd);
00071 
00075   vtkKdNode *GetKdNodeTree(){return this->Top;}
00076 
00080   vtkGetMacro(NumberOfCuts, int);
00081 
00084   int GetArrays(int len, int *dim, double *coord, int *lower, int *upper,
00085                 double *lowerDataCoord, double *upperDataCoord, int *npoints);
00086 
00089   int Equals(vtkBSPCuts *other, double tolerance = 0.0);
00090 
00091   void PrintTree();
00092   void PrintArrays();
00093 
00094   //BTX
00096 
00097   static vtkBSPCuts* GetData(vtkInformation* info);
00098   static vtkBSPCuts* GetData(vtkInformationVector* v, int i=0);
00099   //ETX
00101 
00103   virtual void Initialize();
00104 
00106 
00108   virtual void ShallowCopy(vtkDataObject *src);
00109   virtual void DeepCopy(vtkDataObject *src);
00111 
00112 protected:
00113 
00114   vtkBSPCuts();
00115   ~vtkBSPCuts();
00116 
00117   static void DeleteAllDescendants(vtkKdNode *kd);
00118 
00119   static int CountNodes(vtkKdNode *kd);
00120   static void SetMinMaxId(vtkKdNode *kd);
00121   static void _PrintTree(vtkKdNode *kd, int depth);
00122 
00123   void BuildTree(vtkKdNode *kd, int idx);
00124   int WriteArray(vtkKdNode *kd, int loc);
00125 
00126   void ResetArrays();
00127   void AllocateArrays(int size);
00128 
00129   vtkKdNode *Top;
00130 
00131   // required cut information
00132 
00133   int NumberOfCuts;// number of cuts, also length of each array
00134   int *Dim;        // dimension (x/y/z - 0/1/2) where cut occurs
00135   double *Coord;   // location of cut along axis
00136   int *Lower;               // location in arrays of left (lower) child info
00137   int *Upper;               // location in arrays of right (lower) child info
00138 
00139   // optional cut information
00140 
00141   double *LowerDataCoord;   // coordinate of uppermost data in lower half
00142   double *UpperDataCoord;   // coordinate of lowermost data in upper half
00143   int *Npoints;             // number of data values in partition
00144 
00145   double Bounds[6];
00146 
00147   vtkBSPCuts(const vtkBSPCuts&); // Not implemented
00148   void operator=(const vtkBSPCuts&); // Not implemented
00149 };
00150 
00151 #endif