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) 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() override;
122 
124 
128  void ShallowCopy(vtkDataObject *src) override;
129  void DeepCopy(vtkDataObject *src) override;
131 
132 protected:
133 
134  vtkBSPCuts();
135  ~vtkBSPCuts() 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 
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&) = delete;
168  void operator=(const vtkBSPCuts&) = delete;
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()
int NumberOfCuts
Definition: vtkBSPCuts.h:153
Store vtkAlgorithm input/output information.
int * Dim
Definition: vtkBSPCuts.h:154
This class represents an axis-aligned Binary Spatial Partitioning of a 3D space.
Definition: vtkBSPCuts.h:44
double * LowerDataCoord
Definition: vtkBSPCuts.h:161
double * UpperDataCoord
Definition: vtkBSPCuts.h:162
virtual void Initialize()
Restore data object to initial state,.
double * Coord
Definition: vtkBSPCuts.h:155
int * Npoints
Definition: vtkBSPCuts.h:163
a simple class to control print indentation
Definition: vtkIndent.h:39
int * Lower
Definition: vtkBSPCuts.h:156
Store zero or more vtkInformation instances.
int * Upper
Definition: vtkBSPCuts.h:157
vtkKdNode * Top
Definition: vtkBSPCuts.h:149
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
virtual void DeepCopy(vtkDataObject *src)
Shallow and Deep copy.
virtual void ShallowCopy(vtkDataObject *src)
Shallow and Deep copy.