VTK
vtkBSPCuts.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBSPCuts.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*----------------------------------------------------------------------------
16  Copyright (c) Sandia Corporation
17  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
18 ----------------------------------------------------------------------------*/
19 
35 #ifndef __vtkBSPCuts_h
36 #define __vtkBSPCuts_h
37 
38 #include "vtkDataObject.h"
39 
40 class vtkKdNode;
41 
43 {
44 public:
45  static vtkBSPCuts *New();
46  vtkTypeMacro(vtkBSPCuts, vtkDataObject);
47  void PrintSelf(ostream& os, vtkIndent indent);
48 
61  void CreateCuts(double *bounds,
62  int ncuts, int *dim, double *coord,
63  int *lower, int *upper,
64  double *lowerDataCoord, double *upperDataCoord,
65  int *npoints);
66 
69  void CreateCuts(vtkKdNode *kd);
70 
74  vtkKdNode *GetKdNodeTree(){return this->Top;}
75 
79  vtkGetMacro(NumberOfCuts, int);
80 
83  int GetArrays(int len, int *dim, double *coord, int *lower, int *upper,
84  double *lowerDataCoord, double *upperDataCoord, int *npoints);
85 
88  int Equals(vtkBSPCuts *other, double tolerance = 0.0);
89 
90  void PrintTree();
91  void PrintArrays();
92 
93  //BTX
95 
97  static vtkBSPCuts* GetData(vtkInformationVector* v, int i=0);
98  //ETX
100 
102  virtual void Initialize();
103 
105 
107  virtual void ShallowCopy(vtkDataObject *src);
108  virtual void DeepCopy(vtkDataObject *src);
110 
111 protected:
112 
113  vtkBSPCuts();
114  ~vtkBSPCuts();
115 
116  static void DeleteAllDescendants(vtkKdNode *kd);
117 
118  static int CountNodes(vtkKdNode *kd);
119  static void SetMinMaxId(vtkKdNode *kd);
120  static void _PrintTree(vtkKdNode *kd, int depth);
121 
122  void BuildTree(vtkKdNode *kd, int idx);
123  int WriteArray(vtkKdNode *kd, int loc);
124 
125  void ResetArrays();
126  void AllocateArrays(int size);
127 
129 
130  // required cut information
131 
132  int NumberOfCuts;// number of cuts, also length of each array
133  int *Dim; // dimension (x/y/z - 0/1/2) where cut occurs
134  double *Coord; // location of cut along axis
135  int *Lower; // location in arrays of left (lower) child info
136  int *Upper; // location in arrays of right (lower) child info
137 
138  // optional cut information
139 
140  double *LowerDataCoord; // coordinate of uppermost data in lower half
141  double *UpperDataCoord; // coordinate of lowermost data in upper half
142  int *Npoints; // number of data values in partition
143 
144  double Bounds[6];
145 
146  vtkBSPCuts(const vtkBSPCuts&); // Not implemented
147  void operator=(const vtkBSPCuts&); // Not implemented
148 };
149 
150 #endif