My own Work:
I the recitation I made something that will be part of my final (Actually most part has been made two days ago when I was playing with Processing):
Coding:
Homework in Recitation
Coding
GitHub as required:
https://github.com/Kris4869/ProcessingInteractiveDynamicNetArt
Things I learned:
I spent a whole day to finish it, learning from the scratch. So some of the important features I want to share and recommend to others:
1. Python Mode:
Python is a very powerful language and is supported in Processing. It has several important features: a) no type declaration, one can just type i = 1 instead of int i = 1; It saves a lot of troubles such as calculations between float and int etc..
2. Object Oriented Programming:
It is a very good thing that Processing supports OOP, the network.py and nodes.py are my OOP files, it enables a very easy and organized way to create complicated drawings especially dynamic drawings.
createShape() function is also an oop that gives you an object actually.
3. PShape.GROUP
The shape of GROUP is a very powerful to organize a set of elements, in my coding group is used to contain all the lines in the network.
4.Mouse Flag
In the implementation there is an issue. Once I pressed the mouse, there will generate more than one nodes, usually three. It is because the time the mouse is on press covers more then a loop, so in each loop it creates a new nodes. But a human cannot reaction that fast to release a mouse milliseconds after pressing. So I came up with that to set a flag = 1 in default, and when mouse pressed flag = 0; only when flag = 1 at the time the mouse is pressed will the program create a node. After releasing the mouse the flag goes back to 1.
5.Force Field
To keep the network in the screen but not run out of the screen too much, I created a forcefield on the border. (I could just set that when a node goes out of the border I put it back, but it looks unnatural.). I used the famous inverse square law in nature: in gravity / electromagnet force etc. When a node is nearer a border, it will receive larger force that pushes it back.