VTK
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
dox
Filters
General
vtkCellTreeLocator.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Visualization Toolkit
4
Module: vtkCellLocator.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
=========================================================================*/
39
#ifndef __vtkCellTreeLocator_h
40
#define __vtkCellTreeLocator_h
41
42
#include "vtkFiltersGeneralModule.h"
// For export macro
43
#include "
vtkAbstractCellLocator.h
"
44
#include <vector>
// Needed for internal class
45
46
class
vtkCellPointTraversal;
47
class
vtkIdTypeArray
;
48
class
vtkCellArray
;
49
50
class
VTKFILTERSGENERAL_EXPORT
vtkCellTreeLocator
:
public
vtkAbstractCellLocator
51
{
52
public
:
53
class
vtkCellTree
;
54
class
vtkCellTreeNode
;
55
56
vtkTypeMacro(
vtkCellTreeLocator
,
vtkAbstractCellLocator
);
57
void
PrintSelf
(ostream& os,
vtkIndent
indent);
58
62
static
vtkCellTreeLocator
*
New
();
63
65
67
virtual
vtkIdType
FindCell
(
double
pos[3],
double
vtkNotUsed,
vtkGenericCell
*cell,
double
pcoords[3],
68
double
* weights );
70
72
75
virtual
int
IntersectWithLine
(
double
a0[3],
double
a1[3],
double
tol,
76
double
& t,
double
x[3],
double
pcoords[3],
77
int
&subId,
vtkIdType
&cellId,
78
vtkGenericCell
*cell);
80
84
virtual
void
FindCellsWithinBounds
(
double
*bbox,
vtkIdList
*cells);
85
86
//BTX
87
/*
88
if the borland compiler is ever removed, we can use these declarations
89
instead of reimplementaing the calls in this subclass
90
using vtkAbstractCellLocator::IntersectWithLine;
91
using vtkAbstractCellLocator::FindClosestPoint;
92
using vtkAbstractCellLocator::FindClosestPointWithinRadius;
93
*/
94
//ETX
96
97
virtual
int
IntersectWithLine
(
98
double
p1[3],
double
p2[3],
double
tol,
double
& t,
double
x[3],
99
double
pcoords[3],
int
&subId)
100
{
101
return
this->Superclass::IntersectWithLine(p1, p2, tol, t, x, pcoords, subId);
102
}
104
106
111
virtual
int
IntersectWithLine
(
112
double
p1[3],
double
p2[3],
double
tol,
double
&t,
double
x[3],
113
double
pcoords[3],
int
&subId,
vtkIdType
&cellId);
115
117
118
virtual
int
IntersectWithLine
(
119
const
double
p1[3],
const
double
p2[3],
120
vtkPoints
*
points
,
vtkIdList
*cellIds)
121
{
122
return
this->Superclass::IntersectWithLine(p1, p2, points, cellIds);
123
}
125
127
128
virtual
vtkIdType
FindCell
(
double
x[3])
129
{
return
this->Superclass::FindCell(x); }
131
133
134
virtual
void
FreeSearchStructure
();
135
virtual
void
GenerateRepresentation
(
int
level
,
vtkPolyData
*pd);
136
virtual
void
BuildLocatorInternal();
137
virtual
void
BuildLocatorIfNeeded();
138
virtual
void
ForceBuildLocator();
139
virtual
void
BuildLocator
();
141
142
143
//BTX
145
147
class
VTKFILTERSGENERAL_EXPORT
vtkCellTree
148
{
149
public
:
150
std::vector<vtkCellTreeNode>
Nodes
;
151
std::vector<unsigned int>
Leaves
;
152
friend
class
vtkCellPointTraversal;
153
friend
class
vtkCellTreeNode
;
154
friend
class
vtkCellTreeBuilder;
156
157
public
:
158
float
DataBBox[6];
// This store the bounding values of the dataset
159
};
160
162
170
class
VTKFILTERSGENERAL_EXPORT
vtkCellTreeNode
171
{
172
public
:
174
175
protected
:
176
unsigned
int
Index
;
177
float
LeftMax
;
// left max value
178
float
RightMin
;
// right min value
179
180
unsigned
int
Sz
;
// size
181
unsigned
int
St
;
// start
182
183
friend
class
vtkCellTree
;
184
friend
class
vtkCellPointTraversal;
185
friend
class
vtkCellTreeBuilder;
186
187
public
:
188
void
MakeNode(
unsigned
int
left,
unsigned
int
d,
float
b[2] );
189
void
SetChildren(
unsigned
int
left );
190
bool
IsNode()
const
;
191
unsigned
int
GetLeftChildIndex()
const
;
192
unsigned
int
GetRightChildIndex()
const
;
193
unsigned
int
GetDimension()
const
;
194
const
float
& GetLeftMaxValue()
const
;
195
const
float
& GetRightMinValue()
const
;
196
void
MakeLeaf(
unsigned
int
start,
unsigned
int
size
);
197
bool
IsLeaf()
const
;
198
unsigned
int
Start()
const
;
199
unsigned
int
Size()
const
;
200
};
201
//ETX
202
203
protected
:
204
vtkCellTreeLocator
();
205
~
vtkCellTreeLocator
();
206
207
// Test ray against node BBox : clip t values to extremes
208
bool
RayMinMaxT(
const
double
origin[3],
209
const
double
dir
[3],
210
double
&rTmin,
211
double
&rTmax);
212
213
bool
RayMinMaxT(
const
double
bounds[6],
214
const
double
origin[3],
215
const
double
dir
[3],
216
double
&rTmin,
217
double
&rTmax);
218
219
int
getDominantAxis(
const
double
dir
[3]);
220
221
// Order nodes as near/far relative to ray
222
void
Classify(
const
double
origin[3],
223
const
double
dir
[3],
224
double
&rDist,
225
vtkCellTreeNode
*&near,
vtkCellTreeNode
*&mid,
226
vtkCellTreeNode
*&far,
int
&mustCheck);
227
228
// From vtkModifiedBSPTRee
229
// We provide a function which does the cell/ray test so that
230
// it can be overriden by subclasses to perform special treatment
231
// (Example : Particles stored in tree, have no dimension, so we must
232
// override the cell test to return a value based on some particle size
233
virtual
int
IntersectCellInternal(
vtkIdType
cell_ID,
const
double
p1[3],
234
const
double
p2[3],
235
const
double
tol,
236
double
&t,
237
double
ipt[3],
238
double
pcoords[3],
239
int
&subId);
240
241
242
int
NumberOfBuckets
;
243
244
vtkCellTree
*
Tree
;
245
246
friend
class
vtkCellPointTraversal;
247
friend
class
vtkCellTreeNode
;
248
friend
class
vtkCellTreeBuilder;
249
250
private
:
251
vtkCellTreeLocator
(
const
vtkCellTreeLocator
&);
// Not implemented.
252
void
operator=(
const
vtkCellTreeLocator
&);
// Not implemented.
253
};
254
255
#endif
Generated on Thu May 24 2012 22:22:15 for VTK by
1.8.1