New! Hire Essay Assignment Writer Online and Get Flat 20% Discount!!Order Now
COMP115
AU
Macquarie University
When an arrow key is pressed, all nodes must move up by 1 unit grid cell distance in corresponding direction.
Let's say the display window is of size (700, 500) such that each column is 35 pixels wide and each row is 25 pixels high.
Let's say the two nodes so far are at (240, 65) and (124, 75)
If the UP key is pressed, the two nodes should move to (240, 40) and (124, 50).
If the DOWN key is pressed (instead of UP key), the two nodes should move to (240, 90) and (124, 100).
If the LEFT key is pressed (instead of UP key), the two nodes should move to (205, 65) and (89, 75).
If the RIGHT key is pressed (instead of UP key), the two nodes should move to (275, 65) and (159, 75).
When you click at any location, the node should be generated at the closest grid intersection point.
The most useful material for this part is compound data.
For each node, calculate the sum of distances of that node from every other node.
The node that has the lowest cumulative distance should be coloured red.
The node that has the highest cumulative distance should be coloured blue.
The most useful material for this part is compound data and functions.
You can pick-up a node (using mousePressed), drag it and drop it (using mouseReleased) to another point. The node must be dropped at the grid intersection point closest to the where the mouse is released.
TASK 1
Double-clicking at an already existing node should remove the node.
TASK 2
If none of the lines are intersecting (besides adjacent lines having a common point), the whole shape must be filled with colour code (0, 0, 255, 127) (semi-transparent blue).
TASK 3
Each time you press the ENTER key, a new graph is generated. The old graph should still be displayed on the display window. Submission You must submit your complete Processing sketch as a single pde file ass2.pde by the due date.
Why do these exist?
• You cannot use any extra processing libraries or plugins.
• You cannot use any Java libraries or plugins.
• You cannot use classes.
• You cannot use multiple tabs or multiple files.
• You cannot use transformations such as rotate,translate, scale.
• You cannot use images.
• You must submit a single pde file.
Unfortunately, we can't accept re-submissions if you submit your assignment incorrectly. If you submit an empty file, the wrong file, a zip file, a file in the wrong format, etc - you will get zero marks. It is your responsibility to check your submission prior to the due date. Any and all submissions made after the due date will have a late penalty applied unless a valid special consideration request has been approved.
Please note that once you upload your processing file (.pde extension), if you Download it again and open it, Processing will give the following warning message:
15,000+ happy customers and counting!