Make a few concessions to readability by inserting some white-space around binary operators where appropriate.
Signed-off-by: Bård Skaflestad <Bard.Skaflestad@sintef.no>
This commit is contained in:
parent
7dfb478e2e
commit
140d4ade25
35
preprocess.c
35
preprocess.c
@ -244,7 +244,7 @@ process_vertical_faces(int direction,
|
||||
|
||||
static int linearindex(const int dims[3], int i, int j, int k)
|
||||
{
|
||||
return i+dims[0]*(j+dims[1]*k);
|
||||
return i + dims[0]*(j + dims[1]*k);
|
||||
}
|
||||
|
||||
|
||||
@ -379,13 +379,13 @@ static void approximate_intersection_pt(int *L, double *c, double *pt)
|
||||
double z;
|
||||
|
||||
/* no intersection on pillars expected here! */
|
||||
assert(L[0]!=L[2]);
|
||||
assert(L[1]!=L[3]);
|
||||
assert (L[0] != L[2]);
|
||||
assert (L[1] != L[3]);
|
||||
|
||||
z0 = c[3*L[0]+2];
|
||||
z1 = c[3*L[1]+2];
|
||||
z2 = c[3*L[2]+2];
|
||||
z3 = c[3*L[3]+2];
|
||||
z0 = c[3*L[0] + 2];
|
||||
z1 = c[3*L[1] + 2];
|
||||
z2 = c[3*L[2] + 2];
|
||||
z3 = c[3*L[3] + 2];
|
||||
|
||||
/* find parameter a where lines L0L1 and L2L3 have same
|
||||
* z-coordinate */
|
||||
@ -404,24 +404,23 @@ static void approximate_intersection_pt(int *L, double *c, double *pt)
|
||||
|
||||
|
||||
/* find point (x1, y1, z) on pillar 1 */
|
||||
b1 = (z2-z)/(z2-z0);
|
||||
b2 = (z-z0)/(z2-z0);
|
||||
x1 = c[3*L[0]+0]*b1 + c[3*L[2]+0]*b2;
|
||||
y1 = c[3*L[0]+1]*b1 + c[3*L[2]+1]*b2;
|
||||
b1 = (z2 - z) / (z2 - z0);
|
||||
b2 = (z - z0) / (z2 - z0);
|
||||
x1 = c[3*L[0] + 0]*b1 + c[3*L[2] + 0]*b2;
|
||||
y1 = c[3*L[0] + 1]*b1 + c[3*L[2] + 1]*b2;
|
||||
|
||||
/* find point (x2, y2, z) on pillar 2 */
|
||||
b1 = (z-z3)/(z1-z3);
|
||||
b2 = (z1-z)/(z1-z3);
|
||||
x2 = c[3*L[1]+0]*b1 + c[3*L[3]+0]*b2;
|
||||
y2 = c[3*L[1]+1]*b1 + c[3*L[3]+1]*b2;
|
||||
b1 = (z - z3) / (z1 - z3);
|
||||
b2 = (z1 - z) / (z1 - z3);
|
||||
x2 = c[3*L[1] + 0]*b1 + c[3*L[3] + 0]*b2;
|
||||
y2 = c[3*L[1] + 1]*b1 + c[3*L[3] + 1]*b2;
|
||||
|
||||
/* horizontal lines are by definition ON the bilinear surface
|
||||
spanned by L0, L1, L2 and L3. find point (x, y, z) on
|
||||
horizontal line between point (x1, y1, z) and (x2, y2, z).*/
|
||||
pt[0] = x1* (1.0-a) + x2* a;
|
||||
pt[1] = y1* (1.0-a) + y2* a;
|
||||
pt[0] = x1*(1.0 - a) + x2*a;
|
||||
pt[1] = y1*(1.0 - a) + y2*a;
|
||||
pt[2] = z;
|
||||
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user