31 #ifndef CORE_DATATYPES_SEARCHGRIDT_H
32 #define CORE_DATATYPES_SEARCHGRIDT_H 1
53 typedef typename std::vector<INDEX>::iterator
iterator;
57 ni_(x), nj_(y), nk_(z)
71 {
return transform_; }
74 { transform_ = trans;
return transform_; }
87 const double rx = floor(r.
x());
88 const double ry = floor(r.
y());
89 const double rz = floor(r.
z());
92 if (rx < 0.0 || ry < 0.0 || rz < 0.0 ||
93 rx >= ni_ || ry >= nj_ || rz >= nk_ )
110 double rx = floor(r.
x());
111 double ry = floor(r.
y());
112 double rz = floor(r.
z());
115 if (rx < 0.0) rx = 0.0;
116 if (ry < 0.0) ry = 0.0;
117 if (rz < 0.0) rz = 0.0;
119 if (rx >= ni_) rx = ni_;
120 if (ry >= nj_) ry = nj_;
121 if (rz >= nk_) rz = nk_;
142 index_type mini=0, minj=0, mink=0, maxi=0, maxj=0, maxk=0;
153 bin_[linearize(i, j, k)].push_back(val);
161 index_type mini, minj, mink, maxi, maxj, maxk;
173 std::remove(bin_[q].begin(),bin_[q].end(),val);
183 bin_[linearize(i, j, k)].push_back(val);
191 std::remove(bin_[q].begin(),bin_[q].end(),val);
200 begin = bin_[q].begin();
211 begin = bin_[q].begin();
223 if (r.
x() < i) { r.
x(i); }
224 else if (r.
x() > i+1) { r.
x(i+1); }
226 if (r.
y() < j) { r.
y(j); }
227 else if (r.
y() > j+1) { r.
y(j+1); }
229 if (r.
z() < k) { r.
z(k); }
230 else if (r.
z() > k+1) { r.
z(k+1); }
242 {
return (((i * nj_) + j) * nk_ + k); }
249 Core::Geometry::Transform transform_;
252 std::vector<std::vector<INDEX> > bin_;
void insert(INDEX val, const Core::Geometry::BBox &bbox)
Definition: SearchGridT.h:140
Core::Geometry::Transform & set_transform(const Core::Geometry::Transform &trans)
Definition: SearchGridT.h:73
size_type get_nj() const
Definition: SearchGridT.h:79
Point max() const
Definition: BBox.h:195
void transform(const Core::Geometry::Transform &t)
Definition: SearchGridT.h:67
void y(const double)
Definition: Point.h:135
void lookup_ijk(iterator &begin, iterator &end, size_type i, size_type j, size_type k)
Definition: SearchGridT.h:207
const Core::Geometry::Transform & get_transform() const
Definition: SearchGridT.h:70
SCIRun::index_type index_type
Include the types defined in Types into this class.
Definition: SearchGridT.h:51
void z(const double)
Definition: Point.h:145
double length2() const
Definition: Vector.h:248
Definition: ParallelLinearAlgebraTests.cc:358
Definition: SearchGridT.h:47
double min_distance_squared(const Core::Geometry::Point &p, size_type i, size_type j, size_type k) const
Definition: SearchGridT.h:216
void x(const double)
Definition: Point.h:125
SearchGridT(size_type x, size_type y, size_type z, const Core::Geometry::Point &min, const Core::Geometry::Point &max)
Definition: SearchGridT.h:55
long long size_type
Definition: Types.h:40
bool lookup(iterator &begin, iterator &end, const Core::Geometry::Point &p)
Definition: SearchGridT.h:194
void unsafe_locate(index_type &i, index_type &j, index_type &k, const Core::Geometry::Point &p) const
Definition: SearchGridT.h:129
std::vector< INDEX >::iterator iterator
Definition: SearchGridT.h:53
Point min() const
Definition: BBox.h:192
SCIRun::size_type size_type
Definition: SearchGridT.h:52
void insert(INDEX val, const Core::Geometry::Point &point)
Definition: SearchGridT.h:179
long long index_type
Definition: Types.h:39
bool locate_clamp(index_type &i, index_type &j, index_type &k, const Core::Geometry::Point &p) const
Definition: SearchGridT.h:105
bool locate(index_type &i, index_type &j, index_type &k, const Core::Geometry::Point &p) const
Definition: SearchGridT.h:82
size_type get_ni() const
Get the size of the search grid.
Definition: SearchGridT.h:78
size_type get_nk() const
Definition: SearchGridT.h:80