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>
75 return CoordT(int32_t(ijk[0]), int32_t(ijk[1]), int32_t(ijk[2]));
81 template<
typename TreeOrAccT>
86 using CoordT =
typename TreeOrAccT::CoordType;
88 static const int ORDER = 0;
99 template<
typename Vec3T>
100 inline __hostdev__ ValueT operator()(
const Vec3T& xyz)
const;
102 inline __hostdev__ ValueT operator()(
const CoordT& ijk)
const;
105 const TreeOrAccT& mAcc;
111 template<
typename TreeOrAccT>
116 using CoordT =
typename TreeOrAccT::CoordType;
117 static const int ORDER = 0;
128 template<
typename Vec3T>
129 inline __hostdev__ ValueT operator()(
const Vec3T& xyz)
const;
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>
177 using CoordT =
typename TreeOrAccT::CoordType;
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>
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>
292 using CoordT =
typename TreeOrAccT::CoordType;
300 template<
typename RealT,
template<
typename...>
class Vec3T>
301 inline __hostdev__ ValueT operator()(Vec3T<RealT> xyz)
const;
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>
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>
340 inline __hostdev__ ValueT operator()(Vec3T<RealT> xyz)
const;
343 __hostdev__ ValueT operator()(
const CoordT &ijk)
const;
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);
407 template<
typename TreeOrAccT>
408 template<
typename RealT,
template<
typename...>
class Vec3T>
412 CoordT ijk = Floor<CoordT>(xyz);
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);
474 template<
typename TreeOrAccT>
475 template<
typename RealT,
template<
typename...>
class Vec3T>
479 CoordT ijk = Floor<CoordT>(xyz);
481 return BaseT::zeroCrossing(val);
487 template<
typename TreeOrAccT>
495 using CoordT =
typename TreeOrAccT::CoordType;
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>
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>
568 using CoordT =
typename TreeOrAccT::CoordType;
575 template<
typename RealT,
template<
typename...>
class Vec3T>
576 inline __hostdev__ ValueT operator()(Vec3T<RealT> xyz)
const;
583 template<
typename RealT,
template<
typename...>
class Vec3T>
584 inline __hostdev__ bool zeroCrossing(Vec3T<RealT> xyz)
const;
589 template<
typename TreeOrAccT>
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>
608 inline __hostdev__ ValueT operator()(Vec3T<RealT> xyz)
const;
610 inline __hostdev__ ValueT operator()(
const CoordT &ijk)
const;
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);
658 template<
typename TreeOrAccT>
659 template<
typename RealT,
template<
typename...>
class Vec3T>
663 CoordT ijk = Floor<CoordT>(xyz);
665 return BaseT::sample(xyz, val);
668 template<
typename TreeOrAccT>
669 template<
typename RealT,
template<
typename...>
class Vec3T>
673 CoordT ijk = Floor<CoordT>(xyz);
675 return BaseT::zeroCrossing(val);
687 template<
typename TreeOrAccT>
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, 0, 0, 0, 0, 0, 0},
805 {2, -2, 0, 0, 0, 0, 0, 0, 1, 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,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, 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, 0, -4, -2, 0, 0, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 3, 0, 0, -3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -1, 0, 0, -2, -1, 0, 0,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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>
906 using CoordT =
typename TreeOrAccT::CoordType;
911 template<
typename RealT,
template<
typename...>
class Vec3T>
922 template<
typename RealT,
template<
typename...>
class Vec3T>
923 inline __hostdev__ ValueT operator()(Vec3T<RealT> xyz)
const;
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);
949 template<
typename TreeOrAccT>
954 using CoordT =
typename TreeOrAccT::CoordType;
964 template<
typename RealT,
template<
typename...>
class Vec3T>
965 inline __hostdev__ ValueT operator()(Vec3T<RealT> xyz)
const;
971 template<
typename TreeOrAccT>
972 template<
typename RealT,
template<
typename...>
class Vec3T>
976 CoordT ijk = Floor<CoordT>(xyz);
978 return BaseT::sample(xyz, C);
983 #endif // NANOVDB_SAMPLE_FROM_VOXELS_H_HAS_BEEN_INCLUDED
__hostdev__ const TreeOrAccT & accessor() const
typename TreeOrAccT::ValueType ValueT
__hostdev__ SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
__hostdev__ ValueT operator()(const CoordT &ijk) const
__hostdev__ SampleFromVoxels< TreeOrAccT, Order, UseCache > createSampler(const TreeOrAccT &acc)
Factory free-function for a sampler of specific polynomial orders.
imath_half_bits_t half
if we're in a C-only context, alias the half bits type to half
__hostdev__ SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
typename TreeOrAccT::ValueType ValueT
IMATH_HOSTDEVICE constexpr int floor(T x) IMATH_NOEXCEPT
__hostdev__ void stencil(const CoordT &ijk, ValueT(&v)[3][3][3]) const
Extract the stencil of 27 values.
GLsizei const GLfloat * value
__hostdev__ void stencil(const CoordT &ijk, ValueT(&c)[64]) const
Extract the stencil of 8 values.
static __hostdev__ bool zeroCrossing(const ValueT(&v)[2][2][2])
virtual bool lerp(GA_AttributeOperand &d, GA_AttributeOperand &a, GA_AttributeOperand &b, GA_AttributeOperand &t) const
d = SYSlerp(a, b, t);
Tri-quadratic sampler, i.e. second order, interpolator.
typename TreeOrAccT::CoordType CoordT
GLboolean GLboolean GLboolean GLboolean a
typename TreeOrAccT::ValueType ValueT
static __hostdev__ ValueT sample(const Vec3T< RealT > &uvw, const ValueT(&v)[3][3][3])
__hostdev__ ValueT operator()(const CoordT &ijk) const
static __hostdev__ ValueT sample(const Vec3T< RealT > &uvw, const ValueT(&c)[64])
__hostdev__ bool zeroCrossing() const
Return true if the cached tri-linear stencil has a zero crossing.
__hostdev__ TrilinearSampler(const TreeOrAccT &acc)
Protected constructor from a Tree or ReadAccessor.
typename TreeOrAccT::ValueType ValueT
static __hostdev__ bool zeroCrossing(const ValueT(&v)[3][3][3])
typename TreeOrAccT::ValueType ValueT
__hostdev__ bool zeroCrossing() const
Return true if the cached tri-linear stencil has a zero crossing.
__hostdev__ SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
Tri-cubic sampler, i.e. third order, interpolator.
typename TreeOrAccT::CoordType CoordT
__hostdev__ ValueT operator()(Vec3T< RealT > xyz) const
__hostdev__ void stencil(CoordT &ijk, ValueT(&v)[2][2][2]) const
Extract the stencil of 8 values.
__hostdev__ SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
__hostdev__ SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
GLboolean GLboolean GLboolean b
typename TreeOrAccT::CoordType CoordT
static __hostdev__ ValueT sample(const Vec3T< RealT > &uvw, const ValueT(&v)[2][2][2])
static __hostdev__ Vec3T< ValueT > gradient(const Vec3T< RealT > &uvw, const ValueT(&v)[2][2][2])
__hostdev__ const TreeOrAccT & accessor() const
__hostdev__ SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
typename TreeOrAccT::CoordType CoordT
__hostdev__ TricubicSampler(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
__hostdev__ SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
__hostdev__ int32_t Floor(float x)
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
__hostdev__ SampleFromVoxels(const TreeOrAccT &acc)
Construction from a Tree or ReadAccessor.
Tri-linear sampler, i.e. first order, interpolator.
__hostdev__ const TreeOrAccT & accessor() const
__hostdev__ ValueT operator()(const CoordT &ijk) const
GLubyte GLubyte GLubyte GLubyte w
__hostdev__ const TreeOrAccT & accessor() const
__hostdev__ ValueT operator()(const CoordT &ijk) const
typename TreeOrAccT::CoordType CoordT
GLint GLfloat GLint stencil
__hostdev__ const TreeOrAccT & accessor() const
__hostdev__ ValueT operator()(const CoordT &ijk) const
C++11 implementation of std::is_floating_point.
__hostdev__ TriquadraticSampler(const TreeOrAccT &acc)
Protected constructor from a Tree or ReadAccessor.