summaryrefslogtreecommitdiffstats
path: root/Smoke/fluids.c
diff options
context:
space:
mode:
authorWilrik de Loose <wilrik@wilrik.nl>2008-01-03 13:11:52 (GMT)
committerWilrik de Loose <wilrik@wilrik.nl>2008-01-03 13:11:52 (GMT)
commite1b9274194fcb0e5054948917628c5e1022b42c2 (patch)
tree9e6dfcebf178209df2a44d2656d42084583de108 /Smoke/fluids.c
parent26824e6de9ff2a591a02770f19006d186b2e1c71 (diff)
download2iv35-e1b9274194fcb0e5054948917628c5e1022b42c2.zip
2iv35-e1b9274194fcb0e5054948917628c5e1022b42c2.tar.gz
2iv35-e1b9274194fcb0e5054948917628c5e1022b42c2.tar.bz2
Diffstat (limited to 'Smoke/fluids.c')
-rw-r--r--Smoke/fluids.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/Smoke/fluids.c b/Smoke/fluids.c
index 7476a6d..5e1f7a6 100644
--- a/Smoke/fluids.c
+++ b/Smoke/fluids.c
@@ -237,6 +237,11 @@ void vector_normal(struct point vert1, struct point vert2, struct point vert3, s
normal->x /= length;
normal->y /= length;
normal->z /= length;
+
+ if (normal->x == normal->y == normal->z == 0.0f)
+ {
+ normal->z = 1.0f;
+ }
}
@@ -244,6 +249,10 @@ void calculate_normal_vectors(void)
{
int i;
struct point p1, p2, p3;
+ float px, py;
+
+ fftw_real wn = (fftw_real)winWidth / (fftw_real)(DIM + 1); // Grid cell width
+ fftw_real hn = (fftw_real)winHeight / (fftw_real)(DIM + 1); // Grid cell height
for (i = 0; i < DIM * DIM; i++)
{
@@ -268,13 +277,13 @@ void calculate_normal_vectors(void)
p1.y = vy[i];
p1.z = height_array[i];
- p2.x = vx[i + 1];
- p2.y = vy[i + 1];
- p2.z = height_array[i + 1];
+ p3.x = vx[i + 1];
+ p3.y = vy[i + 1];
+ p3.z = height_array[i + 1];
- p3.x = vx[i + DIM];
- p3.y = vy[i + DIM];
- p3.z = height_array[i + DIM];
+ p2.x = vx[i + DIM];
+ p2.y = vy[i + DIM];
+ p2.z = height_array[i + DIM];
break;
case DATASET_RHO: