Professional Documents
Culture Documents
This assignment emphasizes importance (and difficulty) in performing the simplest of computer
graphics operationsdrawing straight line segments and circles.
Line Segment
Design and implement your own algorithm to draw a line segment using one of the
standard forms for specifying a line (point-slope, two-point, parametric)
Input parameters: four integers representing the two endpoints of the segment (x0,
y0) and (x1, y1) and the two dimensional array in which the line segment is to be
drawn
public static void drawLine (int x0, int y0, int x1, int y1, int[][] img)
Circle Part
Design and implement your own algorithm to draw a circle using one of the standard
forms for specifying a circle (center, radius)
Input parameters: three integers representing center of the circle (x0, y0) and (x1,
y1) and the two dimensional array in which the line segment is to be drawn along
with its width and height
public static void drawCircle (int x0, int y0, int radius, int[][] img)
Deliverables
A brief description of the two algorithms you designed (Line Segment Part I, Circle Part
I)
Create test programs to produce the following output image:
Images created for each test case above (.PNG, .TIFF, .BMP do not use .JPG)
A brief description of how well your algorithms worked in each case
All source code
All files should be archived into a .ZIP file. DO NOT ATTACH SOURCE CODE FILES
DIRECTLY INTO BLACKBOARD. While they appear to attach properly, .java files
will not attach successfully.
Notes
Your programs should contain bounds checking on all array accesses to ensure that the
scan conversion operations do not attempt to draw outside the provided 2D array.