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 
36 #ifndef vtkBSPCuts_h
37 #define vtkBSPCuts_h
38 
39 #include "vtkCommonDataModelModule.h" // For export macro
40 #include "vtkDataObject.h"
41 
42 class vtkKdNode;
43 
44 class VTKCOMMONDATAMODEL_EXPORT vtkBSPCuts : public vtkDataObject
45 {
46 public:
47  static vtkBSPCuts *New();
48  vtkTypeMacro(vtkBSPCuts, vtkDataObject);
49  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
50 
68  void CreateCuts(double *bounds,
69  int ncuts, int *dim, double *coord,
70  int *lower, int *upper,
71  double *lowerDataCoord, double *upperDataCoord,
72  int *npoints);
73 
78  void CreateCuts(vtkKdNode *kd);
79 
85  vtkKdNode *GetKdNodeTree(){return this->Top;}
86 
92  vtkGetMacro(NumberOfCuts, int);
93 
98  int GetArrays(int len, int *dim, double *coord, int *lower, int *upper,
99  double *lowerDataCoord, double *upperDataCoord, int *npoints);
100 
105  int Equals(vtkBSPCuts *other, double tolerance = 0.0);
106 
107  void PrintTree();
108  void PrintArrays();
109 
111 
115  static vtkBSPCuts* GetData(vtkInformationVector* v, int i=0);
117 
121  void Initialize() VTK_OVERRIDE;
122 
124 
128  void ShallowCopy(vtkDataObject *src) VTK_OVERRIDE;
129  void DeepCopy(vtkDataObject *src) VTK_OVERRIDE;
131 
132 protected:
133 
134  vtkBSPCuts();
135  ~vtkBSPCuts() VTK_OVERRIDE;
136 
137  static void DeleteAllDescendants(vtkKdNode *kd);
138 
139  static int CountNodes(vtkKdNode *kd);
140  static void SetMinMaxId(vtkKdNode *kd);
141  static void _PrintTree(vtkKdNode *kd, int depth);
142 
143  void BuildTree(vtkKdNode *kd, int idx);
144  int WriteArray(vtkKdNode *kd, int loc);
145 
146  void ResetArrays();
147  void AllocateArrays(int size);
148 
149  vtkKdNode *Top;
150 
151  // required cut information
152 
153  int NumberOfCuts;// number of cuts, also length of each array
154  int *Dim; // dimension (x/y/z - 0/1/2) where cut occurs
155  double *Coord; // location of cut along axis
156  int *Lower; // location in arrays of left (lower) child info
157  int *Upper; // location in arrays of right (lower) child info
158 
159  // optional cut information
160 
161  double *LowerDataCoord; // coordinate of uppermost data in lower half
162  double *UpperDataCoord; // coordinate of lowermost data in upper half
163  int *Npoints; // number of data values in partition
164 
165  double Bounds[6];
166 
167  vtkBSPCuts(const vtkBSPCuts&) VTK_DELETE_FUNCTION;
168  void operator=(const vtkBSPCuts&) VTK_DELETE_FUNCTION;
169 };
170 
171 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkDataObject * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
This class represents a single spatial region in an 3D axis aligned binary spatial partitioning...
Definition: vtkKdNode.h:45
static vtkDataObject * New()
Store vtkAlgorithm input/output information.
This class represents an axis-aligned Binary Spatial Partitioning of a 3D space.
Definition: vtkBSPCuts.h:44
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
virtual void Initialize()
Restore data object to initial state,.
a simple class to control print indentation
Definition: vtkIndent.h:39
Store zero or more vtkInformation instances.
vtkKdNode * GetKdNodeTree()
Return a tree of vtkKdNode's representing the cuts specified in this object.
Definition: vtkBSPCuts.h:85
general representation of visualization data
Definition: vtkDataObject.h:64