Assignment 2 - Using Bresenham's Algorithm
CS4961 - Computer Graphics
Due February 7, 2001, 10:45 AM
Overview
This project gives you some practice using Bresenham's algorithm to draw lines and circles.
Project Requirements
The following are requirements for the project. Your grade will be based on
whether you completed all of them.
Your program must:
- Draw lines using Bresenham's algorithm. The user should be allowed to select
the start and end points by specifying their numeric coordinates. The
program should draw any slope of line.
- Draw circles using Bresenham's algorithm. The user should be allowed to numerically
select a center and radius for the circle.
GL and GLUT both contain functions that will draw lines and/or circles.
YOU MAY NOT USE THEM. In all cases, drawing to the screen must
be accomplished by specifying each pixel to draw. The purpose of the
assignment is not to draw a line and circle; it is to use Bresenham's algorithm to
draw a line and a circle.
In addition to the above requirements, you must also provide:
- Documentation - Briefly explain what your program does and how to operate it. In
addition, describe all data structures, major functions, and the program's flow of
control.
- User interface - The program should be controlled by user events and display
to the screen. Any input from or output to the console window will not be considered
for grading purposes.
Turn in all your code and documentation using submit (on CS machines)
or handin on CADE machines. Your code will be tested using whatever
environment you turn it in on (CS or CADE). Your code should be written in
C/C++ and compile using gcc/g++. The project folder for submit and handin is
named bresenham. (submit cs4961 bresenham file1 file2...)
You do not need to worry about antialiasing, varying the line intensity
with the slope, or the endpoint order. You are not required to display more than
one object at a time.
Resources
You can use the template and
Makefile from the sketchpad assignment to serve as
the base of your program. It contains all the GL code you need - just fill in
the canvas structure to draw points. Alternatively, you may write something yourself;
just make sure you draw the line pixel by pixel.
Final Notes
This section contains any final notes regarding this project ether due to
questions raised by students or discoveries of my own. I will send messages
to the class mailing list announcing any notes or clarifications, but this
will contain a digest of all such info. These notes will never change what
is required in the project, but may clarify some formerly ambiguous points
and so should be checked semi-regularly.
- On CS Suns, GLUI causes the line initfuncCalled = -7676776 to be
printed to the screen whenever the drawing window is reset. Aside from being
annoying, this has no other detrimental effects and may be ignored.
- GLUI allows the user to clamp input values to such things as spinners
and integer edit text boxes. I would prefer it if you would not do that
with regard to the start and end points of lines and the center and radius
of your circles. In other words, I should be allowed to specify any points
even if they are outside the drawing window. You will need to make sure you
don't end up drawing points outside the image buffer (canvas) which would
cause a segmentation fault.