Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions source/fastmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,22 +231,22 @@ template class FastMarch<FmHeapEntryOut, +1>;
KERNEL(bnd=1)
void knExtrapolateMACSimple (MACGrid& vel, int distance , Grid<int>& tmp , const int d , const int c )
{
if (tmp(i,j,k) != 0) return;

static const Vec3i nb[6] = {
Vec3i(1 ,0,0), Vec3i(-1,0,0),
Vec3i(0,1 ,0), Vec3i(0,-1,0),
Vec3i(0,0,1 ), Vec3i(0,0,-1) };
Vec3i(i+1, j, k), Vec3i(i-1, j, k),
Vec3i(i, j+1, k), Vec3i(i, j-1, k),
Vec3i(i, j, k+1), Vec3i(i, j, k-1) };
const int dim = (vel.is3D() ? 3:2);

if (tmp(i,j,k) != 0) return;

// copy from initialized neighbors
Vec3i p(i,j,k);
int nbs = 0;
Real avgVel = 0.;
for (int n=0; n<2*dim; ++n) {
if (tmp(p+nb[n]) == d) {
if (tmp(nb[n]) == d) {
//vel(p)[c] = (c+1.)*0.1;
avgVel += vel(p+nb[n])[c];
avgVel += vel(nb[n])[c];
nbs++;
}
}
Expand Down Expand Up @@ -377,21 +377,21 @@ PYTHON() void extrapolateMACSimple (FlagGrid& flags, MACGrid& vel, int distance
KERNEL(bnd=1)
void knExtrapolateMACFromWeight ( MACGrid& vel, Grid<Vec3>& weight, int distance , const int d, const int c )
{
if (weight(i,j,k)[c] != 0) return;

static const Vec3i nb[6] = {
Vec3i(1 ,0,0), Vec3i(-1,0,0),
Vec3i(0,1 ,0), Vec3i(0,-1,0),
Vec3i(0,0,1 ), Vec3i(0,0,-1) };
Vec3i(i+1 ,j, k), Vec3i(i-1, j, k),
Vec3i(i, j+1, k), Vec3i(i, j-1, k),
Vec3i(i, j, k+1), Vec3i(i, j, k-1) };
const int dim = (vel.is3D() ? 3:2);

if (weight(i,j,k)[c] != 0) return;

// copy from initialized neighbors
Vec3i p(i,j,k);
int nbs = 0;
Real avgVel = 0.;
for (int n=0; n<2*dim; ++n) {
if (weight(p+nb[n])[c] == d) {
avgVel += vel(p+nb[n])[c];
if (weight(nb[n])[c] == d) {
avgVel += vel(nb[n])[c];
nbs++;
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/util/simpleimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ void projectImg( SimpleImage& img, const Grid<Real>& val, int shadeMode=0, Real

} // 3d

img.mapRange( 1./scale );
img.mapRange( scale );
}


Expand Down
4 changes: 2 additions & 2 deletions source/util/simpleimage.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ class SimpleImage {
get(i,j) *= f;
}
}
// map 0-f to 0-1 range, clamp
// map 0-1/f to 0-1 range, clamp
void mapRange(Real f) {
for (int j=0; j<mSize[1]; j++)
for (int i=0; i<mSize[0]; i++) {
get(i,j) /= f;
get(i,j) *= f;
for(int c=0; c<3; ++c)
get(i,j)[c] = clamp( get(i,j)[c], (Real)0.,(Real)1.);
}
Expand Down