 |
Shiokaze Framework
A research-oriented fluid solver for computer graphics
|
|
Go to the documentation of this file.
25 #ifndef SHKZ_ARRAY_GAUSSIANBLUR3_H
26 #define SHKZ_ARRAY_GAUSSIANBLUR3_H
49 int rs = std::ceil(r * 2.57);
50 std::vector<double> exp_w(2*rs+1);
51 for(
int q=-rs; q<rs+1; q++) {
52 exp_w[q+rs] = std::exp(-(q*q)/(2.0*r*r))/std::sqrt(M_PI*2.0*r*r);
54 auto valid = [&](
int i,
int j,
int k ) {
55 if( ! mask )
return true;
57 return (*mask)(mask->shape().clamp(i,j,k)) != 0;
62 for(
int dim : DIMS3 ) {
63 result.
parallel_all([&](
int i,
int j,
int k,
auto &it,
int tn) {
67 for(
int q=-rs; q<rs+1; q++) {
68 int ni = i+(dim==0)*q;
69 int nj = j+(dim==1)*q;
70 int nk = k+(dim==2)*q;
71 const double &wght = exp_w[q+rs];
73 T value = save()(save->shape().clamp(ni,nj,nk));
74 val += value * wght; wsum += wght;
77 if( wsum ) it.set(val/wsum);
void gaussian_blur(const array3< T > &array, array3< T > &result, double r, const bitarray3 *mask=nullptr)
Perform gaussian blur on grids.
Definition: array_gaussianblur3.h:48
Storage class that enables sharing pre-allocated arrays.
Definition: shared_array3.h:41
Three dimensional bit grid class designed to be defined as instance member in recursive_configurable ...
Definition: bitarray3.h:43
Namespace that performs gaussian blur.
Definition: array_gaussianblur3.h:37
#define SHKZ_BEGIN_NAMESPACE
Name space beggining definition for shiokaze.
Definition: common.h:39
void parallel_all(std::function< void(iterator &it)> func)
Loop over all the cells in parallel.
Definition: array3.h:1150
#define SHKZ_END_NAMESPACE
Name space end definition for shiokaze.
Definition: common.h:44
Three dimensional array class designed to be defined as instance member in recursive_configurable cla...
Definition: array3.h:42