VTK  9.0.20210119
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, int ncuts, int* dim, double* coord, int* lower, int* upper,
69  double* lowerDataCoord, double* upperDataCoord, int* npoints);
70 
75  void CreateCuts(vtkKdNode* kd);
76 
82  vtkKdNode* GetKdNodeTree() { return this->Top; }
83 
89  vtkGetMacro(NumberOfCuts, int);
90 
95  int GetArrays(int len, int* dim, double* coord, int* lower, int* upper, double* lowerDataCoord,
96  double* upperDataCoord, int* npoints);
97 
102  int Equals(vtkBSPCuts* other, double tolerance = 0.0);
103 
104  void PrintTree();
105  void PrintArrays();
106 
108 
112  static vtkBSPCuts* GetData(vtkInformationVector* v, int i = 0);
114 
118  void Initialize() override;
119 
121 
125  void ShallowCopy(vtkDataObject* src) override;
126  void DeepCopy(vtkDataObject* src) override;
128 
129 protected:
130  vtkBSPCuts();
131  ~vtkBSPCuts() override;
132 
133  static void DeleteAllDescendants(vtkKdNode* kd);
134 
135  static int CountNodes(vtkKdNode* kd);
136  static void SetMinMaxId(vtkKdNode* kd);
137  static void _PrintTree(vtkKdNode* kd, int depth);
138 
139  void BuildTree(vtkKdNode* kd, int idx);
140  int WriteArray(vtkKdNode* kd, int loc);
141 
142  void ResetArrays();
143  void AllocateArrays(int size);
144 
146 
147  // required cut information
148 
149  int NumberOfCuts; // number of cuts, also length of each array
150  int* Dim; // dimension (x/y/z - 0/1/2) where cut occurs
151  double* Coord; // location of cut along axis
152  int* Lower; // location in arrays of left (lower) child info
153  int* Upper; // location in arrays of right (lower) child info
154 
155  // optional cut information
156 
157  double* LowerDataCoord; // coordinate of uppermost data in lower half
158  double* UpperDataCoord; // coordinate of lowermost data in upper half
159  int* Npoints; // number of data values in partition
160 
161  double Bounds[6];
162 
163  vtkBSPCuts(const vtkBSPCuts&) = delete;
164  void operator=(const vtkBSPCuts&) = delete;
165 };
166 
167 #endif
vtkKdNode
This class represents a single spatial region in an 3D axis aligned binary spatial partitioning....
Definition: vtkKdNode.h:42
vtkDataObject::Initialize
virtual void Initialize()
Restore data object to initial state,.
vtkDataObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkBSPCuts::Upper
int * Upper
Definition: vtkBSPCuts.h:153
vtkDataObject::DeepCopy
virtual void DeepCopy(vtkDataObject *src)
vtkBSPCuts::GetKdNodeTree
vtkKdNode * GetKdNodeTree()
Return a tree of vtkKdNode's representing the cuts specified in this object.
Definition: vtkBSPCuts.h:82
vtkBSPCuts::Lower
int * Lower
Definition: vtkBSPCuts.h:152
vtkBSPCuts::Top
vtkKdNode * Top
Definition: vtkBSPCuts.h:145
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkBSPCuts
This class represents an axis-aligned Binary Spatial Partitioning of a 3D space.
Definition: vtkBSPCuts.h:44
vtkBSPCuts::NumberOfCuts
int NumberOfCuts
Definition: vtkBSPCuts.h:149
vtkX3D::size
Definition: vtkX3D.h:259
vtkBSPCuts::Dim
int * Dim
Definition: vtkBSPCuts.h:150
vtkBSPCuts::LowerDataCoord
double * LowerDataCoord
Definition: vtkBSPCuts.h:157
vtkBSPCuts::UpperDataCoord
double * UpperDataCoord
Definition: vtkBSPCuts.h:158
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkX3D::info
Definition: vtkX3D.h:382
vtkDataObject.h
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:59
vtkDataObject::ShallowCopy
virtual void ShallowCopy(vtkDataObject *src)
Shallow and Deep copy.
vtkBSPCuts::Npoints
int * Npoints
Definition: vtkBSPCuts.h:159
vtkBSPCuts::Coord
double * Coord
Definition: vtkBSPCuts.h:151
vtkDataObject::GetData
static vtkDataObject * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
vtkDataObject::New
static vtkDataObject * New()