For this programming assignment, you will be given a source code template (including a subroutine for reading the input data and writing out integer data to an image file). The source code fragment will need to be downloaded from the web page.
All output for this programming assignment should have the 0,0 pixel in the Lower Left-hand corner of the image
Fill in the source code fragment to draw lines using the Bresenham line
drawing algorithm presented in class. The endpoints for the lines should
be read in from the data file "pa1_1.dat"
which is also available from the web. Your routine should determine which
pixels are turned on and set the appropriate values in 2-D unsigned char
array. The pixels that are turned on should be set to 255. Be sure to handle
all
cases.
Read in a set of endpoints for a series of line segments from the file "pa1_1.dat". After clipping, use the code generated in Problem 1 to draw the clipped lines (again, by setting the appropriate pixels in the 2-D unsigned char array). The clipping window is defined in the code fragment as
#define
VIEWX0 15
#define VIEWY0 15
#define VIEWX1 85
#define VIEWY1 85
Add to the code of problem 2, the Midpoint Circle-Drawing algorithm
and draw a partial circle with a radius of 30 centered at pixel 50,50,
starting at 71,71 and ending at 34,25. Do this after
clipping the "pa1_1.dat"
data. This means that you DO NOT clip the partial crcircle.
Image A: Translate: 0,0,0
Rotate: about Z 0, about Y 0, About X 0
(Angles in Degrees)
Image B: Translate -50,-50, -30
Scale 0.5, 0.5, 0.5 (This is so you can see
the whole object in your clipped window)
Rotate: about Z -45, about Y 0, About X -45
(Angles in Degrees)
Translate +50,+50, +30 (Centers the object on our screen)
Problem 1 Code Template | pa1temp.c |
Problem 1 PGM output Code | wrtimg.c |
Problem 1 2D Data Reader | rdinput.c |
Problem 1 3D Data Reader | rdinput3d.c |
Line End Point Data file | pa1_1.dat |
3D Data set for part 4 | pa1-3D.dat |
Problem 1 test data | pa1-test.dat |
Problem 1 test image | pa1-test.pgm |