SUN YAT-SEN UNIVERSITY
Homework 3: Draw a Circle
Computer Graphics
2017-03-14
1. Introduction
The goal of this assignment is to use the Bresenham’s Algorithm to draw a circle. To help you with this task, you can use OpenGL and freeGLUT/GLFW. Bresenham’s Algorithm is one of the most important algorithms in the Computer Graphics. If you want to draw a line or draw a circle, Bresenham’s Algorithm is your first choice. The core of this algorithm is using integer results to estimate the position of points. In class, we focused on line drawing. And now, we extend this topic to draw a circle!
Warning: All codes and documents should be written and submitted individually, without copying existed answers (Neither from other student nor from the Internet). Plagiarism = Fail. Besides, there may be at least 30% penalty for late homework.
2. Tasks
2.1 Pre-requirement
-
Language: Only C/C++ is accepted in this homework.
-
Libraries: OpenGL and freeGLUT/GLFW
-
IDE: Any IDE can be used.
2.2 Draw a Line
Implement your line rasterization algorithm in OpenGL. You can only use integer arithmetic in your code.
- Input: 2 2D points, that makes 4 integers, as a start point and an end point
- Output: A straight line in a window
- You can only use the
GL_POINTS
as primitives. Other (i.e.GL_LINES
orGL_LINE_STRIP
) primitives is not allowed to use. - Bonus for you if you implement more than one algorithms
2.3 Draw a Circle
Implement your circle rasterization algorithm in OpenGL. You can only use integer arithmetic in your code.
- Input: A point as the center of a circle and a radius, that make 3 integers
- Output: A circle in a window
- You can only use the
GL_POINTS
as primitives. Others primitives or build-in draw is not allowed to use. - Bonus for you if you implement more than one algorithms
3. Submitting Format
Please submit your homework to sysucg2017@163.com. You subject of the email should be as same as your attachment(aka. your .zip file)
Only a .zip file should be submitted. Under the .zip file, the content should look like this:
classTpye_studentID_Name_hw?_version?/
|— src/
|— doc/
|— bin/
- classType: R for required class(必修班); E for elective class(选修班).
- studentID: 1xxxxxxx
- Name: Your Chinese Name.
- hw?: Specific which homework you are submitting.
- version?: Specific if you modify your submitted homework, only the last version would be graded. Started with version0.
- src/: The folder holds your project, including source files.(Make sure you execute the clean command, we don’t need those temporary files)
- doc/: Only one PDF should be included.
- bin/: Executable program and a ReadMe.txt to tell us how to run your program.
For example, a student in required class want to submit homework2 for the second time, his .zip file should be:
R_16214382_艾伦麦席森图灵_hw2_version1.zip
|—R_16214382_艾伦麦席森图灵_hw2_version1/
|—src/ ——放整个工程
|—doc/ ——放report.pdf
|—bin/ ——放可执行文件和readme