15#ifndef NANOVDB_STENCILS_HAS_BEEN_INCLUDED
16#define NANOVDB_STENCILS_HAS_BEEN_INCLUDED
18#include "../NanoVDB.h"
33template<
typename ValueType,
typename RealT = ValueType>
42 static const RealT C = 13.0 / 12.0;
47 const RealT eps = RealT(1.0e-6) *
scale2;
53 return static_cast<ValueType
>((
A1*(2*
v1 - 7*
v2 + 11*
v3) +
60template <
typename RealT>
80template<
typename RealT>
95template<
typename DerivedType,
int SIZE,
typename Gr
idT>
131 template<
typename IterType>
145 template<
typename RealType>
164 template<
int i,
int j,
int k>
171 template<
int i,
int j,
int k>
184 for (
int i = 0; i < SIZE; ++i) sum +=
mValues[i];
192 for (
int i=1; i<SIZE; ++i) {
202 for (
int i=1; i<SIZE; ++i) {
291 template<
int i,
int j,
int k>
struct BoxPt {};
292 template<>
struct BoxPt< 0, 0, 0> {
enum { idx = 0 }; };
293 template<>
struct BoxPt< 0, 0, 1> {
enum { idx = 1 }; };
294 template<>
struct BoxPt< 0, 1, 1> {
enum { idx = 2 }; };
295 template<>
struct BoxPt< 0, 1, 0> {
enum { idx = 3 }; };
296 template<>
struct BoxPt< 1, 0, 0> {
enum { idx = 4 }; };
297 template<>
struct BoxPt< 1, 0, 1> {
enum { idx = 5 }; };
298 template<>
struct BoxPt< 1, 1, 1> {
enum { idx = 6 }; };
299 template<>
struct BoxPt< 1, 1, 0> {
enum { idx = 7 }; };
303template<
typename Gr
idT>
318 template<
int i,
int j,
int k>
364 return C + (
D - C) * u;
400 A =
D[0] + (
D[1] -
D[0]) * v;
401 B =
D[2] + (
D[3] -
D[2]) * v;
409 grad[1] = A + (B - A) * u;
417 mValues[ 1] = mAcc.getValue(ijk.
offsetBy( 0, 0, 1));
418 mValues[ 2] = mAcc.getValue(ijk.
offsetBy( 0, 1, 1));
419 mValues[ 3] = mAcc.getValue(ijk.
offsetBy( 0, 1, 0));
420 mValues[ 4] = mAcc.getValue(ijk.
offsetBy( 1, 0, 0));
421 mValues[ 5] = mAcc.getValue(ijk.
offsetBy( 1, 0, 1));
422 mValues[ 6] = mAcc.getValue(ijk.
offsetBy( 1, 1, 1));
423 mValues[ 7] = mAcc.getValue(ijk.
offsetBy( 1, 1, 0));
437 template<
int i,
int j,
int k>
struct GradPt {};
438 template<>
struct GradPt< 0, 0, 0> {
enum { idx = 0 }; };
439 template<>
struct GradPt< 1, 0, 0> {
enum { idx = 2 }; };
440 template<>
struct GradPt< 0, 1, 0> {
enum { idx = 4 }; };
441 template<>
struct GradPt< 0, 0, 1> {
enum { idx = 6 }; };
442 template<>
struct GradPt<-1, 0, 0> {
enum { idx = 1 }; };
443 template<>
struct GradPt< 0,-1, 0> {
enum { idx = 3 }; };
444 template<>
struct GradPt< 0, 0,-1> {
enum { idx = 5 }; };
453template<
typename Gr
idT>
468 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
475 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
487 mValues[0] - mValues[1],
488 mValues[2] - mValues[0],
489 mValues[0] - mValues[3],
490 mValues[4] - mValues[0],
491 mValues[0] - mValues[5],
492 mValues[6] - mValues[0]);
503 mValues[4] - mValues[3],
504 mValues[6] - mValues[5])*mInv2Dx;
513 V[0]>0 ? mValues[0] - mValues[1] : mValues[2] - mValues[0],
514 V[1]>0 ? mValues[0] - mValues[3] : mValues[4] - mValues[0],
515 V[2]>0 ? mValues[0] - mValues[5] : mValues[6] - mValues[0])*2*mInv2Dx;
522 return mInvDx2 * (mValues[1] + mValues[2] +
523 mValues[3] + mValues[4] +
524 mValues[5] + mValues[6] - 6*mValues[0]);
531 return (mValues[0]>0 ? (mValues[1]<0 || mValues[2]<0 || mValues[3]<0 || mValues[4]<0 || mValues[5]<0 || mValues[6]<0)
532 : (mValues[1]>0 || mValues[2]>0 || mValues[3]>0 || mValues[4]>0 || mValues[5]>0 || mValues[6]>0));
547 ijk[1] - d*(mValues[4] - mValues[3]),
548 ijk[2] - d*(mValues[6] - mValues[5]));
553 template<
int i,
int j,
int k>
560 mValues[ 1] = mAcc.getValue(ijk.
offsetBy(-1, 0, 0));
561 mValues[ 2] = mAcc.getValue(ijk.
offsetBy( 1, 0, 0));
563 mValues[ 3] = mAcc.getValue(ijk.
offsetBy( 0,-1, 0));
564 mValues[ 4] = mAcc.getValue(ijk.
offsetBy( 0, 1, 0));
566 mValues[ 5] = mAcc.getValue(ijk.
offsetBy( 0, 0,-1));
567 mValues[ 6] = mAcc.getValue(ijk.
offsetBy( 0, 0, 1));
581 template<
int i,
int j,
int k>
struct WenoPt {};
582 template<>
struct WenoPt< 0, 0, 0> {
enum { idx = 0 }; };
584 template<>
struct WenoPt<-3, 0, 0> {
enum { idx = 1 }; };
585 template<>
struct WenoPt<-2, 0, 0> {
enum { idx = 2 }; };
586 template<>
struct WenoPt<-1, 0, 0> {
enum { idx = 3 }; };
587 template<>
struct WenoPt< 1, 0, 0> {
enum { idx = 4 }; };
588 template<>
struct WenoPt< 2, 0, 0> {
enum { idx = 5 }; };
589 template<>
struct WenoPt< 3, 0, 0> {
enum { idx = 6 }; };
591 template<>
struct WenoPt< 0,-3, 0> {
enum { idx = 7 }; };
592 template<>
struct WenoPt< 0,-2, 0> {
enum { idx = 8 }; };
593 template<>
struct WenoPt< 0,-1, 0> {
enum { idx = 9 }; };
594 template<>
struct WenoPt< 0, 1, 0> {
enum { idx =10 }; };
595 template<>
struct WenoPt< 0, 2, 0> {
enum { idx =11 }; };
596 template<>
struct WenoPt< 0, 3, 0> {
enum { idx =12 }; };
598 template<>
struct WenoPt< 0, 0,-3> {
enum { idx =13 }; };
599 template<>
struct WenoPt< 0, 0,-2> {
enum { idx =14 }; };
600 template<>
struct WenoPt< 0, 0,-1> {
enum { idx =15 }; };
601 template<>
struct WenoPt< 0, 0, 1> {
enum { idx =16 }; };
602 template<>
struct WenoPt< 0, 0, 2> {
enum { idx =17 }; };
603 template<>
struct WenoPt< 0, 0, 3> {
enum { idx =18 }; };
612template<
typename Gr
idT,
typename RealT =
typename Gr
idT::ValueType>
622 static constexpr int SIZE = 19;
649 dP_xm =
WENO5<RealT>(v[ 2]-v[ 1],v[ 3]-v[ 2],v[ 0]-v[ 3],v[ 4]-v[ 0],v[ 5]-v[ 4],mDx2),
650 dP_xp =
WENO5<RealT>(v[ 6]-v[ 5],v[ 5]-v[ 4],v[ 4]-v[ 0],v[ 0]-v[ 3],v[ 3]-v[ 2],mDx2),
651 dP_ym =
WENO5<RealT>(v[ 8]-v[ 7],v[ 9]-v[ 8],v[ 0]-v[ 9],v[10]-v[ 0],v[11]-v[10],mDx2),
652 dP_yp =
WENO5<RealT>(v[12]-v[11],v[11]-v[10],v[10]-v[ 0],v[ 0]-v[ 9],v[ 9]-v[ 8],mDx2),
653 dP_zm =
WENO5<RealT>(v[14]-v[13],v[15]-v[14],v[ 0]-v[15],v[16]-v[ 0],v[17]-v[16],mDx2),
654 dP_zp =
WENO5<RealT>(v[18]-v[17],v[17]-v[16],v[16]-v[ 0],v[ 0]-v[15],v[15]-v[14],mDx2);
668 V[0]>0 ?
WENO5<RealT>(v[ 2]-v[ 1],v[ 3]-v[ 2],v[ 0]-v[ 3], v[ 4]-v[ 0],v[ 5]-v[ 4],mDx2)
669 :
WENO5<RealT>(v[ 6]-v[ 5],v[ 5]-v[ 4],v[ 4]-v[ 0], v[ 0]-v[ 3],v[ 3]-v[ 2],mDx2),
670 V[1]>0 ?
WENO5<RealT>(v[ 8]-v[ 7],v[ 9]-v[ 8],v[ 0]-v[ 9], v[10]-v[ 0],v[11]-v[10],mDx2)
671 :
WENO5<RealT>(v[12]-v[11],v[11]-v[10],v[10]-v[ 0], v[ 0]-v[ 9],v[ 9]-v[ 8],mDx2),
672 V[2]>0 ?
WENO5<RealT>(v[14]-v[13],v[15]-v[14],v[ 0]-v[15], v[16]-v[ 0],v[17]-v[16],mDx2)
673 :
WENO5<RealT>(v[18]-v[17],v[17]-v[16],v[16]-v[ 0], v[ 0]-v[15],v[15]-v[14],mDx2));
683 mValues[10] - mValues[ 9],
684 mValues[16] - mValues[15]);
695 mValues[ 3] + mValues[ 4] +
696 mValues[ 9] + mValues[10] +
697 mValues[15] + mValues[16] - 6*mValues[0]);
705 return (v[ 0]>0 ? (v[ 3]<0 || v[ 4]<0 || v[ 9]<0 || v[10]<0 || v[15]<0 || v[16]<0)
706 : (v[ 3]>0 || v[ 4]>0 || v[ 9]>0 || v[10]>0 || v[15]>0 || v[16]>0));
710 template<
int i,
int j,
int k>
716 mValues[ 1] = mAcc.getValue(ijk.
offsetBy(-3, 0, 0));
717 mValues[ 2] = mAcc.getValue(ijk.
offsetBy(-2, 0, 0));
718 mValues[ 3] = mAcc.getValue(ijk.
offsetBy(-1, 0, 0));
719 mValues[ 4] = mAcc.getValue(ijk.
offsetBy( 1, 0, 0));
720 mValues[ 5] = mAcc.getValue(ijk.
offsetBy( 2, 0, 0));
721 mValues[ 6] = mAcc.getValue(ijk.
offsetBy( 3, 0, 0));
723 mValues[ 7] = mAcc.getValue(ijk.
offsetBy( 0, -3, 0));
724 mValues[ 8] = mAcc.getValue(ijk.
offsetBy( 0, -2, 0));
725 mValues[ 9] = mAcc.getValue(ijk.
offsetBy( 0, -1, 0));
726 mValues[10] = mAcc.getValue(ijk.
offsetBy( 0, 1, 0));
727 mValues[11] = mAcc.getValue(ijk.
offsetBy( 0, 2, 0));
728 mValues[12] = mAcc.getValue(ijk.
offsetBy( 0, 3, 0));
730 mValues[13] = mAcc.getValue(ijk.
offsetBy( 0, 0, -3));
731 mValues[14] = mAcc.getValue(ijk.
offsetBy( 0, 0, -2));
732 mValues[15] = mAcc.getValue(ijk.
offsetBy( 0, 0, -1));
733 mValues[16] = mAcc.getValue(ijk.
offsetBy( 0, 0, 1));
734 mValues[17] = mAcc.getValue(ijk.
offsetBy( 0, 0, 2));
735 mValues[18] = mAcc.getValue(ijk.
offsetBy( 0, 0, 3));
749 template<
int i,
int j,
int k>
struct CurvPt {};
750 template<>
struct CurvPt< 0, 0, 0> {
enum { idx = 0 }; };
752 template<>
struct CurvPt<-1, 0, 0> {
enum { idx = 1 }; };
753 template<>
struct CurvPt< 1, 0, 0> {
enum { idx = 2 }; };
755 template<>
struct CurvPt< 0,-1, 0> {
enum { idx = 3 }; };
756 template<>
struct CurvPt< 0, 1, 0> {
enum { idx = 4 }; };
758 template<>
struct CurvPt< 0, 0,-1> {
enum { idx = 5 }; };
759 template<>
struct CurvPt< 0, 0, 1> {
enum { idx = 6 }; };
761 template<>
struct CurvPt<-1,-1, 0> {
enum { idx = 7 }; };
762 template<>
struct CurvPt< 1,-1, 0> {
enum { idx = 8 }; };
763 template<>
struct CurvPt<-1, 1, 0> {
enum { idx = 9 }; };
764 template<>
struct CurvPt< 1, 1, 0> {
enum { idx =10 }; };
766 template<>
struct CurvPt<-1, 0,-1> {
enum { idx =11 }; };
767 template<>
struct CurvPt< 1, 0,-1> {
enum { idx =12 }; };
768 template<>
struct CurvPt<-1, 0, 1> {
enum { idx =13 }; };
769 template<>
struct CurvPt< 1, 0, 1> {
enum { idx =14 }; };
771 template<>
struct CurvPt< 0,-1,-1> {
enum { idx =15 }; };
772 template<>
struct CurvPt< 0, 1,-1> {
enum { idx =16 }; };
773 template<>
struct CurvPt< 0,-1, 1> {
enum { idx =17 }; };
774 template<>
struct CurvPt< 0, 1, 1> {
enum { idx =18 }; };
778template<
typename Gr
idT,
typename RealT =
typename Gr
idT::ValueType>
788 static constexpr int SIZE = 19;
793 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
800 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
810 RealT
alpha, normGrad;
821 RealT
alpha, normGrad;
850 RealT
alpha, normGrad;
862 RealT
alpha, normGrad;
908 mValues[1] + mValues[2] +
909 mValues[3] + mValues[4] +
910 mValues[5] + mValues[6] - 6*mValues[0]);
921 mValues[2] - mValues[1],
922 mValues[4] - mValues[3],
923 mValues[6] - mValues[5])*mInv2Dx;
927 template<
int i,
int j,
int k>
933 mValues[ 1] = mAcc.getValue(ijk.
offsetBy(-1, 0, 0));
934 mValues[ 2] = mAcc.getValue(ijk.
offsetBy( 1, 0, 0));
936 mValues[ 3] = mAcc.getValue(ijk.
offsetBy( 0, -1, 0));
937 mValues[ 4] = mAcc.getValue(ijk.
offsetBy( 0, 1, 0));
939 mValues[ 5] = mAcc.getValue(ijk.
offsetBy( 0, 0, -1));
940 mValues[ 6] = mAcc.getValue(ijk.
offsetBy( 0, 0, 1));
942 mValues[ 7] = mAcc.getValue(ijk.
offsetBy(-1, -1, 0));
943 mValues[ 8] = mAcc.getValue(ijk.
offsetBy( 1, -1, 0));
944 mValues[ 9] = mAcc.getValue(ijk.
offsetBy(-1, 1, 0));
945 mValues[10] = mAcc.getValue(ijk.
offsetBy( 1, 1, 0));
947 mValues[11] = mAcc.getValue(ijk.
offsetBy(-1, 0, -1));
948 mValues[12] = mAcc.getValue(ijk.
offsetBy( 1, 0, -1));
949 mValues[13] = mAcc.getValue(ijk.
offsetBy(-1, 0, 1));
950 mValues[14] = mAcc.getValue(ijk.
offsetBy( 1, 0, 1));
952 mValues[15] = mAcc.getValue(ijk.
offsetBy( 0, -1, -1));
953 mValues[16] = mAcc.getValue(ijk.
offsetBy( 0, 1, -1));
954 mValues[17] = mAcc.getValue(ijk.
offsetBy( 0, -1, 1));
955 mValues[18] = mAcc.getValue(ijk.
offsetBy( 0, 1, 1));
958 __hostdev__ inline RealT Dx()
const {
return 0.5*(mValues[2] - mValues[1]); }
959 __hostdev__ inline RealT Dy()
const {
return 0.5*(mValues[4] - mValues[3]); }
960 __hostdev__ inline RealT Dz()
const {
return 0.5*(mValues[6] - mValues[5]); }
961 __hostdev__ inline RealT Dxx()
const {
return mValues[2] - 2 * mValues[0] + mValues[1]; }
962 __hostdev__ inline RealT Dyy()
const {
return mValues[4] - 2 * mValues[0] + mValues[3]; }
963 __hostdev__ inline RealT Dzz()
const {
return mValues[6] - 2 * mValues[0] + mValues[5]; }
964 __hostdev__ inline RealT Dxy()
const {
return 0.25 * (mValues[10] - mValues[ 8] + mValues[ 7] - mValues[ 9]); }
965 __hostdev__ inline RealT Dxz()
const {
return 0.25 * (mValues[14] - mValues[12] + mValues[11] - mValues[13]); }
966 __hostdev__ inline RealT Dyz()
const {
return 0.25 * (mValues[18] - mValues[16] + mValues[15] - mValues[17]); }
971 const RealT Dx = this->Dx(), Dy = this->Dy(), Dz = this->Dz(),
972 Dx2 = Dx*Dx, Dy2 = Dy*Dy, Dz2 = Dz*Dz, normGrad2 = Dx2 + Dy2 + Dz2;
973 if (normGrad2 <= Tolerance<RealT>::value()) {
974 alpha = normGrad = 0;
977 const RealT Dxx = this->Dxx(), Dyy = this->Dyy(), Dzz = this->Dzz();
978 alpha = Dx2*(Dyy + Dzz) + Dy2*(Dxx + Dzz) + Dz2*(Dxx + Dyy) -
979 2*(Dx*(Dy*this->Dxy() + Dz*this->Dxz()) + Dy*Dz*this->Dyz());
980 normGrad =
Sqrt(normGrad2);
987 const RealT Dx = this->Dx(), Dy = this->Dy(), Dz = this->Dz(),
988 Dx2 = Dx*Dx, Dy2 = Dy*Dy, Dz2 = Dz*Dz, normGrad2 = Dx2 + Dy2 + Dz2;
989 if (normGrad2 <= Tolerance<RealT>::value()) {
990 alpha = normGrad = 0;
993 const RealT Dxx = this->Dxx(), Dyy = this->Dyy(), Dzz = this->Dzz(),
994 Dxy = this->Dxy(), Dxz = this->Dxz(), Dyz = this->Dyz();
995 alpha = Dx2*(Dyy*Dzz - Dyz*Dyz) + Dy2*(Dxx*Dzz - Dxz*Dxz) + Dz2*(Dxx*Dyy - Dxy*Dxy) +
996 2*( Dy*Dz*(Dxy*Dxz - Dyz*Dxx) + Dx*Dz*(Dxy*Dyz - Dxz*Dyy) + Dx*Dy*(Dxz*Dyz - Dxy*Dzz) );
997 normGrad =
Sqrt(normGrad2);
1004 const RealT Dx = this->Dx(), Dy = this->Dy(), Dz = this->Dz(),
1005 Dx2 = Dx*Dx, Dy2 = Dy*Dy, Dz2 = Dz*Dz, normGrad2 = Dx2 + Dy2 + Dz2;
1006 if (normGrad2 <= Tolerance<RealT>::value()) {
1007 alphaM = alphaG =normGrad = 0;
1010 const RealT Dxx = this->Dxx(), Dyy = this->Dyy(), Dzz = this->Dzz(),
1011 Dxy = this->Dxy(), Dxz = this->Dxz(), Dyz = this->Dyz();
1012 alphaM = Dx2*(Dyy + Dzz) + Dy2*(Dxx + Dzz) + Dz2*(Dxx + Dyy) -
1013 2*(Dx*(Dy*Dxy + Dz*Dxz) + Dy*Dz*Dyz);
1014 alphaG = Dx2*(Dyy*Dzz - Dyz*Dyz) + Dy2*(Dxx*Dzz - Dxz*Dxz) + Dz2*(Dxx*Dyy - Dxy*Dxy) +
1015 2*( Dy*Dz*(Dxy*Dxz - Dyz*Dxx) + Dx*Dz*(Dxy*Dyz - Dxz*Dyy) + Dx*Dy*(Dxz*Dyz - Dxy*Dzz) );
1016 normGrad =
Sqrt(normGrad2);
ValueT value
Definition GridBuilder.h:1290
#define __hostdev__
Definition NanoVDB.h:192
#define NANOVDB_ASSERT(x)
Definition NanoVDB.h:173
ValueType min() const
Return the smallest value in the stencil buffer.
Definition Stencils.h:189
void moveTo(const Vec3< RealType > &xyz)
Initialize the stencil buffer with the values of voxel (x, y, z) and its neighbors.
Definition Stencils.h:146
ValueType mValues[SIZE]
Definition Stencils.h:279
const AccessorType & accessor() const
Return a const reference to the ValueAccessor associated with this Stencil.
Definition Stencils.h:266
void moveTo(const IterType &iter)
Initialize the stencil buffer with the values of voxel (x, y, z) and its neighbors.
Definition Stencils.h:132
const ValueType & getValue(unsigned int pos=0) const
Return the value from the stencil buffer with linear offset pos.
Definition Stencils.h:157
bool intersects(const ValueType &isoValue=ValueType(0)) const
Return true if the center of the stencil intersects the iso-contour specified by the isoValue.
Definition Stencils.h:216
ValueType mean() const
Return the mean value of the current stencil.
Definition Stencils.h:181
void setValue(const ValueType &value)
Set the value at the specified location relative to the center of the stencil.
Definition Stencils.h:172
void moveTo(const Coord &ijk, const ValueType ¢erValue)
Initialize the stencil buffer with the values of voxel (i, j, k) and its neighbors....
Definition Stencils.h:119
typename GridT::AccessorType AccessorType
Definition Stencils.h:102
void moveTo(const Coord &ijk)
Initialize the stencil buffer with the values of voxel (i, j, k) and its neighbors.
Definition Stencils.h:107
Coord mCenter
Definition Stencils.h:280
const GridType * mGrid
Definition Stencils.h:277
const ValueType & getCenterValue() const
Return the value at the center of the stencil.
Definition Stencils.h:212
const ValueType & getValue() const
Return the value at the specified location relative to the center of the stencil.
Definition Stencils.h:165
const Coord & getCenterCoord() const
Return the coordinates of the center point of the stencil.
Definition Stencils.h:209
typename GridT::TreeType TreeType
Definition Stencils.h:101
typename GridT::ValueType ValueType
Definition Stencils.h:99
BaseStencil(const GridType &grid)
Definition Stencils.h:270
const GridType & grid() const
Return a const reference to the grid from which this stencil was constructed.
Definition Stencils.h:262
static int size()
Return the size of the stencil buffer.
Definition Stencils.h:178
ValueType max() const
Return the largest value in the stencil buffer.
Definition Stencils.h:199
AccessorType mAcc
Definition Stencils.h:278
Mask intersectionMask(ValueType isoValue=ValueType(0)) const
Return true a bit-mask where the 6 lower bits indicates if the center of the stencil intersects the i...
Definition Stencils.h:247
GridT GridType
Definition Stencils.h:100
Definition Stencils.h:305
static constexpr int SIZE
Definition Stencils.h:313
Vec3< ValueType > gradient(const Vec3< ValueType > &xyz) const
Return the gradient in world space of the trilinear interpolation kernel.
Definition Stencils.h:374
ValueType interpolation(const Vec3< ValueType > &xyz) const
Return the trilinear interpolation at the normalized position.
Definition Stencils.h:342
bool intersects(ValueType isoValue=ValueType(0)) const
Return true if the center of the stencil intersects the.
Definition Stencils.h:323
BoxStencil(const GridType &grid)
Definition Stencils.h:315
typename GridT::TreeType TreeType
Definition Stencils.h:310
typename GridT::ValueType ValueType
Definition Stencils.h:311
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition Stencils.h:319
GridT GridType
Definition Stencils.h:309
Signed (i, j, k) 32-bit integer coordinate class, similar to openvdb::math::Coord.
Definition NanoVDB.h:967
Coord offsetBy(ValueType dx, ValueType dy, ValueType dz) const
Definition NanoVDB.h:1116
Definition Stencils.h:780
void curvaturesNormGrad(ValueType &mean, ValueType &gauss) const
Return both the mean and the Gaussian curvature at the previously buffered location.
Definition Stencils.h:872
static constexpr int SIZE
Definition Stencils.h:788
CurvatureStencil(const GridType &grid)
Definition Stencils.h:790
ValueType meanCurvature() const
Return the mean curvature at the previously buffered location.
Definition Stencils.h:808
Vec3< ValueType > gradient() const
Definition Stencils.h:918
ValueType gaussianCurvatureNormGrad() const
Definition Stencils.h:860
void principalCurvatures(ValueType &min, ValueType &max) const
Computes the minimum and maximum principal curvature at the previously buffered location.
Definition Stencils.h:888
void curvatures(ValueType &mean, ValueType &gauss) const
Return both the mean and the Gaussian curvature at the previously buffered location.
Definition Stencils.h:831
ValueType laplacian() const
Definition Stencils.h:905
typename GridT::TreeType TreeType
Definition Stencils.h:785
typename GridT::ValueType ValueType
Definition Stencils.h:786
ValueType meanCurvatureNormGrad() const
Definition Stencils.h:848
ValueType gaussianCurvature() const
Return the Gaussian curvature at the previously buffered location.
Definition Stencils.h:819
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition Stencils.h:928
GridT GridType
Definition Stencils.h:784
CurvatureStencil(const GridType &grid, double dx)
Definition Stencils.h:797
Definition DenseGrid.h:402
Definition Stencils.h:455
static constexpr int SIZE
Definition Stencils.h:463
GradStencil(const GridType &grid, double dx)
Definition Stencils.h:472
GradStencil(const GridType &grid)
Definition Stencils.h:465
Vec3< ValueType > gradient() const
Return the gradient computed at the previously buffered location by second order central differencing...
Definition Stencils.h:500
Vec3< ValueType > cpt()
Compute the closest-point transform to a level set.
Definition Stencils.h:542
ValueType laplacian() const
Definition Stencils.h:520
Vec3< ValueType > gradient(const Vec3< ValueType > &V) const
Return the first-order upwind gradient corresponding to the direction V.
Definition Stencils.h:510
bool zeroCrossing() const
Definition Stencils.h:529
typename GridT::TreeType TreeType
Definition Stencils.h:460
typename GridT::ValueType ValueType
Definition Stencils.h:461
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition Stencils.h:554
ValueType normSqGrad() const
Return the norm square of the single-sided upwind gradient (computed via Godunov's scheme) at the pre...
Definition Stencils.h:484
GridT GridType
Definition Stencils.h:459
This is a special 19-point stencil that supports optimal fifth-order WENO upwinding,...
Definition Stencils.h:614
static constexpr int SIZE
Definition Stencils.h:622
Vec3< ValueType > gradient() const
Definition Stencils.h:680
WenoStencil(const GridType &grid)
Definition Stencils.h:624
WenoStencil(const GridType &grid, double dx)
Definition Stencils.h:632
ValueType laplacian() const
Definition Stencils.h:692
Vec3< ValueType > gradient(const Vec3< ValueType > &V) const
Definition Stencils.h:664
bool zeroCrossing() const
Definition Stencils.h:702
typename GridT::TreeType TreeType
Definition Stencils.h:619
typename GridT::ValueType ValueType
Definition Stencils.h:620
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition Stencils.h:711
GridT GridType
Definition Stencils.h:618
ValueType normSqGrad(ValueType isoValue=ValueType(0)) const
Return the norm-square of the WENO upwind gradient (computed via WENO upwinding and Godunov's scheme)...
Definition Stencils.h:645
uint32_t CountOn(uint64_t v)
Definition NanoVDB.h:1931
Type Min(Type a, Type b)
Definition NanoVDB.h:758
T Pow4(T x)
Definition NanoVDB.h:849
float Sqrt(float x)
Return the square root of a floating-point value.
Definition NanoVDB.h:902
ValueType WENO5(const ValueType &v1, const ValueType &v2, const ValueType &v3, const ValueType &v4, const ValueType &v5, RealT scale2=1.0)
Implementation of nominally fifth-order finite-difference WENO.
Definition Stencils.h:35
T Pow3(T x)
Definition NanoVDB.h:843
CoordT RoundDown(const Vec3T< RealT > &xyz)
Definition NanoVDB.h:895
T Pow2(T x)
Definition NanoVDB.h:837
Type Max(Type a, Type b)
Definition NanoVDB.h:779
RealT GodunovsNormSqrd(bool isOutside, RealT dP_xm, RealT dP_xp, RealT dP_ym, RealT dP_yp, RealT dP_zm, RealT dP_zp)
Definition Stencils.h:62
Definition Stencils.h:226
int count() const
Definition Stencils.h:234
bool test(int i) const
Definition Stencils.h:230
bool none() const
Definition Stencils.h:233
uint8_t bits
Definition Stencils.h:227
bool all() const
Definition Stencils.h:232
void set(int i)
Definition Stencils.h:229
bool any() const
Definition Stencils.h:231
Mask()
Definition Stencils.h:228