/usr/include/vtk-5.10/vtkCellTreeLocator.h is in libvtk5-dev 5.10.1+dfsg-2.1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkCellLocator.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkCellTreeLocator - This class implements the data structures, construction
// algorithms for fast cell location presented in "Fast, Memory-Efficient Cell
// location in Unstructured Grids for Visualization" by Christop Garth and Kenneth
// I. Joy in VisWeek, 2011.
// .SECTION Description
// Cell Tree is a bounding interval hierarchy based data structure, where child boxes
// do not form an exact split of the parent boxes along a dimension. Therefore two axis-
// aligned bounding planes (left max and right min) are stored for each node along a
// dimension. This class implements the data structure (Cell Tree Node) and its build
// and traversal algorithms described in the paper.
// Some methods in building and traversing the cell tree in this class were derived
// avtCellLocatorBIH class in the VisIT Visualization Tool
// .SECTION Caveats
//
// .SECTION See Also
// vtkLocator vtkCellLocator vtkModifiedBSPTree
#ifndef __vtkCellTreeLocator_h
#define __vtkCellTreeLocator_h
#include "vtkAbstractCellLocator.h"
#include <vector> // Needed for internal class
class vtkCellPointTraversal;
class vtkIdTypeArray;
class vtkCellArray;
class VTK_FILTERING_EXPORT vtkCellTreeLocator : public vtkAbstractCellLocator
{
public:
class vtkCellTree;
class vtkCellTreeNode;
vtkTypeMacro(vtkCellTreeLocator,vtkAbstractCellLocator);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Constructor sets the maximum number of cells in a leaf to 8
// and number of buckets to 5. Buckets are used in building the cell tree as described in the paper
static vtkCellTreeLocator *New();
// Description:
// Test a point to find if it is inside a cell. Returns the cellId if inside
// or -1 if not.
virtual vtkIdType FindCell(double pos[3], double vtkNotUsed, vtkGenericCell *cell, double pcoords[3],
double* weights );
// Description:
// Return intersection point (if any) AND the cell which was intersected by
// the finite line. The cell is returned as a cell id and as a generic cell.
virtual int IntersectWithLine(double a0[3], double a1[3], double tol,
double& t, double x[3], double pcoords[3],
int &subId, vtkIdType &cellId,
vtkGenericCell *cell);
// Description:
// Return a list of unique cell ids inside of a given bounding box. The
// user must provide the vtkIdList to populate. This method returns data
// only after the locator has been built.
virtual void FindCellsWithinBounds(double *bbox, vtkIdList *cells);
//BTX
/*
if the borland compiler is ever removed, we can use these declarations
instead of reimplementaing the calls in this subclass
using vtkAbstractCellLocator::IntersectWithLine;
using vtkAbstractCellLocator::FindClosestPoint;
using vtkAbstractCellLocator::FindClosestPointWithinRadius;
*/
//ETX
// Description:
// reimplemented from vtkAbstractCellLocator to support bad compilers
virtual int IntersectWithLine(
double p1[3], double p2[3], double tol, double& t, double x[3],
double pcoords[3], int &subId)
{
return this->Superclass::IntersectWithLine(p1, p2, tol, t, x, pcoords, subId);
}
// Description:
// Return intersection point (if any) AND the cell which was intersected by
// the finite line. The cell is returned as a cell id and as a generic cell.
// This function is a modification from the vtkModifiedBSPTree class using the
// data structures in the paper to find intersections.
virtual int IntersectWithLine(
double p1[3], double p2[3], double tol, double &t, double x[3],
double pcoords[3], int &subId, vtkIdType &cellId);
// Description:
// reimplemented from vtkAbstractCellLocator to support bad compilers
virtual int IntersectWithLine(
const double p1[3], const double p2[3],
vtkPoints *points, vtkIdList *cellIds)
{
return this->Superclass::IntersectWithLine(p1, p2, points, cellIds);
}
// Description:
// reimplemented from vtkAbstractCellLocator to support bad compilers
virtual vtkIdType FindCell(double x[3])
{ return this->Superclass::FindCell(x); }
// Description:
// Satisfy vtkLocator abstract interface.
virtual void FreeSearchStructure();
virtual void GenerateRepresentation(int level, vtkPolyData *pd);
virtual void BuildLocatorInternal();
virtual void BuildLocatorIfNeeded();
virtual void ForceBuildLocator();
virtual void BuildLocator();
//BTX
// Description:
// Internal classes made public to allow subclasses to create
// customized some traversal algorithms
class VTK_FILTERING_EXPORT vtkCellTree
{
public:
std::vector<vtkCellTreeNode> Nodes;
std::vector<unsigned int> Leaves;
friend class vtkCellPointTraversal;
friend class vtkCellTreeNode;
friend class vtkCellTreeBuilder;
public:
float DataBBox[6]; // This store the bounding values of the dataset
};
// Description:
// This class is the basic building block of the cell tree.
// Nodes consist of two split planes, LeftMax and RightMin,
// one which holds all cells assigned to the left, one for the right.
// The planes may overlap in the box, but cells are only assigned
// to one side, so some searches must traverse both leaves until they have eliminated
// candidates.
// start is the location in the cell tree. e.g. for root node start is zero.
// size is the number of the nodes under the (sub-)tree
class VTK_FILTERING_EXPORT vtkCellTreeNode
{
public:
protected:
unsigned int Index;
float LeftMax; // left max value
float RightMin; // right min value
unsigned int Sz; // size
unsigned int St; // start
friend class vtkCellTree;
friend class vtkCellPointTraversal;
friend class vtkCellTreeBuilder;
public:
void MakeNode( unsigned int left, unsigned int d, float b[2] );
void SetChildren( unsigned int left );
bool IsNode() const;
unsigned int GetLeftChildIndex() const;
unsigned int GetRightChildIndex() const;
unsigned int GetDimension() const;
const float& GetLeftMaxValue() const;
const float& GetRightMinValue() const;
void MakeLeaf( unsigned int start, unsigned int size );
bool IsLeaf() const;
unsigned int Start() const;
unsigned int Size() const;
};
//ETX
protected:
vtkCellTreeLocator();
~vtkCellTreeLocator();
// Test ray against node BBox : clip t values to extremes
bool RayMinMaxT(const double origin[3],
const double dir[3],
double &rTmin,
double &rTmax);
bool RayMinMaxT(const double bounds[6],
const double origin[3],
const double dir[3],
double &rTmin,
double &rTmax);
int getDominantAxis(const double dir[3]);
// Order nodes as near/far relative to ray
void Classify(const double origin[3],
const double dir[3],
double &rDist,
vtkCellTreeNode *&near, vtkCellTreeNode *&mid,
vtkCellTreeNode *&far, int &mustCheck);
// From vtkModifiedBSPTRee
// We provide a function which does the cell/ray test so that
// it can be overriden by subclasses to perform special treatment
// (Example : Particles stored in tree, have no dimension, so we must
// override the cell test to return a value based on some particle size
virtual int IntersectCellInternal( vtkIdType cell_ID, const double p1[3],
const double p2[3],
const double tol,
double &t,
double ipt[3],
double pcoords[3],
int &subId);
int NumberOfBuckets;
vtkCellTree* Tree;
friend class vtkCellPointTraversal;
friend class vtkCellTreeNode;
friend class vtkCellTreeBuilder;
private:
vtkCellTreeLocator(const vtkCellTreeLocator&); // Not implemented.
void operator=(const vtkCellTreeLocator&); // Not implemented.
};
#endif
|