[CSC 315] Re: CSC315

Andrew J. Pounds pounds at theochem.mercer.edu
Wed Sep 19 15:33:19 EDT 2007


I was waiting for someone to note this -- hopefully prior to the due date.

You have found the first one of those "nuggets" of graphics 
programming.  Many times circular regions have to be clipped or  
modified before rendering.  I do  want you to use Sutherland-Hodgman -- 
it is helping you get some experience with it before your next 
programming assignment which will rely on it heavily.   This is also a 
good example of how computationally intensive graphics programming can 
be.  Here is the deal.  You can use the midpoint circle scan-converting 
algorithm (and generate eight points per iteration) to fill an array 
with points along the circle.   The key is that you need to fill the 
array in such a way that the points ARE ordered so that as you go from 
array element 0 to array element n-1 you draw a complete  circle.   
Going clockwise or counterclockwise is irrelevant.  You then use this 
array of vertices as the input to your polygon clipping algorithm.

You want to make sure your arrays are big enough to draw accurate 
circles.  If you know the number of pixels on your display, you can 
estimate the maximum number of points you would need.

Does that clear things up?  Do you need an extra day?

BTW --- /pub/pounds/CSC315/chapter3   on Cobra has some nice goodies...

p.s.  -- It will be interesting to do a comparison of straight 
scissoring of the array vs. SH clipping.

David Thomas wrote:
> Hi Dr. Pounds.
>
> Ok, the question I had, as Long so eloquently misstated, is the 
> following: HOW do we apply the polygon-clipping algorithm to circles?
>
> First, do you mean that you want us to treat each pixel that we come 
> up with as a vertex of a polygon? The midpoint circle scan-converting 
> algorithm does not generate the pixels in counterclockwise order. If 
> we obtained this order, that would still give a much less efficient 
> method than scissoring, since you are still looking at each pixel 
> separately but with much more work involved in the polygon clipping 
> itself; therefore, I assume this is not what you meant.
>
> Second, do you mean that you want us to analytically compute 
> intersection points of the circle with the line and clip in that way? 
> If that is what you mean, how is that considered using the 
> Sutherland-Hodgman polygon clipping algorithm?
>
> These are the only two things I could come up with. Did you mean 
> something else? Is there something I'm missing?
>
> Sorry for all the confusion, but I am really confused.
>
> Thanks,
> ~David


-- 
Andrew J. Pounds, Ph.D.  (pounds at theochem.mercer.edu)
Associate Professor of Chemistry and Computer Science
Mercer University,  Macon, GA 31207   (478) 301-5627



More information about the csc315 mailing list