OpenVDB  2.1.0
Interpolation.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2012-2013 DreamWorks Animation LLC
4 //
5 // All rights reserved. This software is distributed under the
6 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
7 //
8 // Redistributions of source code must retain the above copyright
9 // and license notice and the following restrictions and disclaimer.
10 //
11 // * Neither the name of DreamWorks Animation nor the names of
12 // its contributors may be used to endorse or promote products derived
13 // from this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 // IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
27 // LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
28 //
30 //
66 
67 #ifndef OPENVDB_TOOLS_INTERPOLATION_HAS_BEEN_INCLUDED
68 #define OPENVDB_TOOLS_INTERPOLATION_HAS_BEEN_INCLUDED
69 
70 #include <cmath>
71 #include <boost/shared_ptr.hpp>
72 #include <openvdb/version.h> // for OPENVDB_VERSION_NAME
73 #include <openvdb/Platform.h> // for round()
74 #include <openvdb/math/Transform.h> // for Transform
75 #include <openvdb/Grid.h>
76 #include <openvdb/tree/ValueAccessor.h>
77 
78 namespace openvdb {
80 namespace OPENVDB_VERSION_NAME {
81 namespace tools {
82 
83 // The following samplers operate in voxel space.
84 // When the samplers are applied to grids holding vector or other non-scalar data,
85 // the data is assumed to be collocated. For example, using the BoxSampler on a grid
86 // with ValueType Vec3f assumes that all three elements in a vector can be assigned
87 // the same physical location.
88 
90 {
91  static const char* name() { return "point"; }
92  static int radius() { return 0; }
93  static bool mipmap() { return false; }
94  static bool consistent() { return true; }
95 
99  template<class TreeT>
100  static bool sample(const TreeT& inTree, const Vec3R& inCoord,
101  typename TreeT::ValueType& result);
102 };
103 
104 
106 {
107  static const char* name() { return "box"; }
108  static int radius() { return 1; }
109  static bool mipmap() { return true; }
110  static bool consistent() { return true; }
111 
115  template<class TreeT>
116  static bool sample(const TreeT& inTree, const Vec3R& inCoord,
117  typename TreeT::ValueType& result);
118 
121  template<class TreeT>
122  static typename TreeT::ValueType sample(const TreeT& inTree, const Vec3R& inCoord);
123 
124 private:
125  template<class ValueT, size_t N>
126  static inline ValueT trilinearInterpolation(ValueT (& data)[N][N][N], const Vec3R& uvw);
127 };
128 
129 
131 {
132  static const char* name() { return "quadratic"; }
133  static int radius() { return 1; }
134  static bool mipmap() { return true; }
135  static bool consistent() { return false; }
136 
140  template<class TreeT>
141  static bool sample(const TreeT& inTree, const Vec3R& inCoord,
142  typename TreeT::ValueType& result);
143 };
144 
145 
147 
148 
149 // The following samplers operate in voxel space and are designed for Vec3
150 // staggered grid data (e.g., fluid simulations using the Marker-and-Cell approach
151 // associate elements of the velocity vector with different physical locations:
152 // the faces of a cube).
153 
155 {
156  static const char* name() { return "point"; }
157  static int radius() { return 0; }
158  static bool mipmap() { return false; }
159  static bool consistent() { return false; }
160 
164  template<class TreeT>
165  static bool sample(const TreeT& inTree, const Vec3R& inCoord,
166  typename TreeT::ValueType& result);
167 };
168 
169 
171 {
172  static const char* name() { return "box"; }
173  static int radius() { return 1; }
174  static bool mipmap() { return true; }
175  static bool consistent() { return false; }
176 
180  template<class TreeT>
181  static bool sample(const TreeT& inTree, const Vec3R& inCoord,
182  typename TreeT::ValueType& result);
183 };
184 
185 
187 {
188  static const char* name() { return "quadratic"; }
189  static int radius() { return 1; }
190  static bool mipmap() { return true; }
191  static bool consistent() { return false; }
192 
196  template<class TreeT>
197  static bool sample(const TreeT& inTree, const Vec3R& inCoord,
198  typename TreeT::ValueType& result);
199 };
200 
201 
203 
204 
219 template<typename GridOrTreeType, typename SamplerType>
221 {
222 public:
223  typedef boost::shared_ptr<GridSampler> Ptr;
224  typedef typename GridOrTreeType::ValueType ValueType;
228 
230  explicit GridSampler(const GridType& grid)
231  : mTree(&(grid.tree())), mTransform(&(grid.transform())) {}
232 
235  GridSampler(const TreeType& tree, const math::Transform& transform)
236  : mTree(&tree), mTransform(&transform) {}
237 
238  const math::Transform& transform() const { return *mTransform; }
239 
244  template<typename RealType>
245  ValueType sampleVoxel(const RealType& x, const RealType& y, const RealType& z) const
246  {
247  return this->isSample(Vec3d(x,y,z));
248  }
249 
254  ValueType sampleVoxel(typename Coord::ValueType i,
255  typename Coord::ValueType j,
256  typename Coord::ValueType k) const
257  {
258  return this->isSample(Coord(i,j,k));
259  }
260 
263  ValueType isSample(const Coord& ijk) const { return mTree->getValue(ijk); }
264 
267  ValueType isSample(const Vec3d& ispoint) const
268  {
269  ValueType result = zeroVal<ValueType>();
270  SamplerType::sample(*mTree, ispoint, result);
271  return result;
272  }
273 
276  ValueType wsSample(const Vec3d& wspoint) const
277  {
278  ValueType result = zeroVal<ValueType>();
279  SamplerType::sample(*mTree, mTransform->worldToIndex(wspoint), result);
280  return result;
281  }
282 
283 private:
284  const TreeType* mTree;
285  const math::Transform* mTransform;
286 }; // class GridSampler
287 
288 
301 template<typename TreeT, typename SamplerType>
302 class GridSampler<tree::ValueAccessor<TreeT>, SamplerType>
303 {
304 public:
305  typedef boost::shared_ptr<GridSampler> Ptr;
306  typedef typename TreeT::ValueType ValueType;
307  typedef TreeT TreeType;
310 
313  GridSampler(const AccessorType& acc, const math::Transform& transform)
314  : mAccessor(&acc), mTransform(&transform) {}
315 
316  const math::Transform& transform() const { return *mTransform; }
317 
322  template<typename RealType>
323  ValueType sampleVoxel(const RealType& x, const RealType& y, const RealType& z) const
324  {
325  return this->isSample(Vec3d(x,y,z));
326  }
327 
332  ValueType sampleVoxel(typename Coord::ValueType i,
333  typename Coord::ValueType j,
334  typename Coord::ValueType k) const
335  {
336  return this->isSample(Coord(i,j,k));
337  }
338 
341  ValueType isSample(const Coord& ijk) const { return mAccessor->getValue(ijk); }
342 
345  ValueType isSample(const Vec3d& ispoint) const
346  {
347  ValueType result = zeroVal<ValueType>();
348  SamplerType::sample(*mAccessor, ispoint, result);
349  return result;
350  }
351 
354  ValueType wsSample(const Vec3d& wspoint) const
355  {
356  ValueType result = zeroVal<ValueType>();
357  SamplerType::sample(*mAccessor, mTransform->worldToIndex(wspoint), result);
358  return result;
359  }
360 
361 private:
362  const AccessorType* mAccessor;//not thread-safe!
363  const math::Transform* mTransform;
364 };//Specialization of GridSampler
365 
366 
368 
369 
382 template<typename SourceGridT,
383  typename TargetGridT,
384  typename SamplerT = tools::BoxSampler>
386 {
387 public:
388  typedef typename SourceGridT::ValueType ValueType;
389  DualGridSampler(const SourceGridT& source, const TargetGridT& target)
390  : mTarget(&target), mSource(&source), mAccessor(source.tree()),
391  mAligned(target.transform() == source.transform())
392  {
393  }
396  inline ValueType operator()(const Coord& ijk) const
397  {
398  return mAligned ? mAccessor.getValue(ijk) : SamplerT::sample(mAccessor,
399  mSource->worldToIndex(mTarget->indexToWorld(ijk)));
400  }
401 private:
402  const TargetGridT* mTarget;
403  const SourceGridT* mSource;
404  typename SourceGridT::ConstAccessor mAccessor;
405  const bool mAligned;
406 };// DualGridSampler
407 
408 
410 
411 
412 namespace local_util {
413 
414 inline Vec3i
415 floorVec3(const Vec3R& v)
416 {
417  return Vec3i(int(std::floor(v(0))), int(std::floor(v(1))), int(std::floor(v(2))));
418 }
419 
420 
421 inline Vec3i
422 ceilVec3(const Vec3R& v)
423 {
424  return Vec3i(int(std::ceil(v(0))), int(std::ceil(v(1))), int(std::ceil(v(2))));
425 }
426 
427 
428 inline Vec3i
429 roundVec3(const Vec3R& v)
430 {
431  return Vec3i(int(::round(v(0))), int(::round(v(1))), int(::round(v(2))));
432 }
433 
434 } // namespace local_util
435 
436 
438 
439 
440 template<class TreeT>
441 inline bool
442 PointSampler::sample(const TreeT& inTree, const Vec3R& inCoord,
443  typename TreeT::ValueType& result)
444 {
445  Vec3i inIdx = local_util::roundVec3(inCoord);
446  return inTree.probeValue(Coord(inIdx), result);
447 }
448 
449 
451 
452 
453 template<class ValueT, size_t N>
454 inline ValueT
455 BoxSampler::trilinearInterpolation(ValueT (& data)[N][N][N], const Vec3R& uvw)
456 {
457  // Trilinear interpolation:
458  // The eight surrounding latice values are used to construct the result. \n
459  // result(x,y,z) =
460  // v000 (1-x)(1-y)(1-z) + v001 (1-x)(1-y)z + v010 (1-x)y(1-z) + v011 (1-x)yz
461  // + v100 x(1-y)(1-z) + v101 x(1-y)z + v110 xy(1-z) + v111 xyz
462 
463  ValueT resultA, resultB;
464 
465  resultA = data[0][0][0] + ValueT((data[0][0][1] - data[0][0][0]) * uvw[2]);
466  resultB = data[0][1][0] + ValueT((data[0][1][1] - data[0][1][0]) * uvw[2]);
467  ValueT result1 = resultA + ValueT((resultB-resultA) * uvw[1]);
468 
469  resultA = data[1][0][0] + ValueT((data[1][0][1] - data[1][0][0]) * uvw[2]);
470  resultB = data[1][1][0] + ValueT((data[1][1][1] - data[1][1][0]) * uvw[2]);
471  ValueT result2 = resultA + ValueT((resultB - resultA) * uvw[1]);
472 
473  return result1 + ValueT(uvw[0] * (result2 - result1));
474 }
475 
476 
477 template<class TreeT>
478 inline bool
479 BoxSampler::sample(const TreeT& inTree, const Vec3R& inCoord,
480  typename TreeT::ValueType& result)
481 {
482  typedef typename TreeT::ValueType ValueT;
483 
484  Vec3i inIdx = local_util::floorVec3(inCoord);
485  Vec3R uvw = inCoord - inIdx;
486 
487  // Retrieve the values of the eight voxels surrounding the
488  // fractional source coordinates.
489  ValueT data[2][2][2];
490 
491  bool hasActiveValues = false;
492  Coord ijk(inIdx);
493  hasActiveValues |= inTree.probeValue(ijk, data[0][0][0]); // i, j, k
494  ijk[2] += 1;
495  hasActiveValues |= inTree.probeValue(ijk, data[0][0][1]); // i, j, k + 1
496  ijk[1] += 1;
497  hasActiveValues |= inTree.probeValue(ijk, data[0][1][1]); // i, j+1, k + 1
498  ijk[2] = inIdx[2];
499  hasActiveValues |= inTree.probeValue(ijk, data[0][1][0]); // i, j+1, k
500  ijk[0] += 1;
501  ijk[1] = inIdx[1];
502  hasActiveValues |= inTree.probeValue(ijk, data[1][0][0]); // i+1, j, k
503  ijk[2] += 1;
504  hasActiveValues |= inTree.probeValue(ijk, data[1][0][1]); // i+1, j, k + 1
505  ijk[1] += 1;
506  hasActiveValues |= inTree.probeValue(ijk, data[1][1][1]); // i+1, j+1, k + 1
507  ijk[2] = inIdx[2];
508  hasActiveValues |= inTree.probeValue(ijk, data[1][1][0]); // i+1, j+1, k
509 
510  result = trilinearInterpolation(data, uvw);
511  return hasActiveValues;
512 }
513 
514 
515 template<class TreeT>
516 inline typename TreeT::ValueType
517 BoxSampler::sample(const TreeT& inTree, const Vec3R& inCoord)
518 {
519  typedef typename TreeT::ValueType ValueT;
520 
521  Vec3i inIdx = local_util::floorVec3(inCoord);
522  Vec3R uvw = inCoord - inIdx;
523 
524  // Retrieve the values of the eight voxels surrounding the
525  // fractional source coordinates.
526  ValueT data[2][2][2];
527 
528  Coord ijk(inIdx);
529  data[0][0][0] = inTree.getValue(ijk); // i, j, k
530  ijk[2] += 1;
531  data[0][0][1] = inTree.getValue(ijk); // i, j, k + 1
532  ijk[1] += 1;
533  data[0][1][1] = inTree.getValue(ijk); // i, j+1, k + 1
534  ijk[2] = inIdx[2];
535  data[0][1][0] = inTree.getValue(ijk); // i, j+1, k
536  ijk[0] += 1;
537  ijk[1] = inIdx[1];
538  data[1][0][0] = inTree.getValue(ijk); // i+1, j, k
539  ijk[2] += 1;
540  data[1][0][1] = inTree.getValue(ijk); // i+1, j, k + 1
541  ijk[1] += 1;
542  data[1][1][1] = inTree.getValue(ijk); // i+1, j+1, k + 1
543  ijk[2] = inIdx[2];
544  data[1][1][0] = inTree.getValue(ijk); // i+1, j+1, k
545 
546  return trilinearInterpolation(data, uvw);
547 }
548 
549 
551 
552 
553 template<class TreeT>
554 inline bool
555 QuadraticSampler::sample(const TreeT& inTree, const Vec3R& inCoord,
556  typename TreeT::ValueType& result)
557 {
558  typedef typename TreeT::ValueType ValueT;
559 
560  Vec3i
561  inIdx = local_util::floorVec3(inCoord),
562  inLoIdx = inIdx - Vec3i(1, 1, 1);
563  Vec3R frac = inCoord - inIdx;
564 
565  // Retrieve the values of the 27 voxels surrounding the
566  // fractional source coordinates.
567  bool active = false;
568  ValueT v[3][3][3];
569  for (int dx = 0, ix = inLoIdx.x(); dx < 3; ++dx, ++ix) {
570  for (int dy = 0, iy = inLoIdx.y(); dy < 3; ++dy, ++iy) {
571  for (int dz = 0, iz = inLoIdx.z(); dz < 3; ++dz, ++iz) {
572  if (inTree.probeValue(Coord(ix, iy, iz), v[dx][dy][dz])) {
573  active = true;
574  }
575  }
576  }
577  }
578 
580  ValueT vx[3];
581  for (int dx = 0; dx < 3; ++dx) {
582  ValueT vy[3];
583  for (int dy = 0; dy < 3; ++dy) {
584  // Fit a parabola to three contiguous samples in z
585  // (at z=-1, z=0 and z=1), then evaluate the parabola at z',
586  // where z' is the fractional part of inCoord.z, i.e.,
587  // inCoord.z - inIdx.z. The coefficients come from solving
588  //
589  // | (-1)^2 -1 1 || a | | v0 |
590  // | 0 0 1 || b | = | v1 |
591  // | 1^2 1 1 || c | | v2 |
592  //
593  // for a, b and c.
594  const ValueT* vz = &v[dx][dy][0];
595  const ValueT
596  az = static_cast<ValueT>(0.5 * (vz[0] + vz[2]) - vz[1]),
597  bz = static_cast<ValueT>(0.5 * (vz[2] - vz[0])),
598  cz = static_cast<ValueT>(vz[1]);
599  vy[dy] = static_cast<ValueT>(frac.z() * (frac.z() * az + bz) + cz);
600  }
601  // Fit a parabola to three interpolated samples in y, then
602  // evaluate the parabola at y', where y' is the fractional
603  // part of inCoord.y.
604  const ValueT
605  ay = static_cast<ValueT>(0.5 * (vy[0] + vy[2]) - vy[1]),
606  by = static_cast<ValueT>(0.5 * (vy[2] - vy[0])),
607  cy = static_cast<ValueT>(vy[1]);
608  vx[dx] = static_cast<ValueT>(frac.y() * (frac.y() * ay + by) + cy);
609  }
610  // Fit a parabola to three interpolated samples in x, then
611  // evaluate the parabola at the fractional part of inCoord.x.
612  const ValueT
613  ax = static_cast<ValueT>(0.5 * (vx[0] + vx[2]) - vx[1]),
614  bx = static_cast<ValueT>(0.5 * (vx[2] - vx[0])),
615  cx = static_cast<ValueT>(vx[1]);
616  result = static_cast<ValueT>(frac.x() * (frac.x() * ax + bx) + cx);
617 
618  return active;
619 }
620 
621 
623 
624 
625 template<class TreeT>
626 inline bool
627 StaggeredPointSampler::sample(const TreeT& inTree, const Vec3R& inCoord,
628  typename TreeT::ValueType& result)
629 {
630  typedef typename TreeT::ValueType ValueType;
631 
632  ValueType tempX, tempY, tempZ;
633  bool active = false;
634 
635  active = PointSampler::sample<TreeT>(inTree, inCoord + Vec3R(0.5, 0, 0), tempX) || active;
636  active = PointSampler::sample<TreeT>(inTree, inCoord + Vec3R(0, 0.5, 0), tempY) || active;
637  active = PointSampler::sample<TreeT>(inTree, inCoord + Vec3R(0, 0, 0.5), tempZ) || active;
638 
639  result.x() = tempX.x();
640  result.y() = tempY.y();
641  result.z() = tempZ.z();
642 
643  return active;
644 }
645 
646 
648 
649 
650 template<class TreeT>
651 inline bool
652 StaggeredBoxSampler::sample(const TreeT& inTree, const Vec3R& inCoord,
653  typename TreeT::ValueType& result)
654 {
655  typedef typename TreeT::ValueType ValueType;
656 
657  ValueType tempX, tempY, tempZ;
658  tempX = tempY = tempZ = zeroVal<ValueType>();
659  bool active = false;
660 
661  active = BoxSampler::sample<TreeT>(inTree, inCoord + Vec3R(0.5, 0, 0), tempX) || active;
662  active = BoxSampler::sample<TreeT>(inTree, inCoord + Vec3R(0, 0.5, 0), tempY) || active;
663  active = BoxSampler::sample<TreeT>(inTree, inCoord + Vec3R(0, 0, 0.5), tempZ) || active;
664 
665  result.x() = tempX.x();
666  result.y() = tempY.y();
667  result.z() = tempZ.z();
668 
669  return active;
670 }
671 
672 
674 
675 
676 template<class TreeT>
677 inline bool
678 StaggeredQuadraticSampler::sample(const TreeT& inTree, const Vec3R& inCoord,
679  typename TreeT::ValueType& result)
680 {
681  typedef typename TreeT::ValueType ValueType;
682 
683  ValueType tempX, tempY, tempZ;
684  bool active = false;
685 
686  active = QuadraticSampler::sample<TreeT>(inTree, inCoord + Vec3R(0.5, 0, 0), tempX) || active;
687  active = QuadraticSampler::sample<TreeT>(inTree, inCoord + Vec3R(0, 0.5, 0), tempY) || active;
688  active = QuadraticSampler::sample<TreeT>(inTree, inCoord + Vec3R(0, 0, 0.5), tempZ) || active;
689 
690  result.x() = tempX.x();
691  result.y() = tempY.y();
692  result.z() = tempZ.z();
693 
694  return active;
695 }
696 
697 } // namespace tools
698 } // namespace OPENVDB_VERSION_NAME
699 } // namespace openvdb
700 
701 #endif // OPENVDB_TOOLS_INTERPOLATION_HAS_BEEN_INCLUDED
702 
703 // Copyright (c) 2012-2013 DreamWorks Animation LLC
704 // All rights reserved. This software is distributed under the
705 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
static int radius()
Definition: Interpolation.h:92
static bool consistent()
Definition: Interpolation.h:191
tree::ValueAccessor< TreeT > AccessorType
Definition: Interpolation.h:309
static bool consistent()
Definition: Interpolation.h:94
math::Vec3< Real > Vec3R
Definition: Types.h:74
TreeAdapter< GridOrTreeType >::TreeType TreeType
Definition: Interpolation.h:226
static bool consistent()
Definition: Interpolation.h:135
static bool consistent()
Definition: Interpolation.h:159
Vec3i roundVec3(const Vec3R &v)
Definition: Interpolation.h:429
static int radius()
Definition: Interpolation.h:157
ValueType isSample(const Vec3d &ispoint) const
Sample in fractional index space.
Definition: Interpolation.h:345
Definition: Interpolation.h:170
Calculate an axis-aligned bounding box in index space from a bounding sphere in world space...
Definition: Transform.h:65
T & y()
Definition: Vec3.h:95
SourceGridT::ValueType ValueType
Definition: Interpolation.h:388
ValueType sampleVoxel(const RealType &x, const RealType &y, const RealType &z) const
Sample a point in index space in the grid.
Definition: Interpolation.h:323
ValueType wsSample(const Vec3d &wspoint) const
Sample in world space.
Definition: Interpolation.h:354
static const char * name()
Definition: Interpolation.h:91
Vec3< int32_t > Vec3i
Definition: Vec3.h:602
Container class that associates a tree with a transform and metadata.
Definition: Grid.h:54
const math::Transform & transform() const
Definition: Interpolation.h:238
ValueType isSample(const Coord &ijk) const
Sample value in integer index space.
Definition: Interpolation.h:341
ValueType wsSample(const Vec3d &wspoint) const
Sample in world space.
Definition: Interpolation.h:276
static int radius()
Definition: Interpolation.h:108
Vec3i floorVec3(const Vec3R &v)
Definition: Interpolation.h:415
static const char * name()
Definition: Interpolation.h:188
GridOrTreeType::ValueType ValueType
Definition: Interpolation.h:224
Class that provides the interface for continuous sampling of values in a tree. Consider using the Gri...
Definition: Interpolation.h:220
static const char * name()
Definition: Interpolation.h:172
DualGridSampler(const SourceGridT &source, const TargetGridT &target)
Definition: Interpolation.h:389
#define OPENVDB_VERSION_NAME
Definition: version.h:45
ValueType sampleVoxel(typename Coord::ValueType i, typename Coord::ValueType j, typename Coord::ValueType k) const
Sample value in integer index space.
Definition: Interpolation.h:254
static bool consistent()
Definition: Interpolation.h:175
static int radius()
Definition: Interpolation.h:133
ValueType isSample(const Vec3d &ispoint) const
Sample in fractional index space.
Definition: Interpolation.h:267
static const char * name()
Definition: Interpolation.h:132
This is a simple convenience class that allows for sampling from a source grid into the index space o...
Definition: Interpolation.h:385
Definition: Interpolation.h:130
static bool mipmap()
Definition: Interpolation.h:174
Definition: Interpolation.h:154
Definition: Interpolation.h:105
static bool mipmap()
Definition: Interpolation.h:190
ValueType sampleVoxel(const RealType &x, const RealType &y, const RealType &z) const
Sample a point in index space in the grid.
Definition: Interpolation.h:245
T & z()
Definition: Vec3.h:96
GridSampler(const AccessorType &acc, const math::Transform &transform)
Definition: Interpolation.h:313
Vec3< double > Vec3d
Definition: Vec3.h:605
ValueType isSample(const Coord &ijk) const
Sample value in integer index space.
Definition: Interpolation.h:263
GridSampler(const GridType &grid)
Definition: Interpolation.h:230
TreeAdapter< GridOrTreeType >::GridType GridType
Definition: Interpolation.h:225
static bool consistent()
Definition: Interpolation.h:110
static const char * name()
Definition: Interpolation.h:107
static bool mipmap()
Definition: Interpolation.h:93
static int radius()
Definition: Interpolation.h:189
static const char * name()
Definition: Interpolation.h:156
static bool mipmap()
Definition: Interpolation.h:134
static bool mipmap()
Definition: Interpolation.h:158
_TreeType TreeType
Definition: Grid.h:825
boost::shared_ptr< GridSampler > Ptr
Definition: Interpolation.h:223
Vec3i ceilVec3(const Vec3R &v)
Definition: Interpolation.h:422
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:67
T & x()
Reference to the component, e.g. v.x() = 4.5f;.
Definition: Vec3.h:94
ValueType operator()(const Coord &ijk) const
Return the value of the source grid at the index coordinates, ijk, relative to the target grid...
Definition: Interpolation.h:396
Definition: Interpolation.h:89
const math::Transform & transform() const
Definition: Interpolation.h:316
TreeAdapter< GridOrTreeType >::AccessorType AccessorType
Definition: Interpolation.h:227
GridSampler(const TreeType &tree, const math::Transform &transform)
Definition: Interpolation.h:235
ValueType sampleVoxel(typename Coord::ValueType i, typename Coord::ValueType j, typename Coord::ValueType k) const
Sample value in integer index space.
Definition: Interpolation.h:332
boost::shared_ptr< GridSampler > Ptr
Definition: Interpolation.h:305
static bool mipmap()
Definition: Interpolation.h:109
static int radius()
Definition: Interpolation.h:173