Due: Tuesday 3/18 10:00am

Submission name: w11_orbnodes

We will continue with the work started in class on using a node based Orb structure.

  • Start with the program developed in class.

  • OrbNode should also have the following methods
    • void display(int springLength)
      • Display the OrbNode.
      • If there is a next node, draw a line between this and the next OrbNode objects.
      • If there is a previous node, draw a line between this and the next OrbNode objects.
        • Move the endpoints for each of these lines a little bit so the lines dont directly overlap each other.
      • Make the color of the line related to the state of the spring (extended, compressed, neither).
    • void applySprings(int springLength, float springK)
      • Apply the spring force between the calling Orb and it’s next and previous neighbors when applicable.
  • Write a driver file that creates at least 3 OrbNodes and connects them. Then in draw
    • Use a while loop to display each OrbNode
    • Use a while loop to call applySprings on each OrbNode
    • Use a while loop to call run on each OrbNode
    • These loops should not be integer-counter based.

Reference Image:

a11-nodes