easy-iso

Iso-surface extraction from volume data
git clone https://git.0xfab.ch/easy-iso.git
Log | Files | Refs | Submodules | README | LICENSE

M5.h (894B)


      1 // File       : M5.h
      2 // Date       : Thu Nov 24 09:33:24 2016
      3 // Author     : Fabian Wermelinger
      4 // Description: M5 smoothing interpolation kernel (Monaghan 1985)
      5 // Copyright 2016 ETH Zurich. All Rights Reserved.
      6 #ifndef M5_H_G6FRPHTC
      7 #define M5_H_G6FRPHTC
      8 
      9 #include <cmath>
     10 #include "common.h"
     11 
     12 class M5
     13 {
     14 public:
     15     static constexpr int start = -2;
     16     static constexpr int end   = 4;
     17 
     18     inline Real operator()(const Real x) const
     19     {
     20         const Real a0 = 1.0/48.0;
     21         const Real IxI = std::abs(x);
     22         if (IxI < 0.5)
     23             return a0*(43.125-75.0*IxI*IxI+42.0*IxI*IxI*IxI*IxI);
     24         else if (IxI < 1.5)
     25             return a0*(41.25+20.0*IxI-150.0*IxI*IxI+120.0*IxI*IxI*IxI-28.0*IxI*IxI*IxI*IxI);
     26         else if (IxI < 2.5)
     27             return a0*(IxI-2.5)*(IxI-2.5)*(IxI-2.5)*(7.0*IxI-7.5);
     28         else
     29             return 0.0;
     30     }
     31 };
     32 
     33 #endif /* M5_H_G6FRPHTC */