You are on page 1of 2

Assignment 1 Scan Conversion

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)

This should be implemented as a callable function

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

One possible function prototype is:

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)

This should be implemented as a callable function

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

One possible function prototype is:

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:

o Color is not important

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.

You might also like