heping@kuhub.cc.ukans.edu (02/03/91)
I need algorithms for drawing arcs and ellipses, could someone help me? Thanks Phil
awd@dbase.A-T.COM (Alastair Dallas) (02/06/91)
In article <28315.27aabebc@kuhub.cc.ukans.edu>, heping@kuhub.cc.ukans.edu writes: > I need algorithms for drawing arcs and ellipses, could someone help me? > Thanks > > Phil When you interview for a programming job at Microsoft, they spring a pop quiz on you. One of the questions they asked me (years ago) was "design an algorithm to draw an arc efficiently." The answer they're looking for is something like Bresenham's algorithm which plots a point on the arc { x = 0, y = r } and incrementally draws the arc by determining the adjacent pixel with the least error. My guess was scan-line by scan-line, but this results in holes--a flood fill would "escape." Bresenham's algorithm is described in "Fundamentals of Interactive Computer Graphics," by Foley and Van Dam. I see there's a new edition out, but it's $60 or so--the good news is that the older edition should now be even cheaper used. Hope it helps. /alastair/