home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.graphics
- Path: sparky!uunet!news.smith.edu!orourke
- From: orourke@sophia.smith.edu (Joseph O'Rourke)
- Subject: Re: How many dots in a circle?
- Message-ID: <1992Dec23.170712.9468@sophia.smith.edu>
- Organization: Smith College, Northampton, MA, US
- References: <1992Dec22.134450.15558@cactus.org> <1992Dec23.031735.13264@proto.com> <1992Dec23.161707.22424@unocal.com>
- Date: Wed, 23 Dec 1992 17:07:12 GMT
- Lines: 24
-
- In article <1992Dec23.161707.22424@unocal.com> stgprao@st.unocal.COM (Richard Ottolini) writes:
- >In article <1992Dec23.031735.13264@proto.com> joe@proto.com (Joe Huffman) writes:
- >>The number of points in a single quadrant is 2 * radius. In the entire
- >>circle it follows that it is 8 * radius.
- >
- >Counter example on a piece of graph paper for box edge = 15:
-
- I believe Richard is on the right track, though. In the octant between 45 deg
- and the vertical y-axis, most circle algorithms color one pixel per x value.
- So one only need count these and multiply by 8. For a radius r circle,
- the x coordinate of the intersection of the circle with the 45 deg y=x line
- is (Sqrt[2]/2) r. So the number of pixels colored in one octant is
-
- o = Floor[ (Sqrt[2]/2) r ]
-
- Example: r=17, o = Floor[ 12.02 ] = 12. The total (8 o) does not
- count the pixels directly on the four radii at 45, 135, 225, and 315 degs.
- So it must be incremented by 4. The total number of pixels n is therefore
-
- n = 8 Floor[ (Sqrt[2]/2) r ] + 4
-
- Example: r=17, n = 100.
- Maybe someone who has Bresenham's algorithm implemented can
- check my calculations?
-