Homework 7: Clipping

Short Description:

Implement a clipping algorithm

This assignment is worth 10 points.

Goals

When you finish this homework, you should

Formal Description

Write a program that will clip lines against an arbitrary rectangular window.

Your program should read from the standard input.

Begin by reading the lower left and upper right hand coordinates of the clipping window. Then read a series of starting and ending points for a line. The input ends at the end of the file.

For each line, clip the line against the window and output the coordinates of the clipped line segment. If the line clips to a single point, output that point. If no line remains after clipping, print the word NONE.

Example Input:

20 20
40 40
0 0 50 50 
30 30 35 35
10 10 20 20
0 0 10 10
Example Output
20 20 40 40 
30 30 35 35
20 20
NONE
For each line your should output four correctly rounded integers, two correctly rounded integers or the word NONE.

Additional Requirements/Comments

Submission

Submit your file as an attachment to a message to dbennett@edinboro.edu. Please include your name, and the fact that this is homework 7 in the title of the message.