XP is just a number | |
PerlMonks |
Re^5: Split range 0 to M into N non-overlapping (roughly equal) ranges.by BrowserUk (Patriarch) |
on Mar 13, 2011 at 00:22 UTC ( [id://892881]=note: print w/replies, xml ) | Need Help?? |
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. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|