VTK
|
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 "vtkDataObject.h" 00039 00040 class vtkKdNode; 00041 00042 class VTK_FILTERING_EXPORT vtkBSPCuts : public vtkDataObject 00043 { 00044 public: 00045 static vtkBSPCuts *New(); 00046 vtkTypeMacro(vtkBSPCuts, vtkDataObject); 00047 void PrintSelf(ostream& os, vtkIndent indent); 00048 00061 void CreateCuts(double *bounds, 00062 int ncuts, int *dim, double *coord, 00063 int *lower, int *upper, 00064 double *lowerDataCoord, double *upperDataCoord, 00065 int *npoints); 00066 00069 void CreateCuts(vtkKdNode *kd); 00070 00074 vtkKdNode *GetKdNodeTree(){return this->Top;} 00075 00079 vtkGetMacro(NumberOfCuts, int); 00080 00083 int GetArrays(int len, int *dim, double *coord, int *lower, int *upper, 00084 double *lowerDataCoord, double *upperDataCoord, int *npoints); 00085 00088 int Equals(vtkBSPCuts *other, double tolerance = 0.0); 00089 00090 void PrintTree(); 00091 void PrintArrays(); 00092 00093 //BTX 00095 00096 static vtkBSPCuts* GetData(vtkInformation* info); 00097 static vtkBSPCuts* GetData(vtkInformationVector* v, int i=0); 00098 //ETX 00100 00102 virtual void Initialize(); 00103 00105 00107 virtual void ShallowCopy(vtkDataObject *src); 00108 virtual void DeepCopy(vtkDataObject *src); 00110 00111 protected: 00112 00113 vtkBSPCuts(); 00114 ~vtkBSPCuts(); 00115 00116 static void DeleteAllDescendants(vtkKdNode *kd); 00117 00118 static int CountNodes(vtkKdNode *kd); 00119 static void SetMinMaxId(vtkKdNode *kd); 00120 static void _PrintTree(vtkKdNode *kd, int depth); 00121 00122 void BuildTree(vtkKdNode *kd, int idx); 00123 int WriteArray(vtkKdNode *kd, int loc); 00124 00125 void ResetArrays(); 00126 void AllocateArrays(int size); 00127 00128 vtkKdNode *Top; 00129 00130 // required cut information 00131 00132 int NumberOfCuts;// number of cuts, also length of each array 00133 int *Dim; // dimension (x/y/z - 0/1/2) where cut occurs 00134 double *Coord; // location of cut along axis 00135 int *Lower; // location in arrays of left (lower) child info 00136 int *Upper; // location in arrays of right (lower) child info 00137 00138 // optional cut information 00139 00140 double *LowerDataCoord; // coordinate of uppermost data in lower half 00141 double *UpperDataCoord; // coordinate of lowermost data in upper half 00142 int *Npoints; // number of data values in partition 00143 00144 double Bounds[6]; 00145 00146 vtkBSPCuts(const vtkBSPCuts&); // Not implemented 00147 void operator=(const vtkBSPCuts&); // Not implemented 00148 }; 00149 00150 #endif