Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Circle as approx of lines & Viewport Mapping

24 views
Skip to first unread message

SJ

unread,
Sep 5, 2011, 1:08:10 AM9/5/11
to
I doing a computer graphics course. Till now we have been taught
Bresenham Algorithms, Midpoint Algorithms, 2-d & 3-d
transformations, window/viewport mapping.

I am currently looking at some questions/problems.

This is one of the problems.

"A circle of radius 25 mm, centered at (100, 150), is to be drawn as a
series of lines by 2-d drafting system. The max. tolerance is 1 mm.
Cacluate the numbers of lines required to display the circle within
this tolerance, and calculate the screen coordinates of
the first of the lines. The window bounds are (40, 100) and (160, 200),
and the viewport bound are at pixel locations (0, 50), (480, 450)".

We haven't done drawing circle as series of lines, but I just tried
to solve this problem using basic geometry.

I have uploaded a rough drawing which I used to calculate this at
http://www.flickr.com/photos/66943862@N06/6110850003/

For maximum tolerance of 1 mm, the maximum length of OB is
25 - 1 = 24.
OP is 25 (radius)

Let angle POB be x

cos(x) = OP/OB = 24/25

so x = cosinv(24/25) = 16.26 degrees.

So angle AOB = 2 * 15.95 = 32.52 degrees.

number of lines = 360/32.52 = 11.07

To round this, we can chose either 11 or 12.
If we chose 11, the display tolerance would be a little
more than 1 mm. Hence we chose 12.
So we need to draw the circle as 12 lines.

Is this right way to do this? Or is this some separate
topic in Computer Graphics which I haven't covered. If
so can someone give me the name of the topic which I can
search for?


Also, I am not sure what it means by "first of the lines".

If I have 12 lines, I will have 3 lines in each quadrant.
I calculated the screen co-ordinates of the 3 lines in the
first quadrant in the following way. Is this the right way?

In the world co-ordinates, if I assume the first line to start
at the point whether the y axis intersects the circle above the
x-axis. This point would be (100, 175). The next 3 points going
clockwise would be (112.5, 175.35), (121.65. 162.5) & (125, 150)

My Transformation Matrix for converting this into screen co-ordinates
would be derived as follows

T(0,50). S(4,4). T(-40,-100).

Using this on the 4 points gives me screen co-ordinates as
(240, 350), (295, 335.4), 326.6, 300), (340, 250)

Is this the right way to do this?

0 new messages