13 #ifndef OPENVDB_MATH_STENCILS_HAS_BEEN_INCLUDED
14 #define OPENVDB_MATH_STENCILS_HAS_BEEN_INCLUDED
34 template<
typename DerivedType,
typename Gr
idT,
bool IsSafe>
51 static_cast<DerivedType&
>(*this).init(
mCenter);
63 static_cast<DerivedType&
>(*this).init(
mCenter);
71 template<
typename IterType>
72 inline void moveTo(
const IterType& iter)
76 static_cast<DerivedType&
>(*this).init(
mCenter);
85 template<
typename RealType>
104 template<
int i,
int j,
int k>
107 return mValues[
static_cast<const DerivedType&
>(*this).template pos<i,j,k>()];
111 template<
int i,
int j,
int k>
114 mValues[
static_cast<const DerivedType&
>(*this).template pos<i,j,k>()] = value;
124 assert(!tmp.empty());
125 size_t midpoint = (tmp.size() - 1) >> 1;
127 #if !defined(_MSC_VER) || _MSC_VER < 1924
128 std::nth_element(tmp.begin(), tmp.begin() + midpoint, tmp.end());
131 std::nth_element(tmp.begin(), tmp.begin() + midpoint, tmp.end(),
132 std::less<ValueType>());
134 return tmp[midpoint];
155 const auto iter = std::max_element(
mValues.begin(),
mValues.end());
169 const bool less = this->getValue< 0, 0, 0>() < isoValue;
170 return (less ^ (this->getValue<-1, 0, 0>() < isoValue)) ||
171 (less ^ (this->getValue< 1, 0, 0>() < isoValue)) ||
172 (less ^ (this->getValue< 0,-1, 0>() < isoValue)) ||
173 (less ^ (this->getValue< 0, 1, 0>() < isoValue)) ||
174 (less ^ (this->getValue< 0, 0,-1>() < isoValue)) ||
175 (less ^ (this->getValue< 0, 0, 1>() < isoValue)) ;
191 const bool less = this->getValue< 0, 0, 0>() < isoValue;
192 mask[0] = less ^ (this->
getValue<-1, 0, 0>() < isoValue);
193 mask[1] = less ^ (this->getValue< 1, 0, 0>() < isoValue);
194 mask[2] = less ^ (this->getValue< 0,-1, 0>() < isoValue);
195 mask[3] = less ^ (this->getValue< 0, 1, 0>() < isoValue);
196 mask[4] = less ^ (this->getValue< 0, 0,-1>() < isoValue);
197 mask[5] = less ^ (this->getValue< 0, 0, 1>() < isoValue);
233 template<
int i,
int j,
int k>
struct SevenPt {};
234 template<>
struct SevenPt< 0, 0, 0> {
enum { idx = 0 }; };
235 template<>
struct SevenPt< 1, 0, 0> {
enum { idx = 1 }; };
236 template<>
struct SevenPt< 0, 1, 0> {
enum { idx = 2 }; };
237 template<>
struct SevenPt< 0, 0, 1> {
enum { idx = 3 }; };
238 template<>
struct SevenPt<-1, 0, 0> {
enum { idx = 4 }; };
239 template<>
struct SevenPt< 0,-1, 0> {
enum { idx = 5 }; };
240 template<>
struct SevenPt< 0, 0,-1> {
enum { idx = 6 }; };
245 template<
typename Gr
idT,
bool IsSafe = true>
260 template<
int i,
int j,
int k>
261 unsigned int pos()
const {
return SevenPt<i,j,k>::idx; }
264 inline void init(
const Coord& ijk)
267 BaseType::template setValue< 1, 0, 0>(
mAcc.
getValue(ijk.offsetBy( 1, 0, 0)));
269 BaseType::template setValue< 0,-1, 0>(
mAcc.
getValue(ijk.offsetBy( 0,-1, 0)));
270 BaseType::template setValue< 0, 1, 0>(
mAcc.
getValue(ijk.offsetBy( 0, 1, 0)));
272 BaseType::template setValue< 0, 0,-1>(
mAcc.
getValue(ijk.offsetBy( 0, 0,-1)));
273 BaseType::template setValue< 0, 0, 1>(
mAcc.
getValue(ijk.offsetBy( 0, 0, 1)));
288 template<
int i,
int j,
int k>
struct BoxPt {};
289 template<>
struct BoxPt< 0, 0, 0> {
enum { idx = 0 }; };
290 template<>
struct BoxPt< 0, 0, 1> {
enum { idx = 1 }; };
291 template<>
struct BoxPt< 0, 1, 1> {
enum { idx = 2 }; };
292 template<>
struct BoxPt< 0, 1, 0> {
enum { idx = 3 }; };
293 template<>
struct BoxPt< 1, 0, 0> {
enum { idx = 4 }; };
294 template<>
struct BoxPt< 1, 0, 1> {
enum { idx = 5 }; };
295 template<>
struct BoxPt< 1, 1, 1> {
enum { idx = 6 }; };
296 template<>
struct BoxPt< 1, 1, 0> {
enum { idx = 7 }; };
299 template<
typename Gr
idT,
bool IsSafe = true>
314 template<
int i,
int j,
int k>
315 unsigned int pos()
const {
return BoxPt<i,j,k>::idx; }
322 return (less ^ (
mValues[1] < isoValue)) ||
323 (less ^ (
mValues[2] < isoValue)) ||
324 (less ^ (
mValues[3] < isoValue)) ||
325 (less ^ (
mValues[4] < isoValue)) ||
326 (less ^ (
mValues[5] < isoValue)) ||
327 (less ^ (
mValues[6] < isoValue)) ||
328 (less ^ (
mValues[7] < isoValue)) ;
342 const ValueType v = xyz[1] - BaseType::mCenter[1];
343 const ValueType w = xyz[2] - BaseType::mCenter[2];
346 assert(u>=0 && u<=1);
347 assert(v>=0 && v<=1);
348 assert(w>=0 && w<=1);
350 ValueType V = BaseType::template getValue<0,0,0>();
352 V = BaseType::template getValue< 0, 1, 0>();
356 V = BaseType::template getValue<1,0,0>();
357 A =
static_cast<ValueType>(V + (BaseType::template getValue<1,0,1>() - V) *
w);
358 V = BaseType::template getValue<1,1,0>();
359 B =
static_cast<ValueType>(V + (BaseType::template getValue<1,1,1>() - V) *
w);
362 return static_cast<ValueType>(C + (D - C) * u);
376 const ValueType v = xyz[1] - BaseType::mCenter[1];
377 const ValueType w = xyz[2] - BaseType::mCenter[2];
380 assert(u>=0 && u<=1);
381 assert(v>=0 && v<=1);
382 assert(w>=0 && w<=1);
384 ValueType D[4]={BaseType::template getValue<0,0,1>()-BaseType::template getValue<0,0,0>(),
385 BaseType::template getValue<0,1,1>()-BaseType::template getValue<0,1,0>(),
386 BaseType::template getValue<1,0,1>()-BaseType::template getValue<1,0,0>(),
387 BaseType::template getValue<1,1,1>()-BaseType::template getValue<1,1,0>()};
393 zeroVal<ValueType>(),
394 static_cast<ValueType>(A + (B - A) * u));
396 D[0] =
static_cast<ValueType>(BaseType::template getValue<0,0,0>() + D[0] * w);
397 D[1] =
static_cast<ValueType>(BaseType::template getValue<0,1,0>() + D[1] * w);
398 D[2] =
static_cast<ValueType>(BaseType::template getValue<1,0,0>() + D[2] * w);
399 D[3] =
static_cast<ValueType>(BaseType::template getValue<1,1,0>() + D[3] * w);
402 A =
static_cast<ValueType>(D[0] + (D[1] - D[0]) * v);
403 B =
static_cast<ValueType>(D[2] + (D[3] - D[2]) * v);
411 grad[1] =
static_cast<ValueType>(A + (B -
A) * u);
417 inline void init(
const Coord& ijk)
419 BaseType::template setValue< 0, 0, 1>(
mAcc.
getValue(ijk.offsetBy( 0, 0, 1)));
420 BaseType::template setValue< 0, 1, 1>(
mAcc.
getValue(ijk.offsetBy( 0, 1, 1)));
421 BaseType::template setValue< 0, 1, 0>(
mAcc.
getValue(ijk.offsetBy( 0, 1, 0)));
422 BaseType::template setValue< 1, 0, 0>(
mAcc.
getValue(ijk.offsetBy( 1, 0, 0)));
423 BaseType::template setValue< 1, 0, 1>(
mAcc.
getValue(ijk.offsetBy( 1, 0, 1)));
424 BaseType::template setValue< 1, 1, 1>(
mAcc.
getValue(ijk.offsetBy( 1, 1, 1)));
425 BaseType::template setValue< 1, 1, 0>(
mAcc.
getValue(ijk.offsetBy( 1, 1, 0)));
440 template<
int i,
int j,
int k>
struct DensePt {};
441 template<>
struct DensePt< 0, 0, 0> {
enum { idx = 0 }; };
443 template<>
struct DensePt< 1, 0, 0> {
enum { idx = 1 }; };
444 template<>
struct DensePt< 0, 1, 0> {
enum { idx = 2 }; };
445 template<>
struct DensePt< 0, 0, 1> {
enum { idx = 3 }; };
447 template<>
struct DensePt<-1, 0, 0> {
enum { idx = 4 }; };
448 template<>
struct DensePt< 0,-1, 0> {
enum { idx = 5 }; };
449 template<>
struct DensePt< 0, 0,-1> {
enum { idx = 6 }; };
451 template<>
struct DensePt<-1,-1, 0> {
enum { idx = 7 }; };
452 template<>
struct DensePt< 0,-1,-1> {
enum { idx = 8 }; };
453 template<>
struct DensePt<-1, 0,-1> {
enum { idx = 9 }; };
455 template<>
struct DensePt< 1,-1, 0> {
enum { idx = 10 }; };
456 template<>
struct DensePt< 0, 1,-1> {
enum { idx = 11 }; };
457 template<>
struct DensePt<-1, 0, 1> {
enum { idx = 12 }; };
459 template<>
struct DensePt<-1, 1, 0> {
enum { idx = 13 }; };
460 template<>
struct DensePt< 0,-1, 1> {
enum { idx = 14 }; };
461 template<>
struct DensePt< 1, 0,-1> {
enum { idx = 15 }; };
463 template<>
struct DensePt< 1, 1, 0> {
enum { idx = 16 }; };
464 template<>
struct DensePt< 0, 1, 1> {
enum { idx = 17 }; };
465 template<>
struct DensePt< 1, 0, 1> {
enum { idx = 18 }; };
469 template<
typename Gr
idT,
bool IsSafe = true>
471 :
public BaseStencil<SecondOrderDenseStencil<GridT, IsSafe>, GridT, IsSafe >
485 template<
int i,
int j,
int k>
486 unsigned int pos()
const {
return DensePt<i,j,k>::idx; }
489 inline void init(
const Coord& ijk)
527 template<
int i,
int j,
int k>
struct ThirteenPt {};
528 template<>
struct ThirteenPt< 0, 0, 0> {
enum { idx = 0 }; };
530 template<>
struct ThirteenPt< 1, 0, 0> {
enum { idx = 1 }; };
531 template<>
struct ThirteenPt< 0, 1, 0> {
enum { idx = 2 }; };
532 template<>
struct ThirteenPt< 0, 0, 1> {
enum { idx = 3 }; };
534 template<>
struct ThirteenPt<-1, 0, 0> {
enum { idx = 4 }; };
535 template<>
struct ThirteenPt< 0,-1, 0> {
enum { idx = 5 }; };
536 template<>
struct ThirteenPt< 0, 0,-1> {
enum { idx = 6 }; };
538 template<>
struct ThirteenPt< 2, 0, 0> {
enum { idx = 7 }; };
539 template<>
struct ThirteenPt< 0, 2, 0> {
enum { idx = 8 }; };
540 template<>
struct ThirteenPt< 0, 0, 2> {
enum { idx = 9 }; };
542 template<>
struct ThirteenPt<-2, 0, 0> {
enum { idx = 10 }; };
543 template<>
struct ThirteenPt< 0,-2, 0> {
enum { idx = 11 }; };
544 template<>
struct ThirteenPt< 0, 0,-2> {
enum { idx = 12 }; };
549 template<
typename Gr
idT,
bool IsSafe = true>
551 :
public BaseStencil<ThirteenPointStencil<GridT, IsSafe>, GridT, IsSafe>
565 template<
int i,
int j,
int k>
566 unsigned int pos()
const {
return ThirteenPt<i,j,k>::idx; }
569 inline void init(
const Coord& ijk)
599 template<
int i,
int j,
int k>
struct FourthDensePt {};
600 template<>
struct FourthDensePt< 0, 0, 0> {
enum { idx = 0 }; };
602 template<>
struct FourthDensePt<-2, 2, 0> {
enum { idx = 1 }; };
603 template<>
struct FourthDensePt<-1, 2, 0> {
enum { idx = 2 }; };
604 template<>
struct FourthDensePt< 0, 2, 0> {
enum { idx = 3 }; };
605 template<>
struct FourthDensePt< 1, 2, 0> {
enum { idx = 4 }; };
606 template<>
struct FourthDensePt< 2, 2, 0> {
enum { idx = 5 }; };
608 template<>
struct FourthDensePt<-2, 1, 0> {
enum { idx = 6 }; };
609 template<>
struct FourthDensePt<-1, 1, 0> {
enum { idx = 7 }; };
610 template<>
struct FourthDensePt< 0, 1, 0> {
enum { idx = 8 }; };
611 template<>
struct FourthDensePt< 1, 1, 0> {
enum { idx = 9 }; };
612 template<>
struct FourthDensePt< 2, 1, 0> {
enum { idx = 10 }; };
614 template<>
struct FourthDensePt<-2, 0, 0> {
enum { idx = 11 }; };
615 template<>
struct FourthDensePt<-1, 0, 0> {
enum { idx = 12 }; };
616 template<>
struct FourthDensePt< 1, 0, 0> {
enum { idx = 13 }; };
617 template<>
struct FourthDensePt< 2, 0, 0> {
enum { idx = 14 }; };
619 template<>
struct FourthDensePt<-2,-1, 0> {
enum { idx = 15 }; };
620 template<>
struct FourthDensePt<-1,-1, 0> {
enum { idx = 16 }; };
621 template<>
struct FourthDensePt< 0,-1, 0> {
enum { idx = 17 }; };
622 template<>
struct FourthDensePt< 1,-1, 0> {
enum { idx = 18 }; };
623 template<>
struct FourthDensePt< 2,-1, 0> {
enum { idx = 19 }; };
625 template<>
struct FourthDensePt<-2,-2, 0> {
enum { idx = 20 }; };
626 template<>
struct FourthDensePt<-1,-2, 0> {
enum { idx = 21 }; };
627 template<>
struct FourthDensePt< 0,-2, 0> {
enum { idx = 22 }; };
628 template<>
struct FourthDensePt< 1,-2, 0> {
enum { idx = 23 }; };
629 template<>
struct FourthDensePt< 2,-2, 0> {
enum { idx = 24 }; };
632 template<>
struct FourthDensePt<-2, 0, 2> {
enum { idx = 25 }; };
633 template<>
struct FourthDensePt<-1, 0, 2> {
enum { idx = 26 }; };
634 template<>
struct FourthDensePt< 0, 0, 2> {
enum { idx = 27 }; };
635 template<>
struct FourthDensePt< 1, 0, 2> {
enum { idx = 28 }; };
636 template<>
struct FourthDensePt< 2, 0, 2> {
enum { idx = 29 }; };
638 template<>
struct FourthDensePt<-2, 0, 1> {
enum { idx = 30 }; };
639 template<>
struct FourthDensePt<-1, 0, 1> {
enum { idx = 31 }; };
640 template<>
struct FourthDensePt< 0, 0, 1> {
enum { idx = 32 }; };
641 template<>
struct FourthDensePt< 1, 0, 1> {
enum { idx = 33 }; };
642 template<>
struct FourthDensePt< 2, 0, 1> {
enum { idx = 34 }; };
644 template<>
struct FourthDensePt<-2, 0,-1> {
enum { idx = 35 }; };
645 template<>
struct FourthDensePt<-1, 0,-1> {
enum { idx = 36 }; };
646 template<>
struct FourthDensePt< 0, 0,-1> {
enum { idx = 37 }; };
647 template<>
struct FourthDensePt< 1, 0,-1> {
enum { idx = 38 }; };
648 template<>
struct FourthDensePt< 2, 0,-1> {
enum { idx = 39 }; };
650 template<>
struct FourthDensePt<-2, 0,-2> {
enum { idx = 40 }; };
651 template<>
struct FourthDensePt<-1, 0,-2> {
enum { idx = 41 }; };
652 template<>
struct FourthDensePt< 0, 0,-2> {
enum { idx = 42 }; };
653 template<>
struct FourthDensePt< 1, 0,-2> {
enum { idx = 43 }; };
654 template<>
struct FourthDensePt< 2, 0,-2> {
enum { idx = 44 }; };
657 template<>
struct FourthDensePt< 0,-2, 2> {
enum { idx = 45 }; };
658 template<>
struct FourthDensePt< 0,-1, 2> {
enum { idx = 46 }; };
659 template<>
struct FourthDensePt< 0, 1, 2> {
enum { idx = 47 }; };
660 template<>
struct FourthDensePt< 0, 2, 2> {
enum { idx = 48 }; };
662 template<>
struct FourthDensePt< 0,-2, 1> {
enum { idx = 49 }; };
663 template<>
struct FourthDensePt< 0,-1, 1> {
enum { idx = 50 }; };
664 template<>
struct FourthDensePt< 0, 1, 1> {
enum { idx = 51 }; };
665 template<>
struct FourthDensePt< 0, 2, 1> {
enum { idx = 52 }; };
667 template<>
struct FourthDensePt< 0,-2,-1> {
enum { idx = 53 }; };
668 template<>
struct FourthDensePt< 0,-1,-1> {
enum { idx = 54 }; };
669 template<>
struct FourthDensePt< 0, 1,-1> {
enum { idx = 55 }; };
670 template<>
struct FourthDensePt< 0, 2,-1> {
enum { idx = 56 }; };
672 template<>
struct FourthDensePt< 0,-2,-2> {
enum { idx = 57 }; };
673 template<>
struct FourthDensePt< 0,-1,-2> {
enum { idx = 58 }; };
674 template<>
struct FourthDensePt< 0, 1,-2> {
enum { idx = 59 }; };
675 template<>
struct FourthDensePt< 0, 2,-2> {
enum { idx = 60 }; };
680 template<
typename Gr
idT,
bool IsSafe = true>
682 :
public BaseStencil<FourthOrderDenseStencil<GridT, IsSafe>, GridT, IsSafe>
696 template<
int i,
int j,
int k>
697 unsigned int pos()
const {
return FourthDensePt<i,j,k>::idx; }
700 inline void init(
const Coord& ijk)
789 template<
int i,
int j,
int k>
struct NineteenPt {};
790 template<>
struct NineteenPt< 0, 0, 0> {
enum { idx = 0 }; };
792 template<>
struct NineteenPt< 1, 0, 0> {
enum { idx = 1 }; };
793 template<>
struct NineteenPt< 0, 1, 0> {
enum { idx = 2 }; };
794 template<>
struct NineteenPt< 0, 0, 1> {
enum { idx = 3 }; };
796 template<>
struct NineteenPt<-1, 0, 0> {
enum { idx = 4 }; };
797 template<>
struct NineteenPt< 0,-1, 0> {
enum { idx = 5 }; };
798 template<>
struct NineteenPt< 0, 0,-1> {
enum { idx = 6 }; };
800 template<>
struct NineteenPt< 2, 0, 0> {
enum { idx = 7 }; };
801 template<>
struct NineteenPt< 0, 2, 0> {
enum { idx = 8 }; };
802 template<>
struct NineteenPt< 0, 0, 2> {
enum { idx = 9 }; };
804 template<>
struct NineteenPt<-2, 0, 0> {
enum { idx = 10 }; };
805 template<>
struct NineteenPt< 0,-2, 0> {
enum { idx = 11 }; };
806 template<>
struct NineteenPt< 0, 0,-2> {
enum { idx = 12 }; };
808 template<>
struct NineteenPt< 3, 0, 0> {
enum { idx = 13 }; };
809 template<>
struct NineteenPt< 0, 3, 0> {
enum { idx = 14 }; };
810 template<>
struct NineteenPt< 0, 0, 3> {
enum { idx = 15 }; };
812 template<>
struct NineteenPt<-3, 0, 0> {
enum { idx = 16 }; };
813 template<>
struct NineteenPt< 0,-3, 0> {
enum { idx = 17 }; };
814 template<>
struct NineteenPt< 0, 0,-3> {
enum { idx = 18 }; };
819 template<
typename Gr
idT,
bool IsSafe = true>
821 :
public BaseStencil<NineteenPointStencil<GridT, IsSafe>, GridT, IsSafe>
835 template<
int i,
int j,
int k>
836 unsigned int pos()
const {
return NineteenPt<i,j,k>::idx; }
839 inline void init(
const Coord& ijk)
875 template<
int i,
int j,
int k>
struct SixthDensePt { };
876 template<>
struct SixthDensePt< 0, 0, 0> {
enum { idx = 0 }; };
878 template<>
struct SixthDensePt<-3, 3, 0> {
enum { idx = 1 }; };
879 template<>
struct SixthDensePt<-2, 3, 0> {
enum { idx = 2 }; };
880 template<>
struct SixthDensePt<-1, 3, 0> {
enum { idx = 3 }; };
881 template<>
struct SixthDensePt< 0, 3, 0> {
enum { idx = 4 }; };
882 template<>
struct SixthDensePt< 1, 3, 0> {
enum { idx = 5 }; };
883 template<>
struct SixthDensePt< 2, 3, 0> {
enum { idx = 6 }; };
884 template<>
struct SixthDensePt< 3, 3, 0> {
enum { idx = 7 }; };
886 template<>
struct SixthDensePt<-3, 2, 0> {
enum { idx = 8 }; };
887 template<>
struct SixthDensePt<-2, 2, 0> {
enum { idx = 9 }; };
888 template<>
struct SixthDensePt<-1, 2, 0> {
enum { idx = 10 }; };
889 template<>
struct SixthDensePt< 0, 2, 0> {
enum { idx = 11 }; };
890 template<>
struct SixthDensePt< 1, 2, 0> {
enum { idx = 12 }; };
891 template<>
struct SixthDensePt< 2, 2, 0> {
enum { idx = 13 }; };
892 template<>
struct SixthDensePt< 3, 2, 0> {
enum { idx = 14 }; };
894 template<>
struct SixthDensePt<-3, 1, 0> {
enum { idx = 15 }; };
895 template<>
struct SixthDensePt<-2, 1, 0> {
enum { idx = 16 }; };
896 template<>
struct SixthDensePt<-1, 1, 0> {
enum { idx = 17 }; };
897 template<>
struct SixthDensePt< 0, 1, 0> {
enum { idx = 18 }; };
898 template<>
struct SixthDensePt< 1, 1, 0> {
enum { idx = 19 }; };
899 template<>
struct SixthDensePt< 2, 1, 0> {
enum { idx = 20 }; };
900 template<>
struct SixthDensePt< 3, 1, 0> {
enum { idx = 21 }; };
902 template<>
struct SixthDensePt<-3, 0, 0> {
enum { idx = 22 }; };
903 template<>
struct SixthDensePt<-2, 0, 0> {
enum { idx = 23 }; };
904 template<>
struct SixthDensePt<-1, 0, 0> {
enum { idx = 24 }; };
905 template<>
struct SixthDensePt< 1, 0, 0> {
enum { idx = 25 }; };
906 template<>
struct SixthDensePt< 2, 0, 0> {
enum { idx = 26 }; };
907 template<>
struct SixthDensePt< 3, 0, 0> {
enum { idx = 27 }; };
910 template<>
struct SixthDensePt<-3,-1, 0> {
enum { idx = 28 }; };
911 template<>
struct SixthDensePt<-2,-1, 0> {
enum { idx = 29 }; };
912 template<>
struct SixthDensePt<-1,-1, 0> {
enum { idx = 30 }; };
913 template<>
struct SixthDensePt< 0,-1, 0> {
enum { idx = 31 }; };
914 template<>
struct SixthDensePt< 1,-1, 0> {
enum { idx = 32 }; };
915 template<>
struct SixthDensePt< 2,-1, 0> {
enum { idx = 33 }; };
916 template<>
struct SixthDensePt< 3,-1, 0> {
enum { idx = 34 }; };
919 template<>
struct SixthDensePt<-3,-2, 0> {
enum { idx = 35 }; };
920 template<>
struct SixthDensePt<-2,-2, 0> {
enum { idx = 36 }; };
921 template<>
struct SixthDensePt<-1,-2, 0> {
enum { idx = 37 }; };
922 template<>
struct SixthDensePt< 0,-2, 0> {
enum { idx = 38 }; };
923 template<>
struct SixthDensePt< 1,-2, 0> {
enum { idx = 39 }; };
924 template<>
struct SixthDensePt< 2,-2, 0> {
enum { idx = 40 }; };
925 template<>
struct SixthDensePt< 3,-2, 0> {
enum { idx = 41 }; };
928 template<>
struct SixthDensePt<-3,-3, 0> {
enum { idx = 42 }; };
929 template<>
struct SixthDensePt<-2,-3, 0> {
enum { idx = 43 }; };
930 template<>
struct SixthDensePt<-1,-3, 0> {
enum { idx = 44 }; };
931 template<>
struct SixthDensePt< 0,-3, 0> {
enum { idx = 45 }; };
932 template<>
struct SixthDensePt< 1,-3, 0> {
enum { idx = 46 }; };
933 template<>
struct SixthDensePt< 2,-3, 0> {
enum { idx = 47 }; };
934 template<>
struct SixthDensePt< 3,-3, 0> {
enum { idx = 48 }; };
937 template<>
struct SixthDensePt<-3, 0, 3> {
enum { idx = 49 }; };
938 template<>
struct SixthDensePt<-2, 0, 3> {
enum { idx = 50 }; };
939 template<>
struct SixthDensePt<-1, 0, 3> {
enum { idx = 51 }; };
940 template<>
struct SixthDensePt< 0, 0, 3> {
enum { idx = 52 }; };
941 template<>
struct SixthDensePt< 1, 0, 3> {
enum { idx = 53 }; };
942 template<>
struct SixthDensePt< 2, 0, 3> {
enum { idx = 54 }; };
943 template<>
struct SixthDensePt< 3, 0, 3> {
enum { idx = 55 }; };
946 template<>
struct SixthDensePt<-3, 0, 2> {
enum { idx = 56 }; };
947 template<>
struct SixthDensePt<-2, 0, 2> {
enum { idx = 57 }; };
948 template<>
struct SixthDensePt<-1, 0, 2> {
enum { idx = 58 }; };
949 template<>
struct SixthDensePt< 0, 0, 2> {
enum { idx = 59 }; };
950 template<>
struct SixthDensePt< 1, 0, 2> {
enum { idx = 60 }; };
951 template<>
struct SixthDensePt< 2, 0, 2> {
enum { idx = 61 }; };
952 template<>
struct SixthDensePt< 3, 0, 2> {
enum { idx = 62 }; };
954 template<>
struct SixthDensePt<-3, 0, 1> {
enum { idx = 63 }; };
955 template<>
struct SixthDensePt<-2, 0, 1> {
enum { idx = 64 }; };
956 template<>
struct SixthDensePt<-1, 0, 1> {
enum { idx = 65 }; };
957 template<>
struct SixthDensePt< 0, 0, 1> {
enum { idx = 66 }; };
958 template<>
struct SixthDensePt< 1, 0, 1> {
enum { idx = 67 }; };
959 template<>
struct SixthDensePt< 2, 0, 1> {
enum { idx = 68 }; };
960 template<>
struct SixthDensePt< 3, 0, 1> {
enum { idx = 69 }; };
963 template<>
struct SixthDensePt<-3, 0,-1> {
enum { idx = 70 }; };
964 template<>
struct SixthDensePt<-2, 0,-1> {
enum { idx = 71 }; };
965 template<>
struct SixthDensePt<-1, 0,-1> {
enum { idx = 72 }; };
966 template<>
struct SixthDensePt< 0, 0,-1> {
enum { idx = 73 }; };
967 template<>
struct SixthDensePt< 1, 0,-1> {
enum { idx = 74 }; };
968 template<>
struct SixthDensePt< 2, 0,-1> {
enum { idx = 75 }; };
969 template<>
struct SixthDensePt< 3, 0,-1> {
enum { idx = 76 }; };
972 template<>
struct SixthDensePt<-3, 0,-2> {
enum { idx = 77 }; };
973 template<>
struct SixthDensePt<-2, 0,-2> {
enum { idx = 78 }; };
974 template<>
struct SixthDensePt<-1, 0,-2> {
enum { idx = 79 }; };
975 template<>
struct SixthDensePt< 0, 0,-2> {
enum { idx = 80 }; };
976 template<>
struct SixthDensePt< 1, 0,-2> {
enum { idx = 81 }; };
977 template<>
struct SixthDensePt< 2, 0,-2> {
enum { idx = 82 }; };
978 template<>
struct SixthDensePt< 3, 0,-2> {
enum { idx = 83 }; };
981 template<>
struct SixthDensePt<-3, 0,-3> {
enum { idx = 84 }; };
982 template<>
struct SixthDensePt<-2, 0,-3> {
enum { idx = 85 }; };
983 template<>
struct SixthDensePt<-1, 0,-3> {
enum { idx = 86 }; };
984 template<>
struct SixthDensePt< 0, 0,-3> {
enum { idx = 87 }; };
985 template<>
struct SixthDensePt< 1, 0,-3> {
enum { idx = 88 }; };
986 template<>
struct SixthDensePt< 2, 0,-3> {
enum { idx = 89 }; };
987 template<>
struct SixthDensePt< 3, 0,-3> {
enum { idx = 90 }; };
990 template<>
struct SixthDensePt< 0,-3, 3> {
enum { idx = 91 }; };
991 template<>
struct SixthDensePt< 0,-2, 3> {
enum { idx = 92 }; };
992 template<>
struct SixthDensePt< 0,-1, 3> {
enum { idx = 93 }; };
993 template<>
struct SixthDensePt< 0, 1, 3> {
enum { idx = 94 }; };
994 template<>
struct SixthDensePt< 0, 2, 3> {
enum { idx = 95 }; };
995 template<>
struct SixthDensePt< 0, 3, 3> {
enum { idx = 96 }; };
997 template<>
struct SixthDensePt< 0,-3, 2> {
enum { idx = 97 }; };
998 template<>
struct SixthDensePt< 0,-2, 2> {
enum { idx = 98 }; };
999 template<>
struct SixthDensePt< 0,-1, 2> {
enum { idx = 99 }; };
1000 template<>
struct SixthDensePt< 0, 1, 2> {
enum { idx = 100 }; };
1001 template<>
struct SixthDensePt< 0, 2, 2> {
enum { idx = 101 }; };
1002 template<>
struct SixthDensePt< 0, 3, 2> {
enum { idx = 102 }; };
1004 template<>
struct SixthDensePt< 0,-3, 1> {
enum { idx = 103 }; };
1005 template<>
struct SixthDensePt< 0,-2, 1> {
enum { idx = 104 }; };
1006 template<>
struct SixthDensePt< 0,-1, 1> {
enum { idx = 105 }; };
1007 template<>
struct SixthDensePt< 0, 1, 1> {
enum { idx = 106 }; };
1008 template<>
struct SixthDensePt< 0, 2, 1> {
enum { idx = 107 }; };
1009 template<>
struct SixthDensePt< 0, 3, 1> {
enum { idx = 108 }; };
1011 template<>
struct SixthDensePt< 0,-3,-1> {
enum { idx = 109 }; };
1012 template<>
struct SixthDensePt< 0,-2,-1> {
enum { idx = 110 }; };
1013 template<>
struct SixthDensePt< 0,-1,-1> {
enum { idx = 111 }; };
1014 template<>
struct SixthDensePt< 0, 1,-1> {
enum { idx = 112 }; };
1015 template<>
struct SixthDensePt< 0, 2,-1> {
enum { idx = 113 }; };
1016 template<>
struct SixthDensePt< 0, 3,-1> {
enum { idx = 114 }; };
1018 template<>
struct SixthDensePt< 0,-3,-2> {
enum { idx = 115 }; };
1019 template<>
struct SixthDensePt< 0,-2,-2> {
enum { idx = 116 }; };
1020 template<>
struct SixthDensePt< 0,-1,-2> {
enum { idx = 117 }; };
1021 template<>
struct SixthDensePt< 0, 1,-2> {
enum { idx = 118 }; };
1022 template<>
struct SixthDensePt< 0, 2,-2> {
enum { idx = 119 }; };
1023 template<>
struct SixthDensePt< 0, 3,-2> {
enum { idx = 120 }; };
1025 template<>
struct SixthDensePt< 0,-3,-3> {
enum { idx = 121 }; };
1026 template<>
struct SixthDensePt< 0,-2,-3> {
enum { idx = 122 }; };
1027 template<>
struct SixthDensePt< 0,-1,-3> {
enum { idx = 123 }; };
1028 template<>
struct SixthDensePt< 0, 1,-3> {
enum { idx = 124 }; };
1029 template<>
struct SixthDensePt< 0, 2,-3> {
enum { idx = 125 }; };
1030 template<>
struct SixthDensePt< 0, 3,-3> {
enum { idx = 126 }; };
1035 template<
typename Gr
idT,
bool IsSafe = true>
1037 :
public BaseStencil<SixthOrderDenseStencil<GridT, IsSafe>, GridT, IsSafe>
1051 template<
int i,
int j,
int k>
1052 unsigned int pos()
const {
return SixthDensePt<i,j,k>::idx; }
1055 inline void init(
const Coord& ijk)
1214 template<
int i,
int j,
int k>
struct GradPt {};
1215 template<>
struct GradPt< 0, 0, 0> {
enum { idx = 0 }; };
1216 template<>
struct GradPt< 1, 0, 0> {
enum { idx = 2 }; };
1217 template<>
struct GradPt< 0, 1, 0> {
enum { idx = 4 }; };
1218 template<>
struct GradPt< 0, 0, 1> {
enum { idx = 6 }; };
1219 template<>
struct GradPt<-1, 0, 0> {
enum { idx = 1 }; };
1220 template<>
struct GradPt< 0,-1, 0> {
enum { idx = 3 }; };
1221 template<>
struct GradPt< 0, 0,-1> {
enum { idx = 5 }; };
1230 template<
typename Gr
idT,
bool IsSafe = true>
1244 , mInv2Dx(
ValueType(0.5 / grid.voxelSize()[0]))
1245 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
1252 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
1280 mValues[4] - mValues[3],
1281 mValues[6] - mValues[5])*mInv2Dx;
1291 V[1]>0 ? mValues[0] - mValues[3] : mValues[4] - mValues[0],
1292 V[2]>0 ? mValues[0] - mValues[5] : mValues[6] - mValues[0])*2*mInv2Dx;
1309 return (v[0]>0 ? (v[1]<0 || v[2]<0 || v[3]<0 || v[4]<0 || v[5]<0 || v[6]<0)
1310 : (v[1]>0 || v[2]>0 || v[3]>0 || v[4]>0 || v[5]>0 || v[6]>0));
1333 template<
int i,
int j,
int k>
1334 unsigned int pos()
const {
return GradPt<i,j,k>::idx; }
1338 inline void init(
const Coord& ijk)
1340 BaseType::template setValue<-1, 0, 0>(
mAcc.
getValue(ijk.offsetBy(-1, 0, 0)));
1341 BaseType::template setValue< 1, 0, 0>(
mAcc.
getValue(ijk.offsetBy( 1, 0, 0)));
1343 BaseType::template setValue< 0,-1, 0>(
mAcc.
getValue(ijk.offsetBy( 0,-1, 0)));
1344 BaseType::template setValue< 0, 1, 0>(
mAcc.
getValue(ijk.offsetBy( 0, 1, 0)));
1346 BaseType::template setValue< 0, 0,-1>(
mAcc.
getValue(ijk.offsetBy( 0, 0,-1)));
1347 BaseType::template setValue< 0, 0, 1>(
mAcc.
getValue(ijk.offsetBy( 0, 0, 1)));
1364 template<
typename Gr
idT,
bool IsSafe = true>
1379 , mInv2Dx(
ValueType(0.5 / grid.voxelSize()[0]))
1381 , mDx2(static_cast<
float>(_mDx2))
1390 , mDx2(static_cast<
float>(_mDx2))
1405 v1(v[2]-v[1], v[ 8]-v[ 7], v[14]-v[13], 0),
1406 v2(v[3]-v[2], v[ 9]-v[ 8], v[15]-v[14], 0),
1407 v3(v[0]-v[3], v[ 0]-v[ 9], v[ 0]-v[15], 0),
1408 v4(v[4]-v[0], v[10]-v[ 0], v[16]-v[ 0], 0),
1409 v5(v[5]-v[4], v[11]-v[10], v[17]-v[16], 0),
1410 v6(v[6]-v[5], v[12]-v[11], v[18]-v[17], 0),
1417 dP_xm =
math::WENO5(v[ 2]-v[ 1],v[ 3]-v[ 2],v[ 0]-v[ 3],v[ 4]-v[ 0],v[ 5]-v[ 4],mDx2),
1418 dP_xp =
math::WENO5(v[ 6]-v[ 5],v[ 5]-v[ 4],v[ 4]-v[ 0],v[ 0]-v[ 3],v[ 3]-v[ 2],mDx2),
1419 dP_ym =
math::WENO5(v[ 8]-v[ 7],v[ 9]-v[ 8],v[ 0]-v[ 9],v[10]-v[ 0],v[11]-v[10],mDx2),
1420 dP_yp =
math::WENO5(v[12]-v[11],v[11]-v[10],v[10]-v[ 0],v[ 0]-v[ 9],v[ 9]-v[ 8],mDx2),
1421 dP_zm =
math::WENO5(v[14]-v[13],v[15]-v[14],v[ 0]-v[15],v[16]-v[ 0],v[17]-v[16],mDx2),
1422 dP_zp =
math::WENO5(v[18]-v[17],v[17]-v[16],v[16]-v[ 0],v[ 0]-v[15],v[15]-v[14],mDx2);
1437 V[0]>0 ?
math::WENO5(v[ 2]-v[ 1],v[ 3]-v[ 2],v[ 0]-v[ 3], v[ 4]-v[ 0],v[ 5]-v[ 4],mDx2)
1438 :
math::WENO5(v[ 6]-v[ 5],v[ 5]-v[ 4],v[ 4]-v[ 0], v[ 0]-v[ 3],v[ 3]-v[ 2],mDx2),
1439 V[1]>0 ?
math::WENO5(v[ 8]-v[ 7],v[ 9]-v[ 8],v[ 0]-v[ 9], v[10]-v[ 0],v[11]-v[10],mDx2)
1440 :
math::WENO5(v[12]-v[11],v[11]-v[10],v[10]-v[ 0], v[ 0]-v[ 9],v[ 9]-v[ 8],mDx2),
1441 V[2]>0 ?
math::WENO5(v[14]-v[13],v[15]-v[14],v[ 0]-v[15], v[16]-v[ 0],v[17]-v[16],mDx2)
1442 :
math::WENO5(v[18]-v[17],v[17]-v[16],v[16]-v[ 0], v[ 0]-v[15],v[15]-v[14],mDx2));
1452 mValues[10] - mValues[ 9],
1453 mValues[16] - mValues[15]);
1474 return (v[ 0]>0 ? (v[ 3]<0 || v[ 4]<0 || v[ 9]<0 || v[10]<0 || v[15]<0 || v[16]<0)
1475 : (v[ 3]>0 || v[ 4]>0 || v[ 9]>0 || v[10]>0 || v[15]>0 || v[16]>0));
1479 inline void init(
const Coord& ijk)
1506 const ValueType _mDx2, mInv2Dx, mInvDx2;
1514 template<
typename Gr
idT,
bool IsSafe = true>
1528 , mInv2Dx(
ValueType(0.5 / grid.voxelSize()[0]))
1529 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
1536 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
1569 Real alphaM, alphaG, normGrad;
1570 if (this->
curvatures(alphaM, alphaG, normGrad)) {
1610 Real alphaM, alphaG, normGrad;
1611 if (this->
curvatures(alphaM, alphaG, normGrad)) {
1626 std::pair<ValueType, ValueType> pair(0, 0);
1627 Real alphaM, alphaG, normGrad;
1628 if (this->
curvatures(alphaM, alphaG, normGrad)) {
1659 mValues[4] - mValues[3],
1660 mValues[6] - mValues[5])*mInv2Dx;
1664 inline void init(
const Coord &ijk)
1704 const Real Dx = this->Dx(), Dy = this->Dy(), Dz = this->Dz(),
1705 Dx2 = Dx*Dx, Dy2 = Dy*Dy, Dz2 = Dz*Dz, normGrad2 = Dx2 + Dy2 + Dz2;
1707 alpha = normGrad = 0;
1710 const Real Dxx = this->Dxx(), Dyy = this->Dyy(), Dzz = this->Dzz();
1711 alpha = Dx2*(Dyy + Dzz) + Dy2*(Dxx + Dzz) + Dz2*(Dxx + Dyy) -
1712 2*(Dx*(Dy*this->Dxy() + Dz*this->Dxz()) + Dy*Dz*this->Dyz());
1720 const Real Dx = this->Dx(), Dy = this->Dy(), Dz = this->Dz(),
1721 Dx2 = Dx*Dx, Dy2 = Dy*Dy, Dz2 = Dz*Dz, normGrad2 = Dx2 + Dy2 + Dz2;
1723 alpha = normGrad = 0;
1726 const Real Dxx = this->Dxx(), Dyy = this->Dyy(), Dzz = this->Dzz(),
1727 Dxy = this->Dxy(), Dxz = this->Dxz(), Dyz = this->Dyz();
1728 alpha = Dx2*(Dyy*Dzz - Dyz*Dyz) + Dy2*(Dxx*Dzz - Dxz*Dxz) + Dz2*(Dxx*Dyy - Dxy*Dxy) +
1729 2*( Dy*Dz*(Dxy*Dxz - Dyz*Dxx) + Dx*Dz*(Dxy*Dyz - Dxz*Dyy) + Dx*Dy*(Dxz*Dyz - Dxy*Dzz) );
1736 const Real Dx = this->Dx(), Dy = this->Dy(), Dz = this->Dz(),
1737 Dx2 = Dx*Dx, Dy2 = Dy*Dy, Dz2 = Dz*Dz, normGrad2 = Dx2 + Dy2 + Dz2;
1739 alphaM = alphaG =normGrad = 0;
1742 const Real Dxx = this->Dxx(), Dyy = this->Dyy(), Dzz = this->Dzz(),
1743 Dxy = this->Dxy(), Dxz = this->Dxz(), Dyz = this->Dyz();
1744 alphaM = Dx2*(Dyy + Dzz) + Dy2*(Dxx + Dzz) + Dz2*(Dxx + Dyy) -
1745 2*(Dx*(Dy*Dxy + Dz*Dxz) + Dy*Dz*Dyz);
1746 alphaG = Dx2*(Dyy*Dzz - Dyz*Dyz) + Dy2*(Dxx*Dzz - Dxz*Dxz) + Dz2*(Dxx*Dyy - Dxy*Dxy) +
1747 2*( Dy*Dz*(Dxy*Dxz - Dyz*Dxx) + Dx*Dz*(Dxy*Dyz - Dxz*Dyy) + Dx*Dy*(Dxz*Dyz - Dxy*Dzz) );
1763 template<
typename Gr
idT,
bool IsSafe = true>
1775 , mHalfWidth(halfWidth)
1777 assert(halfWidth>0);
1791 template<
typename IterType>
1801 inline void init(
const Coord& ijk)
1804 for (
Coord p=ijk.offsetBy(-mHalfWidth),
q=ijk.offsetBy(mHalfWidth); p[0] <=
q[0]; ++p[0]) {
1805 for (p[1] = ijk[1]-mHalfWidth; p[1] <=
q[1]; ++p[1]) {
1806 for (p[2] = ijk[2]-mHalfWidth; p[2] <=
q[2]; ++p[2]) {
1816 const int mHalfWidth;
1824 #endif // OPENVDB_MATH_STENCILS_HAS_BEEN_INCLUDED
const Coord & getCenterCoord() const
Return the coordinates of the center point of the stencil.
const ValueType & getCenterValue() const
Return the value at the center of the stencil.
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
tree::ValueAccessor< const TreeType, IsSafe > AccessorType
NineteenPointStencil(const GridType &grid)
int size()
Return the size of the stencil buffer.
void moveTo(const IterType &iter)
Initialize the stencil buffer with the values of voxel (x, y, z) and its neighbors.
ValueType laplacian() const
Type Pow2(Type x)
Return x2.
IMATH_HOSTDEVICE constexpr int floor(T x) IMATH_NOEXCEPT
bool intersects(const ValueType &isoValue=zeroVal< ValueType >()) const
Return true if the center of the stencil intersects the iso-contour specified by the isoValue...
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
std::vector< ValueType > BufferType
GLsizei const GLfloat * value
WenoStencil(const GridType &grid)
vfloat4 sqrt(const vfloat4 &a)
const ValueType & getValue() const
Return the value at the specified location relative to the center of the stencil. ...
ValueType median() const
Return the median value of the current stencil.
GridType::ValueType ValueType
DenseStencil(const GridType &grid, int halfWidth)
bool zeroCrossing() const
ValueType gaussianCurvature() const
Return the Gaussian curvature at the previously buffered location.
SevenPointStencil(const GridT &grid)
#define OPENVDB_USE_VERSION_NAMESPACE
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
ValueType meanCurvature() const
Return the mean curvature at the previously buffered location.
ValueType max() const
Return the largest value in the stencil buffer.
The Value Accessor Implementation and API methods. The majoirty of the API matches the API of a compa...
ThirteenPointStencil(const GridType &grid)
BoxStencil(const GridType &grid)
math::Vec3< ValueType > gradient() const
GLfloat GLfloat GLfloat v2
SixthOrderDenseStencil(const GridType &grid)
GLdouble GLdouble GLdouble q
Signed (x, y, z) 32-bit integer coordinates.
GLfloat GLfloat GLfloat GLfloat v3
GridT::ValueType ValueType
math::Vec3< ValueType > gradient(const math::Vec3< ValueType > &xyz) const
Return the gradient in world space of the trilinear interpolation kernel.
const AccessorType & accessor() const
Return a const reference to the ValueAccessor associated with this Stencil.
GridType::ValueType ValueType
GridType::ValueType ValueType
FourthOrderDenseStencil(const GridType &grid)
ValueType normSqGrad(const ValueType &isoValue=zeroVal< ValueType >()) const
Return the norm-square of the WENO upwind gradient (computed via WENO upwinding and Godunov's scheme)...
ValueType normSqGrad() const
Return the norm square of the single-sided upwind gradient (computed via Godunov's scheme) at the pre...
math::Vec3< ValueType > gradient(const math::Vec3< ValueType > &V) const
GridT::ValueType ValueType
ValueType laplacian() const
ValueType gaussianCurvatureNormGrad() const
IMATH_NAMESPACE::V2f float
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
ValueAccessors are designed to help accelerate accesses into the OpenVDB Tree structures by storing c...
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
GridType::ValueType ValueType
void moveTo(const IterType &iter)
Initialize the stencil buffer with the values of voxel (x, y, z) and its neighbors.
I min_element(I begin, I end, const Pred &pred)
Type Pow4(Type x)
Return x4.
GridT::ValueType ValueType
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
GradStencil(const GridType &grid, Real dx)
GradStencil(const GridType &grid)
Type Pow3(Type x)
Return x3.
GLfloat GLfloat GLfloat alpha
void moveTo(const Coord &ijk)
Initialize the stencil buffer with the values of voxel (i, j, k) and its neighbors.
ValueType laplacian() const
void curvaturesNormGrad(ValueType &mean, ValueType &gauss) const
Return both the mean and the Gaussian curvature at the previously buffered location.
const ValueType & getCenterValue() const
math::Vec3< ValueType > cpt()
Compute the closest-point transform to a level set.
BaseStencil(const GridType &grid, int size)
math::Vec3< ValueType > gradient(const math::Vec3< ValueType > &V) const
Return the first-order upwind gradient corresponding to the direction V.
bool intersects(const ValueType &isoValue=zeroVal< ValueType >()) const
Return true if the center of the stencil intersects the.
ValueType interpolation(const math::Vec3< ValueType > &xyz) const
Return the trilinear interpolation at the normalized position.
ValueType mean() const
Return the mean value of the current stencil.
const GridType & grid() const
Return a const reference to the grid from which this stencil was constructed.
bool zeroCrossing() const
GridT::ValueType ValueType
void moveTo(const Coord &ijk, const ValueType ¢erValue)
Initialize the stencil buffer with the values of voxel (i, j, k) and its neighbors. The method also takes a value of the center element of the stencil, assuming it is already known.
CurvatureStencil(const GridType &grid)
void moveTo(const Vec3< RealType > &xyz)
Initialize the stencil buffer with the values of voxel (x, y, z) and its neighbors.
void moveTo(const Coord &ijk)
Initialize the stencil buffer with the values of voxel (x, y, z) and its neighbors.
SecondOrderDenseStencil(const GridType &grid)
This is a special 19-point stencil that supports optimal fifth-order WENO upwinding, second-order central differencing, Laplacian, and zero-crossing test.
WenoStencil(const GridType &grid, Real dx)
void setValue(const ValueType &value)
Set the value at the specified location relative to the center of the stencil.
ValueType meanCurvatureNormGrad() const
CurvatureStencil(const GridType &grid, Real dx)
const ValueType & getValue(unsigned int pos=0) const
Return the value from the stencil buffer with linear offset pos.
GLubyte GLubyte GLubyte GLubyte w
GridType::ValueType ValueType
GridType::ValueType ValueType
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
ValueType min() const
Return the smallest value in the stencil buffer.
GridType::ValueType ValueType
std::bitset< 6 > intersectionMask(const ValueType &isoValue=zeroVal< ValueType >()) const
Return true a bit-mask where the 6 bits indicates if the center of the stencil intersects the iso-con...
math::Vec3< ValueType > gradient() const
const ValueType & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
math::Vec3< ValueType > gradient() const
Return the gradient computed at the previously buffered location by second order central differencing...
GridType::ValueType ValueType
void curvatures(ValueType &mean, ValueType &gauss) const
Return both the mean and the Gaussian curvature at the previously buffered location.
std::pair< ValueType, ValueType > principalCurvatures() const
Return the pair (minimum, maximum) principal curvature at the previously buffered location...
Dense stencil of a given width.
Real GodunovsNormSqrd(bool isOutside, Real dP_xm, Real dP_xp, Real dP_ym, Real dP_yp, Real dP_zm, Real dP_zp)
ValueType WENO5(const ValueType &v1, const ValueType &v2, const ValueType &v3, const ValueType &v4, const ValueType &v5, float scale2=0.01f)
Implementation of nominally fifth-order finite-difference WENO.