• Create Account

Banner advertising on our site currently available from just \$5!

### #Actualwodinoneeye

Posted 19 August 2013 - 07:40 AM

int      l, dijk, dijkl, dijkr, ima, qi, qj, qidiv, qjdiv, fi, fj, fijk2;
double   disx, disy, switchx, switchy, switchx2 ,disxl, disxr, disx2, disxr2;

dijk    = di + nx * (dj + oy * dk);
ima     = step_div(dk - ez, nz);
qj      = dj + step_int(-ima * byz * ysp);
qjdiv   = step_div(qj - ey, ny);
qi      = di + step_int((-ima * bxz - qjdiv * bxy) * xsp);
qidiv   = step_div(qi, nx);
fi      = qi - qidiv * nx;
fj      = qj - qjdiv * ny,

fijk    = fi + nx * (fj + oy * (dk - ima * nz));

disy    = ima * byz + qjdiv * by;
switchy = (dj - ey) * boxy - ima * byz - qjdiv * by;

disx    = ima * bxz + qjdiv * bxy + qidiv * bx;
switchx = di * boxx - ima * bxz - qjdiv * bxy - qidiv * bx;

//This is what you would largely see after my usual treatment
//(and I likely would add some extra parens around the multiplies
//to emphasise the ordering

Does look a bit clearer after youve isolated the variable definitions (that partial list) from the calculation statements and added spacers to make the functions and variables more distinct.

Imagine how much more fun the above code would be with ALL  8+ char variable names  (and those function name would have to be expanded too --- wouldnt they ?....)

Short variable names dont bother me so much - but if there is anything weird/unusual  being done I will heavily comment to make clear some atypical code.

### #2wodinoneeye

Posted 19 August 2013 - 07:34 AM

int      l, dijk, dijkl, dijkr, ima, qi, qj, qidiv, qjdiv, fi, fj, fijk2;
double   disx, disy, switchx, switchy, switchx2 ,disxl, disxr, disx2, disxr2;

dijk    = di + nx * (dj + oy * dk);
ima     = step_div(dk - ez, nz);
qj      = dj + step_int(-ima * byz * ysp);
qjdiv   = step_div(qj - ey, ny);
qi      = di + step_int((-ima * bxz - qjdiv * bxy) * xsp);
qidiv   = step_div(qi, nx);
fi      = qi - qidiv * nx;
fj      = qj - qjdiv * ny,

fijk    = fi + nx * (fj + oy * (dk - ima * nz));

disy    = ima * byz + qjdiv * by;
switchy = (dj - ey) * boxy - ima * byz - qjdiv * by;

disx    = ima * bxz + qjdiv * bxy + qidiv * bx;
switchx = di * boxx - ima * bxz - qjdiv * bxy - qidiv * bx;

//This is what you would largely see after my usual treatment
//(and I likely would add some extra parens around the multiplies
//to emphasise the ordering

Does look a bit clearer after youve isolated the variable definitions (that partial list) from the calculation statements and added spacers to make the functions and variables more distinct

### #1wodinoneeye

Posted 19 August 2013 - 07:29 AM

int      l, dijk, dijkl, dijkr, ima, qi, qj, qidiv, qjdiv, fi, fj, fijk2;
double   disx, disy, switchx, switchy, switchx2 ,disxl, disxr, disx2, disxr2;

dijk    = di + nx * (dj + oy * dk);
ima     = step_div(dk - ez, nz);
qj      = dj + step_int(-ima * byz * ysp);
qjdiv   = step_div(qj - ey, ny);
qi      = di + step_int((-ima * bxz - qjdiv * bxy) * xsp);
qidiv   = step_div(qi, nx);
fi      = qi - qidiv * nx;
fj      = qj - qjdiv * ny,

fijk    = fi + nx * (fj + oy * (dk - ima * nz));

disy    = ima * byz + qjdiv * by;
switchy = (dj - ey) * boxy - ima * byz - qjdiv * by;

disx    = ima * bxz + qjdiv * bxy + qidiv * bx;
switchx = di * boxx - ima * bxz - qjdiv * bxy - qidiv * bx;



PARTNERS