GaussianBlur3.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // David Eberly, Geometric Tools, Redmond WA 98052
  2. // Copyright (c) 1998-2020
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // https://www.boost.org/LICENSE_1_0.txt
  5. // https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
  6. // Version: 4.0.2020.01.11
  7. #pragma once
  8. #include <Mathematics/PdeFilter3.h>
  9. namespace WwiseGTE
  10. {
  11. template <typename Real>
  12. class GaussianBlur3 : public PdeFilter3<Real>
  13. {
  14. public:
  15. GaussianBlur3(int xBound, int yBound, int zBound, Real xSpacing,
  16. Real ySpacing, Real zSpacing, Real const* data, bool const* mask,
  17. Real borderValue, typename PdeFilter<Real>::ScaleType scaleType)
  18. :
  19. PdeFilter3<Real>(xBound, yBound, zBound, xSpacing, ySpacing, zSpacing,
  20. data, mask, borderValue, scaleType)
  21. {
  22. mMaximumTimeStep = (Real)0.5 / (this->mInvDxDx + this->mInvDyDy + this->mInvDzDz);
  23. }
  24. virtual ~GaussianBlur3()
  25. {
  26. }
  27. inline Real GetMaximumTimeStep() const
  28. {
  29. return mMaximumTimeStep;
  30. }
  31. protected:
  32. virtual void OnUpdateSingle(int x, int y, int z) override
  33. {
  34. this->LookUp7(x, y, z);
  35. Real uxx = this->mInvDxDx * (this->mUpzz - (Real)2 * this->mUzzz + this->mUmzz);
  36. Real uyy = this->mInvDyDy * (this->mUzpz - (Real)2 * this->mUzzz + this->mUzmz);
  37. Real uzz = this->mInvDzDz * (this->mUzzp - (Real)2 * this->mUzzz + this->mUzzm);
  38. this->mBuffer[this->mDst][z][y][x] = this->mUzzz + this->mTimeStep * (uxx + uyy + uzz);
  39. }
  40. Real mMaximumTimeStep;
  41. };
  42. }