Description
The purpose of this assignment is to complete the Python class graphicsWindow found in
file graphicsWindow.py. You are asked to program a method drawLine(p1,p2,color)
that draws a line in the image from point p1 to point p2 with color color. The points p1 and
p2 are expressed as matrices ( x , y)
T
(column vectors). The color is a tuple of the form
(r,g,b), where r,g,b are values between 0 and 255.
The method drawLine(p1,p2,color) must implement Bresenham’s integer line drawing
algorithm correctly, for lines of all slopes, and be properly documented (Header comments:
description of parameters, what the method does, and description of output. Code comments:
description of non-obvious sections of code).
• The class graphicsWindow is available in the Resources Section of OWL, under
Python Programs
• Do not change file name nor the actual name of the graphicsWindow class
• Make sure your method drawLine(p1,p2,color) is actually called drawLine
• Respect the type and order of the parameters
• Use the program testAssignment1.py to test drawLine(p1,p2,color). This
program is available in the Resources Section of OWL, under Python Programs
•
• The output of the test program should correspond exactly to the image
assignment1Image.png.This image is available in the Resources Section of OWL,
under Python Programs
• Use OWL to submit the file graphicsWindow.py, containing your method
drawLine(p1,p2,color)
• You must use Python 3.7 and PyCharm 2018.2 or above for this assignment. In
addition PIL and numpy must be installed for the assignment to work correctly
Marking Scheme and Submission
• Working program (50%): A working program which satisfies all of the requirements
automatically receives 50% of the total assignment mark. Each element of noncompliance will be penalized with respect to its severity
• Program Structure (25%): A program which follows the structured programming rules
(procedural, modular, uses parameters) to perfection automatically receives 25% of the
total assignment mark. Marks are deducted depending on severity and number of
occurrences of non-compliant elements
• Program Documentation (15%): Documentation should be complete. That is to say,
every non trivial part of the code should have a clear comment that explains it. In
addition, every method or function, including the main program should have an
explicative comment header. This header includes: module name, author, date of
creation and purpose. A description of parameters and their classification as either
input or output parameters. Marks are deducted according to the absence of these
elements
• Program Style (10%): Style refers to Occam’s razor principle. Code that is needlessly
tricky, obscure, or difficult to read will be marked accordingly. Program text indentation
is also an element of style and must be present. Significant constant, variable and
structure names must be used. Marks are deducted on the basis of the frequency of
these errors
• Submission: Through OWL exclusively. Only attachments are allowed