3 views

Skip to first unread message

Jun 12, 2001, 4:07:56 PM6/12/01

to

This is an observation I've made concerning the effective line width

of circles drawn with a so called "zero width pen.

of circles drawn with a so called "zero width pen.

For the purposes of this discussion assume pixels are square, i.e.

the horizontal and vertical pixel spacings are the same. Lengths

will be in terms of pixel widths (which also equal pixel heights)

and areas will be in terms of pixel areas.

Consider circles which are centered on a pixel and have integer

radii. If such a circle with radius r is rendered using either the

midpoint algorithm or Breshenham's circle algorithm, it can be shown

that the number of pixels drawn, N, is given by

N = 8 * floor((sqrt(2)/2)*r) + 4

Depending on the value of r,

8 * ((sqrt(2)/2)*r - 1) + 4 < N <= 8 * ((sqrt(2)/2)*r) + 4

or

4*sqrt(2)*r - 4 < N <= 4*sqrt(2)*r + 4

So a "nominal" value for N would be

4*sqrt(2)*r

Ideally if a circle of radius r were drawn by a width w pen, the

result would be an annulus with outer radius

ro = r + w/2

and inner radius

ri = r - w/2

The area of an annuls is given by

A = pi * (pow(ro,2) - pow(ri,2))

which in this case is

A = pi * (pow(r + w/2, 2) - pow(r - w/2, 2))

or

A = pi * ( pow(r,2) + r*w + pow(w,2)/4 -

(pow(r,2) - r*w + pow(w,2)/4) )

which simplifies to

A = 2*pi*r*w

Solving for w,

w = A / (2*pi*r)

A reasonable definition of the effective line width of a raster

rendering of a circle is the width of an annulus of the same nominal

radius with the same area as the number of pixels drawn by the

raster rendering of the circle. I.e.

w = N / (2*pi*r)

Substituting the nominal value for N given above

w = 4*sqrt(2)*r / (2*pi*r)

or

w = 2*sqrt(2)/pi

(which is approximately 0.9).

-Michael

Jun 18, 2018, 5:07:02 PM6/18/18

to

On Wednesday, June 13, 2001 at 8:37:04 PM UTC-4, Michael Aramini wrote:

...

N = 4 round(sqrt(2) r)

Depending on the value of r,

4 (sqrt(2) r - 1/2) < N <= 4 (sqrt(2) r + 1/2)

or more simply

4 sqrt(2) r - 2 < N <= 4 sqrt(2) r + 2

> So a "nominal" value for N would be

> 4*sqrt(2)*r

...

This part is still valid.

-Michael

...

> Consider circles which are centered on a pixel and have integer

> radii. If such a circle with radius r is rendered using either the

> midpoint algorithm or Breshenham's circle algorithm, it can be shown

> that the number of pixels drawn, N, is given by

> N = 8 * floor((sqrt(2)/2)*r) + 4

> Depending on the value of r,

> 8 * ((sqrt(2)/2)*r - 1) + 4 < N <= 8 * ((sqrt(2)/2)*r) + 4

> or

> 4*sqrt(2)*r - 4 < N <= 4*sqrt(2)*r + 4

The above is slightly incorrect due to an incorrect assumption I had previously made about those circle drawing algorithms. The correct expression for N is
> radii. If such a circle with radius r is rendered using either the

> midpoint algorithm or Breshenham's circle algorithm, it can be shown

> that the number of pixels drawn, N, is given by

> N = 8 * floor((sqrt(2)/2)*r) + 4

> Depending on the value of r,

> 8 * ((sqrt(2)/2)*r - 1) + 4 < N <= 8 * ((sqrt(2)/2)*r) + 4

> or

> 4*sqrt(2)*r - 4 < N <= 4*sqrt(2)*r + 4

N = 4 round(sqrt(2) r)

Depending on the value of r,

or more simply

4 sqrt(2) r - 2 < N <= 4 sqrt(2) r + 2

> So a "nominal" value for N would be

> 4*sqrt(2)*r

This part is still valid.

-Michael

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu