Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

•Re: Seek one liner for distributing an integer

by merlyn (Sage)
on Sep 22, 2004 at 10:24 UTC ( [id://392887]=note: print w/replies, xml ) Need Help??


in reply to Seek one liner for distributing an integer

To distribute this evenly and quickly, you could use the Bresenham Algorithm. Unfortunately, I didn't see any Perl implementations on a quick scan of the results. I became aware of the Bresenham technique some 20 years ago when I saw how to draw a diagonal line with the right amount of dots without using any division. It was quite amazing.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re: Seek one liner for distributing an integer

Replies are listed 'Best First'.
Re^2: Seek one liner for distributing an integer
by hsmyers (Canon) on Sep 22, 2004 at 14:00 UTC
    While still not in Perl, the best work that I know of on implementing Bresenham's Algorithm is to be found in books by Michael Abrash. Two come to mind that belong on any programmers shelf; "Zen of Graphics Programming" Coriolis Group Books, ISBN 188357708X and "Zen of Code Optimization", Coriolis Group Books, ISBN 1883577039. Since Coriolis is sadly no longer among the living, you might try Powel's Technical in Portland.

    --hsm

    "Never try to teach a pig to sing...it wastes your time and it annoys the pig."

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://392887]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-04-19 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found