CMPS 160 -- Lab 1
Early if time stamp is before midnight Oct 7, 2017.
On time if time stamp is before midnight Oct 8, 2017.
Late submissions will not be accepted/graded.
Objectives:
Rubberband lines and GUI.
Description:
For this assignment you will provide users the functionality to
draw connected line segments (polylines).
The initial point is specified when the user left-clicks on a blank canvas.
Subsequent points are specified by moving the mouse and left-clicking.
As the user moves the mouse, a temporary line is drawn from the previous
point to the current mouse position.
This line is continually updated (by erasing and redrawing the line)
as the mouse is moved.
The polyline is terminated when the user right-clicks on the canvas.
Requirements:
-
Create a blank (white) canvas at least 500 x 500 in dimension.
-
Recognize left and right mouse clicks.
Echo the mouse positions for each mouse click (use console.log).
-
Maintain a list of points representing positions of mouse clicks (both left and right).
-
Draw lines between pairs of points.
-
Draw rubberband line between the last point and the current mouse position.
-
Print out sequence of mouse click positions when a polyline is complete
(when right-click of mouse is detected).
Note that it's possile to draw multiple polylines.
For this assignment,
only one poyline is required.
Resource:
Check out the
ClickedPoints
and the
HelloTriangle_LINE_STRIP
examples from the Matsuda-Lea book.
Online resource on
mouse events may also be useful.
Grading:
-
Rubric:
You start off with 100 points. You earn additional credit by turning in your assignment
early and/or implementing additional features. You lose credit for missing functionality,
incorrect results, poorly documented or formatted code, or not following instructions.
Below is a partial list:
- up to 10 points off for poor features.html file
- up to 10 points off for inadequate comments or hard-to-read code
- up to 10 points off for not following instructions
- up to 10 points off for special handling to grade your homework (usually
because you did not check that it runs on the computers in the lab first).
- functionality points depending on importance
Make sure you:
a. submit the right files you want us to grade,
b. have tested your code on the browsers in the lab.
c. follow the general instructions described in overview.html
-
Who graded your assignment based on your login name:
cole: a - k
hugh: l - z
Submission:
See
course overview
for instructions on what to submit and what not to submit.
Put materials in a folder named lab1 and zip it up.
Submission must be done using the "submit" command from unix.ucsc.edu
- submit cmps160-ap.f17 lab1 lab1.zip
Last modified
Tuesday, 22-Jan-2019 09:42:16 PST.