21 #ifndef NANOVDB_SAMPLE_FROM_VOXELS_H_HAS_BEEN_INCLUDED 22 #define NANOVDB_SAMPLE_FROM_VOXELS_H_HAS_BEEN_INCLUDED 25 #if defined(__CUDACC__) || defined(__HIP__) 26 #define __hostdev__ __host__ __device__ 35 template<
typename TreeT,
int Order,
bool UseCache = true>
45 template<
int Order,
typename TreeOrAccT,
bool UseCache = true>
53 template<
typename CoordT,
typename RealT,
template<
typename>
class Vec3T>
57 template<
typename CoordT,
template<
typename>
class Vec3T>
60 const float ijk[3] = {floorf(xyz[0]), floorf(xyz[1]), floorf(xyz[2])};
64 return CoordT(int32_t(ijk[0]), int32_t(ijk[1]), int32_t(ijk[2]));
68 template<
typename CoordT,
template<
typename>
class Vec3T>
71 const double ijk[3] = {floor(xyz[0]), floor(xyz[1]), floor(xyz[2])};
75 return CoordT(int32_t(ijk[0]), int32_t(ijk[1]), int32_t(ijk[2]));
81 template<
typename TreeOrAccT>
85 using ValueT =
typename TreeOrAccT::ValueType;
86 using CoordT =
typename TreeOrAccT::CoordType;
88 static const int ORDER = 0;
99 template<
typename Vec3T>
105 const TreeOrAccT& mAcc;
111 template<
typename TreeOrAccT>
115 using ValueT =
typename TreeOrAccT::ValueType;
116 using CoordT =
typename TreeOrAccT::CoordType;
117 static const int ORDER = 0;
128 template<
typename Vec3T>
134 const TreeOrAccT& mAcc;
137 template<
typename TreeOrAccT>
138 template<
typename Vec3T>
141 const CoordT ijk = Round<CoordT>(xyz);
144 mVal = mAcc.getValue(mPos);
149 template<
typename TreeOrAccT>
154 mVal = mAcc.getValue(mPos);
159 template<
typename TreeOrAccT>
160 template<
typename Vec3T>
163 return mAcc.getValue(Round<CoordT>(xyz));
169 template<
typename TreeOrAccT>
176 using ValueT =
typename TreeOrAccT::ValueType;
177 using CoordT =
typename TreeOrAccT::CoordType;
178 static const int ORDER = 1;
188 template<
typename RealT,
template<
typename...>
class Vec3T>
191 template<
typename RealT,
template<
typename...>
class Vec3T>
197 template<
typename TreeOrAccT>
200 v[0][0][0] = mAcc.getValue(ijk);
203 v[0][0][1] = mAcc.getValue(ijk);
206 v[0][1][1] = mAcc.getValue(ijk);
209 v[0][1][0] = mAcc.getValue(ijk);
213 v[1][0][0] = mAcc.getValue(ijk);
216 v[1][0][1] = mAcc.getValue(ijk);
219 v[1][1][1] = mAcc.getValue(ijk);
222 v[1][1][0] = mAcc.getValue(ijk);
225 template<
typename TreeOrAccT>
226 template<
typename RealT,
template<
typename...>
class Vec3T>
235 return lerp(lerp(lerp(v[0][0][0], v[0][0][1], uvw[2]), lerp(v[0][1][0], v[0][1][1], uvw[2]), uvw[1]),
236 lerp(lerp(v[1][0][0], v[1][0][1], uvw[2]), lerp(v[1][1][0], v[1][1][1], uvw[2]), uvw[1]),
240 template<
typename TreeOrAccT>
241 template<
typename RealT,
template<
typename...>
class Vec3T>
252 ValueT D[4] = {v[0][0][1] - v[0][0][0], v[0][1][1] - v[0][1][0], v[1][0][1] - v[1][0][0], v[1][1][1] - v[1][1][0]};
255 Vec3T<ValueT> grad(0, 0, lerp(lerp(D[0], D[1], uvw[1]), lerp(D[2], D[3], uvw[1]), uvw[0]));
258 D[0] = v[0][0][0] + D[0] * w;
259 D[1] = v[0][1][0] + D[1] * w;
260 D[2] = v[1][0][0] + D[2] * w;
261 D[3] = v[1][1][0] + D[3] * w;
264 grad[0] = lerp(D[2], D[3], uvw[1]) - lerp(D[0], D[1], uvw[1]);
267 grad[1] = lerp(D[1] - D[0], D[3] - D[2], uvw[0]);
272 template<
typename TreeOrAccT>
276 const bool less = v[0][0][0] <
ValueT(0);
277 return (less ^ (v[0][0][1] < ValueT(0))) ||
278 (less ^ (v[0][1][1] < ValueT(0))) ||
279 (less ^ (v[0][1][0] < ValueT(0))) ||
280 (less ^ (v[1][0][0] < ValueT(0))) ||
281 (less ^ (v[1][0][1] < ValueT(0))) ||
282 (less ^ (v[1][1][1] < ValueT(0))) ||
283 (less ^ (v[1][1][0] < ValueT(0)));
287 template<
typename TreeOrAccT>
291 using ValueT =
typename TreeOrAccT::ValueType;
292 using CoordT =
typename TreeOrAccT::CoordType;
300 template<
typename RealT,
template<
typename...>
class Vec3T>
309 template<
typename RealT,
template<
typename...>
class Vec3T>
315 template<
typename RealT,
template<
typename...>
class Vec3T>
316 inline __hostdev__ bool zeroCrossing(Vec3T<RealT> xyz)
const;
321 template<
typename TreeOrAccT>
325 using ValueT =
typename TreeOrAccT::ValueType;
326 using CoordT =
typename TreeOrAccT::CoordType;
329 mutable ValueT mVal[2][2][2];
331 template<
typename RealT,
template<
typename...>
class Vec3T>
339 template<
typename RealT,
template<
typename...>
class Vec3T>
348 template<
typename RealT,
template<
typename...>
class Vec3T>
354 template<
typename RealT,
template<
typename...>
class Vec3T>
355 inline __hostdev__ bool zeroCrossing(Vec3T<RealT> xyz)
const;
364 template<
typename TreeOrAccT>
365 template<
typename RealT,
template<
typename...>
class Vec3T>
369 return BaseT::sample(xyz, mVal);
372 template<
typename TreeOrAccT>
375 return ijk == mPos ? mVal[0][0][0] : BaseT::mAcc.getValue(ijk);
378 template<
typename TreeOrAccT>
379 template<
typename RealT,
template<
typename...>
class Vec3T>
386 template<
typename TreeOrAccT>
387 template<
typename RealT,
template<
typename...>
class Vec3T>
391 return BaseT::zeroCrossing(mVal);
394 template<
typename TreeOrAccT>
395 template<
typename RealT,
template<
typename...>
class Vec3T>
398 CoordT ijk = Floor<CoordT>(xyz);
401 BaseT::stencil(ijk, mVal);
407 template<
typename TreeOrAccT>
408 template<
typename RealT,
template<
typename...>
class Vec3T>
412 CoordT ijk = Floor<CoordT>(xyz);
413 BaseT::stencil(ijk, val);
414 return BaseT::sample(xyz, val);
419 template<
typename TreeOrAccT>
420 template<
typename RealT,
template<
typename...>
class Vec3T>
425 CoordT coord = Floor<CoordT>(xyz);
427 ValueT vx, vx1, vy, vy1, vz, vz1;
429 vz = BaseT::mAcc.getValue(coord);
431 vz1 = BaseT::mAcc.getValue(coord);
432 vy = lerp(vz, vz1, xyz[2]);
436 vz1 = BaseT::mAcc.getValue(coord);
438 vz = BaseT::mAcc.getValue(coord);
439 vy1 = lerp(vz, vz1, xyz[2]);
441 vx = lerp(vy, vy1, xyz[1]);
445 vz = BaseT::mAcc.getValue(coord);
447 vz1 = BaseT::mAcc.getValue(coord);
448 vy1 = lerp(vz, vz1, xyz[2]);
452 vz1 = BaseT::mAcc.getValue(coord);
454 vz = BaseT::mAcc.getValue(coord);
455 vy = lerp(vz, vz1, xyz[2]);
457 vx1 = lerp(vy, vy1, xyz[1]);
459 return lerp(vx, vx1, xyz[0]);
464 template<
typename TreeOrAccT>
465 template<
typename RealT,
template<
typename...>
class Vec3T>
469 CoordT ijk = Floor<CoordT>(xyz);
470 BaseT::stencil(ijk, val);
474 template<
typename TreeOrAccT>
475 template<
typename RealT,
template<
typename...>
class Vec3T>
479 CoordT ijk = Floor<CoordT>(xyz);
480 BaseT::stencil(ijk, val);
481 return BaseT::zeroCrossing(val);
487 template<
typename TreeOrAccT>
494 using ValueT =
typename TreeOrAccT::ValueType;
495 using CoordT =
typename TreeOrAccT::CoordType;
496 static const int ORDER = 1;
506 template<
typename RealT,
template<
typename...>
class Vec3T>
512 template<
typename TreeOrAccT>
515 CoordT p(ijk[0] - 1, 0, 0);
516 for (
int dx = 0; dx < 3; ++dx, ++p[0]) {
518 for (
int dy = 0; dy < 3; ++dy, ++p[1]) {
520 for (
int dz = 0; dz < 3; ++dz, ++p[2]) {
521 v[dx][dy][dz] = mAcc.getValue(p);
527 template<
typename TreeOrAccT>
528 template<
typename RealT,
template<
typename...>
class Vec3T>
532 return weight * (weight * (0.5f * (value[0] + value[2]) - value[1]) +
533 0.5f * (value[2] - value[0])) + value[1];
537 for (
int dx = 0; dx < 3; ++dx) {
539 for (
int dy = 0; dy < 3; ++dy) {
540 vy[dy] = kernel(&v[dx][dy][0], uvw[2]);
542 vx[dx] = kernel(vy, uvw[1]);
544 return kernel(vx, uvw[0]);
547 template<
typename TreeOrAccT>
551 const bool less = v[0][0][0] <
ValueT(0);
552 for (
int dx = 0; dx < 3; ++dx) {
553 for (
int dy = 0; dy < 3; ++dy) {
554 for (
int dz = 0; dz < 3; ++dz) {
555 if (less ^ (v[dx][dy][dz] < ValueT(0)))
return true;
563 template<
typename TreeOrAccT>
567 using ValueT =
typename TreeOrAccT::ValueType;
568 using CoordT =
typename TreeOrAccT::CoordType;
575 template<
typename RealT,
template<
typename...>
class Vec3T>
583 template<
typename RealT,
template<
typename...>
class Vec3T>
584 inline __hostdev__ bool zeroCrossing(Vec3T<RealT> xyz)
const;
589 template<
typename TreeOrAccT>
593 using ValueT =
typename TreeOrAccT::ValueType;
594 using CoordT =
typename TreeOrAccT::CoordType;
597 mutable ValueT mVal[3][3][3];
599 template<
typename RealT,
template<
typename...>
class Vec3T>
607 template<
typename RealT,
template<
typename...>
class Vec3T>
615 template<
typename RealT,
template<
typename...>
class Vec3T>
616 inline __hostdev__ bool zeroCrossing(Vec3T<RealT> xyz)
const;
625 template<
typename TreeOrAccT>
626 template<
typename RealT,
template<
typename...>
class Vec3T>
630 return BaseT::sample(xyz, mVal);
633 template<
typename TreeOrAccT>
636 return ijk == mPos ? mVal[1][1][1] : BaseT::mAcc.getValue(ijk);
639 template<
typename TreeOrAccT>
640 template<
typename RealT,
template<
typename...>
class Vec3T>
644 return BaseT::zeroCrossing(mVal);
647 template<
typename TreeOrAccT>
648 template<
typename RealT,
template<
typename...>
class Vec3T>
651 CoordT ijk = Floor<CoordT>(xyz);
654 BaseT::stencil(ijk, mVal);
658 template<
typename TreeOrAccT>
659 template<
typename RealT,
template<
typename...>
class Vec3T>
663 CoordT ijk = Floor<CoordT>(xyz);
664 BaseT::stencil(ijk, val);
665 return BaseT::sample(xyz, val);
668 template<
typename TreeOrAccT>
669 template<
typename RealT,
template<
typename...>
class Vec3T>
673 CoordT ijk = Floor<CoordT>(xyz);
674 BaseT::stencil(ijk, val);
675 return BaseT::zeroCrossing(val);
687 template<
typename TreeOrAccT>
691 using ValueT =
typename TreeOrAccT::ValueType;
692 using CoordT =
typename TreeOrAccT::CoordType;
708 template<
typename RealT,
template<
typename...>
class Vec3T>
712 template<
typename TreeOrAccT>
715 auto fetch = [&](
int i,
int j,
int k) ->
ValueT& {
return C[((i + 1) << 4) + ((j + 1) << 2) + k + 1]; };
718 for (
int i = -1; i < 3; ++i) {
719 for (
int j = -1; j < 3; ++j) {
720 fetch(i, j, -1) = mAcc.getValue(ijk +
CoordT(i, j, -1));
721 fetch(i, j, 0) = mAcc.getValue(ijk +
CoordT(i, j, 0));
722 fetch(i, j, 1) = mAcc.getValue(ijk +
CoordT(i, j, 1));
723 fetch(i, j, 2) = mAcc.getValue(ijk +
CoordT(i, j, 2));
726 const ValueT half(0.5), quarter(0.25), eighth(0.125);
737 half * (fetch(1, 0, 0) - fetch(-1, 0, 0)),
738 half * (fetch(2, 0, 0) - fetch(0, 0, 0)),
739 half * (fetch(1, 1, 0) - fetch(-1, 1, 0)),
740 half * (fetch(2, 1, 0) - fetch(0, 1, 0)),
741 half * (fetch(1, 0, 1) - fetch(-1, 0, 1)),
742 half * (fetch(2, 0, 1) - fetch(0, 0, 1)),
743 half * (fetch(1, 1, 1) - fetch(-1, 1, 1)),
744 half * (fetch(2, 1, 1) - fetch(0, 1, 1)),
746 half * (fetch(0, 1, 0) - fetch(0, -1, 0)),
747 half * (fetch(1, 1, 0) - fetch(1, -1, 0)),
748 half * (fetch(0, 2, 0) - fetch(0, 0, 0)),
749 half * (fetch(1, 2, 0) - fetch(1, 0, 0)),
750 half * (fetch(0, 1, 1) - fetch(0, -1, 1)),
751 half * (fetch(1, 1, 1) - fetch(1, -1, 1)),
752 half * (fetch(0, 2, 1) - fetch(0, 0, 1)),
753 half * (fetch(1, 2, 1) - fetch(1, 0, 1)),
755 half * (fetch(0, 0, 1) - fetch(0, 0, -1)),
756 half * (fetch(1, 0, 1) - fetch(1, 0, -1)),
757 half * (fetch(0, 1, 1) - fetch(0, 1, -1)),
758 half * (fetch(1, 1, 1) - fetch(1, 1, -1)),
759 half * (fetch(0, 0, 2) - fetch(0, 0, 0)),
760 half * (fetch(1, 0, 2) - fetch(1, 0, 0)),
761 half * (fetch(0, 1, 2) - fetch(0, 1, 0)),
762 half * (fetch(1, 1, 2) - fetch(1, 1, 0)),
764 quarter * (fetch(1, 1, 0) - fetch(-1, 1, 0) - fetch(1, -1, 0) + fetch(-1, -1, 0)),
765 quarter * (fetch(2, 1, 0) - fetch(0, 1, 0) - fetch(2, -1, 0) + fetch(0, -1, 0)),
766 quarter * (fetch(1, 2, 0) - fetch(-1, 2, 0) - fetch(1, 0, 0) + fetch(-1, 0, 0)),
767 quarter * (fetch(2, 2, 0) - fetch(0, 2, 0) - fetch(2, 0, 0) + fetch(0, 0, 0)),
768 quarter * (fetch(1, 1, 1) - fetch(-1, 1, 1) - fetch(1, -1, 1) + fetch(-1, -1, 1)),
769 quarter * (fetch(2, 1, 1) - fetch(0, 1, 1) - fetch(2, -1, 1) + fetch(0, -1, 1)),
770 quarter * (fetch(1, 2, 1) - fetch(-1, 2, 1) - fetch(1, 0, 1) + fetch(-1, 0, 1)),
771 quarter * (fetch(2, 2, 1) - fetch(0, 2, 1) - fetch(2, 0, 1) + fetch(0, 0, 1)),
773 quarter * (fetch(1, 0, 1) - fetch(-1, 0, 1) - fetch(1, 0, -1) + fetch(-1, 0, -1)),
774 quarter * (fetch(2, 0, 1) - fetch(0, 0, 1) - fetch(2, 0, -1) + fetch(0, 0, -1)),
775 quarter * (fetch(1, 1, 1) - fetch(-1, 1, 1) - fetch(1, 1, -1) + fetch(-1, 1, -1)),
776 quarter * (fetch(2, 1, 1) - fetch(0, 1, 1) - fetch(2, 1, -1) + fetch(0, 1, -1)),
777 quarter * (fetch(1, 0, 2) - fetch(-1, 0, 2) - fetch(1, 0, 0) + fetch(-1, 0, 0)),
778 quarter * (fetch(2, 0, 2) - fetch(0, 0, 2) - fetch(2, 0, 0) + fetch(0, 0, 0)),
779 quarter * (fetch(1, 1, 2) - fetch(-1, 1, 2) - fetch(1, 1, 0) + fetch(-1, 1, 0)),
780 quarter * (fetch(2, 1, 2) - fetch(0, 1, 2) - fetch(2, 1, 0) + fetch(0, 1, 0)),
782 quarter * (fetch(0, 1, 1) - fetch(0, -1, 1) - fetch(0, 1, -1) + fetch(0, -1, -1)),
783 quarter * (fetch(1, 1, 1) - fetch(1, -1, 1) - fetch(1, 1, -1) + fetch(1, -1, -1)),
784 quarter * (fetch(0, 2, 1) - fetch(0, 0, 1) - fetch(0, 2, -1) + fetch(0, 0, -1)),
785 quarter * (fetch(1, 2, 1) - fetch(1, 0, 1) - fetch(1, 2, -1) + fetch(1, 0, -1)),
786 quarter * (fetch(0, 1, 2) - fetch(0, -1, 2) - fetch(0, 1, 0) + fetch(0, -1, 0)),
787 quarter * (fetch(1, 1, 2) - fetch(1, -1, 2) - fetch(1, 1, 0) + fetch(1, -1, 0)),
788 quarter * (fetch(0, 2, 2) - fetch(0, 0, 2) - fetch(0, 2, 0) + fetch(0, 0, 0)),
789 quarter * (fetch(1, 2, 2) - fetch(1, 0, 2) - fetch(1, 2, 0) + fetch(1, 0, 0)),
791 eighth * (fetch(1, 1, 1) - fetch(-1, 1, 1) - fetch(1, -1, 1) + fetch(-1, -1, 1) - fetch(1, 1, -1) + fetch(-1, 1, -1) + fetch(1, -1, -1) - fetch(-1, -1, -1)),
792 eighth * (fetch(2, 1, 1) - fetch(0, 1, 1) - fetch(2, -1, 1) + fetch(0, -1, 1) - fetch(2, 1, -1) + fetch(0, 1, -1) + fetch(2, -1, -1) - fetch(0, -1, -1)),
793 eighth * (fetch(1, 2, 1) - fetch(-1, 2, 1) - fetch(1, 0, 1) + fetch(-1, 0, 1) - fetch(1, 2, -1) + fetch(-1, 2, -1) + fetch(1, 0, -1) - fetch(-1, 0, -1)),
794 eighth * (fetch(2, 2, 1) - fetch(0, 2, 1) - fetch(2, 0, 1) + fetch(0, 0, 1) - fetch(2, 2, -1) + fetch(0, 2, -1) + fetch(2, 0, -1) - fetch(0, 0, -1)),
795 eighth * (fetch(1, 1, 2) - fetch(-1, 1, 2) - fetch(1, -1, 2) + fetch(-1, -1, 2) - fetch(1, 1, 0) + fetch(-1, 1, 0) + fetch(1, -1, 0) - fetch(-1, -1, 0)),
796 eighth * (fetch(2, 1, 2) - fetch(0, 1, 2) - fetch(2, -1, 2) + fetch(0, -1, 2) - fetch(2, 1, 0) + fetch(0, 1, 0) + fetch(2, -1, 0) - fetch(0, -1, 0)),
797 eighth * (fetch(1, 2, 2) - fetch(-1, 2, 2) - fetch(1, 0, 2) + fetch(-1, 0, 2) - fetch(1, 2, 0) + fetch(-1, 2, 0) + fetch(1, 0, 0) - fetch(-1, 0, 0)),
798 eighth * (fetch(2, 2, 2) - fetch(0, 2, 2) - fetch(2, 0, 2) + fetch(0, 0, 2) - fetch(2, 2, 0) + fetch(0, 2, 0) + fetch(2, 0, 0) - fetch(0, 0, 0))};
801 static const int8_t A[64][64] = {
802 {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
803 {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
804 {-3, 3, 0, 0, 0, 0, 0, 0, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, -4, 4, 0, 0, -2, 2, 0, 0, -2, -2, 0, 0, -1, -1, 0, 0},
842 {9, 0, -9, 0, -9, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 3, 0, -6, 0, -3, 0, 6, 0, -6, 0, 3, 0, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 2, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
843 {0, 0, 0, 0, 0, 0, 0, 0, 9, 0, -9, 0, -9, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 3, 0, -6, 0, -3, 0, 6, 0, -6, 0, 3, 0, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 2, 0, 2, 0, 1, 0},
844 {-27, 27, 27, -27, 27, -27, -27, 27, -18, -9, 18, 9, 18, 9, -18, -9, -18, 18, -9, 9, 18, -18, 9, -9, -18, 18, 18, -18, -9, 9, 9, -9, -12, -6, -6, -3, 12, 6, 6, 3, -12, -6, 12, 6, -6, -3, 6, 3, -12, 12, -6, 6, -6, 6, -3, 3, -8, -4, -4, -2, -4, -2, -2, -1},
845 {18, -18, -18, 18, -18, 18, 18, -18, 9, 9, -9, -9, -9, -9, 9, 9, 12, -12, 6, -6, -12, 12, -6, 6, 12, -12, -12, 12, 6, -6, -6, 6, 6, 6, 3, 3, -6, -6, -3, -3, 6, 6, -6, -6, 3, 3, -3, -3, 8, -8, 4, -4, 4, -4, 2, -2, 4, 4, 2, 2, 2, 2, 1, 1},
846 {-6, 0, 6, 0, 6, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0, -3, 0, 3, 0, 3, 0, -4, 0, 4, 0, -2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -2, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
847 {0, 0, 0, 0, 0, 0, 0, 0, -6, 0, 6, 0, 6, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0, -3, 0, 3, 0, 3, 0, -4, 0, 4, 0, -2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -2, 0, -1, 0, -1, 0},
848 {18, -18, -18, 18, -18, 18, 18, -18, 12, 6, -12, -6, -12, -6, 12, 6, 9, -9, 9, -9, -9, 9, -9, 9, 12, -12, -12, 12, 6, -6, -6, 6, 6, 3, 6, 3, -6, -3, -6, -3, 8, 4, -8, -4, 4, 2, -4, -2, 6, -6, 6, -6, 3, -3, 3, -3, 4, 2, 4, 2, 2, 1, 2, 1},
849 {-12, 12, 12, -12, 12, -12, -12, 12, -6, -6, 6, 6, 6, 6, -6, -6, -6, 6, -6, 6, 6, -6, 6, -6, -8, 8, 8, -8, -4, 4, 4, -4, -3, -3, -3, -3, 3, 3, 3, 3, -4, -4, 4, 4, -2, -2, 2, 2, -4, 4, -4, 4, -2, 2, -2, 2, -2, -2, -2, -2, -1, -1, -1, -1},
850 {2, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
851 {0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
852 {-6, 6, 0, 0, 6, -6, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -2, 0, 0, 2, -2, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0},
858 {-6, 0, 6, 0, 6, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, 0, -2, 0, 4, 0, 2, 0, -3, 0, 3, 0, -3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -1, 0, -2, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
859 {0, 0, 0, 0, 0, 0, 0, 0, -6, 0, 6, 0, 6, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, 0, -2, 0, 4, 0, 2, 0, -3, 0, 3, 0, -3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -1, 0, -2, 0, -1, 0},
860 {18, -18, -18, 18, -18, 18, 18, -18, 12, 6, -12, -6, -12, -6, 12, 6, 12, -12, 6, -6, -12, 12, -6, 6, 9, -9, -9, 9, 9, -9, -9, 9, 8, 4, 4, 2, -8, -4, -4, -2, 6, 3, -6, -3, 6, 3, -6, -3, 6, -6, 3, -3, 6, -6, 3, -3, 4, 2, 2, 1, 4, 2, 2, 1},
861 {-12, 12, 12, -12, 12, -12, -12, 12, -6, -6, 6, 6, 6, 6, -6, -6, -8, 8, -4, 4, 8, -8, 4, -4, -6, 6, 6, -6, -6, 6, 6, -6, -4, -4, -2, -2, 4, 4, 2, 2, -3, -3, 3, 3, -3, -3, 3, 3, -4, 4, -2, 2, -4, 4, -2, 2, -2, -2, -1, -1, -2, -2, -1, -1},
862 {4, 0, -4, 0, -4, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, -2, 0, -2, 0, 2, 0, -2, 0, 2, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
863 {0, 0, 0, 0, 0, 0, 0, 0, 4, 0, -4, 0, -4, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, -2, 0, -2, 0, 2, 0, -2, 0, 2, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0},
864 {-12, 12, 12, -12, 12, -12, -12, 12, -8, -4, 8, 4, 8, 4, -8, -4, -6, 6, -6, 6, 6, -6, 6, -6, -6, 6, 6, -6, -6, 6, 6, -6, -4, -2, -4, -2, 4, 2, 4, 2, -4, -2, 4, 2, -4, -2, 4, 2, -3, 3, -3, 3, -3, 3, -3, 3, -2, -1, -2, -1, -2, -1, -2, -1},
865 {8, -8, -8, 8, -8, 8, 8, -8, 4, 4, -4, -4, -4, -4, 4, 4, 4, -4, 4, -4, -4, 4, -4, 4, 4, -4, -4, 4, 4, -4, -4, 4, 2, 2, 2, 2, -2, -2, -2, -2, 2, 2, -2, -2, 2, 2, -2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 1, 1, 1, 1, 1, 1, 1, 1}};
867 for (
int i = 0; i < 64; ++i) {
870 for (
int j = 0; j < 64; j += 4) {
871 C[i] = fma(A[i][j], X[j], fma(A[i][j+1], X[j+1], fma(A[i][j+2], X[j+2], fma(A[i][j+3], X[j+3], C[i]))));
874 for (
int j = 0; j < 64; j += 4) {
875 C[i] += A[i][j] * X[j] + A[i][j + 1] * X[j + 1] + A[i][j + 2] * X[j + 2] + A[i][j + 3] * X[j + 3];
881 template<
typename TreeOrAccT>
882 template<
typename RealT,
template<
typename...>
class Vec3T>
886 for (
int k = 0, n = 0; k < 4; ++k) {
888 for (
int j = 0; j < 4; ++j, n += 4) {
890 sum = fma( yPow, zPow * fma(xyz[0], fma(xyz[0], fma(xyz[0], C[n + 3], C[n + 2]), C[n + 1]), C[n]), sum);
892 sum += yPow * zPow * (C[n] + xyz[0] * (C[n + 1] + xyz[0] * (C[n + 2] + xyz[0] * C[n + 3])));
901 template<
typename TreeOrAccT>
905 using ValueT =
typename TreeOrAccT::ValueType;
906 using CoordT =
typename TreeOrAccT::CoordType;
911 template<
typename RealT,
template<
typename...>
class Vec3T>
922 template<
typename RealT,
template<
typename...>
class Vec3T>
930 template<
typename TreeOrAccT>
931 template<
typename RealT,
template<
typename...>
class Vec3T>
935 return BaseT::sample(xyz, mC);
938 template<
typename TreeOrAccT>
939 template<
typename RealT,
template<
typename...>
class Vec3T>
942 CoordT ijk = Floor<CoordT>(xyz);
945 BaseT::stencil(ijk, mC);
949 template<
typename TreeOrAccT>
953 using ValueT =
typename TreeOrAccT::ValueType;
954 using CoordT =
typename TreeOrAccT::CoordType;
964 template<
typename RealT,
template<
typename...>
class Vec3T>
971 template<
typename TreeOrAccT>
972 template<
typename RealT,
template<
typename...>
class Vec3T>
976 CoordT ijk = Floor<CoordT>(xyz);
977 BaseT::stencil(ijk, C);
978 return BaseT::sample(xyz, C);
983 #endif // NANOVDB_SAMPLE_FROM_VOXELS_H_HAS_BEEN_INCLUDED const TreeOrAccT & accessor() const
Definition: SampleFromVoxels.h:501
Tri-linear sampler, i.e. first order, interpolator.
Definition: SampleFromVoxels.h:170
ValueT operator()(const CoordT &ijk) const
Definition: SampleFromVoxels.h:578
ValueT operator()(const CoordT &ijk) const
Definition: SampleFromVoxels.h:304
TriquadraticSampler(const TreeOrAccT &acc)
Protected constructor from a Tree or ReadAccessor.
Definition: SampleFromVoxels.h:499
ValueT operator()(const CoordT &ijk) const
Definition: SampleFromVoxels.h:131
ValueT operator()(const CoordT &ijk) const
Definition: SampleFromVoxels.h:967
typename TreeOrAccT::ValueType ValueT
Definition: SampleFromVoxels.h:115
typename TreeOrAccT::ValueType ValueT
Definition: SampleFromVoxels.h:85
const TreeOrAccT & accessor() const
Definition: SampleFromVoxels.h:183
Tri-quadratic sampler, i.e. second order, interpolator.
Definition: SampleFromVoxels.h:488
typename TreeOrAccT::CoordType CoordT
Definition: SampleFromVoxels.h:692
const TreeOrAccT & accessor() const
Definition: SampleFromVoxels.h:703
Definition: NanoVDB.h:184
#define __hostdev__
Definition: SampleFromVoxels.h:29
SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
Definition: SampleFromVoxels.h:336
typename TreeOrAccT::CoordType CoordT
Definition: SampleFromVoxels.h:177
int32_t Floor(float x)
Definition: NanoVDB.h:711
static bool zeroCrossing(const ValueT(&v)[2][2][2])
Definition: SampleFromVoxels.h:273
void stencil(const CoordT &ijk, ValueT(&c)[64]) const
Extract the stencil of 8 values.
Definition: SampleFromVoxels.h:713
const TreeOrAccT & accessor() const
Definition: SampleFromVoxels.h:125
TricubicSampler(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
Definition: SampleFromVoxels.h:698
SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
Definition: SampleFromVoxels.h:958
const TreeOrAccT & mAcc
Definition: SampleFromVoxels.h:173
Tri-cubic sampler, i.e. third order, interpolator.
Definition: SampleFromVoxels.h:688
SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
Definition: SampleFromVoxels.h:120
SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
Definition: SampleFromVoxels.h:572
SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
Definition: SampleFromVoxels.h:297
typename TreeOrAccT::ValueType ValueT
Definition: SampleFromVoxels.h:176
bool zeroCrossing() const
Return true if the cached tri-linear stencil has a zero crossing.
Definition: SampleFromVoxels.h:621
static ValueT sample(const Vec3T< RealT > &uvw, const ValueT(&v)[2][2][2])
static bool zeroCrossing(const ValueT(&v)[3][3][3])
Definition: SampleFromVoxels.h:548
SampleFromVoxels< TreeOrAccT, Order, UseCache > createSampler(const TreeOrAccT &acc)
Factory free-function for a sampler of specific polynomial orders.
Definition: SampleFromVoxels.h:46
ValueT value
Definition: GridBuilder.h:1287
TrilinearSampler(const TreeOrAccT &acc)
Protected constructor from a Tree or ReadAccessor.
Definition: SampleFromVoxels.h:181
typename TreeOrAccT::CoordType CoordT
Definition: SampleFromVoxels.h:116
typename TreeOrAccT::CoordType CoordT
Definition: SampleFromVoxels.h:86
SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
Definition: SampleFromVoxels.h:604
SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
Definition: SampleFromVoxels.h:916
void stencil(const CoordT &ijk, ValueT(&v)[3][3][3]) const
Extract the stencil of 27 values.
Definition: SampleFromVoxels.h:513
typename TreeOrAccT::ValueType ValueT
Definition: SampleFromVoxels.h:494
static ValueT sample(const Vec3T< RealT > &uvw, const ValueT(&c)[64])
typename TreeOrAccT::ValueType ValueT
Definition: SampleFromVoxels.h:691
static Vec3T< ValueT > gradient(const Vec3T< RealT > &uvw, const ValueT(&v)[2][2][2])
SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
Definition: SampleFromVoxels.h:90
ValueT operator()(const CoordT &ijk) const
Definition: SampleFromVoxels.h:926
static ValueT sample(const Vec3T< RealT > &uvw, const ValueT(&v)[3][3][3])
const TreeOrAccT & mAcc
Definition: SampleFromVoxels.h:694
bool zeroCrossing() const
Return true if the cached tri-linear stencil has a zero crossing.
Definition: SampleFromVoxels.h:360
C++11 implementation of std::is_floating_point.
Definition: NanoVDB.h:355
const TreeOrAccT & mAcc
Definition: SampleFromVoxels.h:491
internal::half half
Definition: Types.h:29
typename TreeOrAccT::CoordType CoordT
Definition: SampleFromVoxels.h:495
void stencil(CoordT &ijk, ValueT(&v)[2][2][2]) const
Extract the stencil of 8 values.
Definition: SampleFromVoxels.h:198
Definition: SampleFromVoxels.h:36
const TreeOrAccT & accessor() const
Definition: SampleFromVoxels.h:96