in reply to Re^4: Split range 0 to M into N non-overlapping (roughly equal) ranges.
in thread Split range 0 to M into N non-overlapping (roughly equal) ranges.
Neat. I've written Bresenham routines several times in C and various assemblers, but I'd never encountered that variation.
The interesting thing is that once you whittle away the details irrelevant to my problem, you end up with the realisation that this is exactly what both javafan and mr_mischief came up with.
The significant thing in both implementations is that they defer the inting when calculating the step value, retaining it as a real, with the result that the residual get distributed evenly and automatically as they iterate the N partitions.
Simple once it is in front of you, but it was the trick I was missing.
|
---|