Animation : Springs
Spring-Mass simulations are perhaps the simplest physical simulation, since they require combining only two simple equations: Newton's Second Law of Motion and Hooke's Law.
The most famous example of this type of simulation is SodaPlay, which is based on the program XSpringies.
Specification
Write a Java program that simulates a Spring-Mass assembly animating within an empty world, using the other team's code listed with your pair. You will be given access to their entire code base and any documentation they have written in support of their code via Eclipse and their project website. You should be able to complete this project with only these materials, do not discuss the project with the team that wrote the original code.
Multiple assemblies with different properties should be able to animate within the same graphical world. How the assemblies deal with the world's boundaries should be configurable by the user, e.g., bounce off, pass through to the other side of the world (as if it were a flattened torus), ignore them completely, or be repelled by them as if by an anti-gravity force. Assemblies should be read from an XML file that provides its values, as in this example.
The world itself should have properties that can be set as well that are applied to all animating assemblies: such whether gravity is on or off, which direction gravity is applied, or the viscosity of the world's "air".
Users should be able to change the values of the world's or individual assembly's properties while the simulation is running. The user interface should provide a variety of controls to help the user experiment with their assemblies to observe the behavior that emerges. Different kinds of rules might provide different kinds of values that can be set, so the user should be able to save and reload a specific set of rules (and their parameters).
User should be able to interact with the assemblies by clicking and dragging the mouse. When clicked, the nearest mass in any assembly should be selected and a spring created between that mass and the current mouse position. The rest length of the spring should be determined automatically so that the user can pull the assembly by moving the mouse away from it or push it by moving towards it. This spring should be destroyed when the mouse is released so the user can click again to interact with another assembly.
Users should be able to add individuals, entire assemblies read from a file, or clear the simulation while it is running.
Code Review
As part of using another team's code to complete this project, you should evaluate how the design supported your attempts to extend the framework in ways that it was intended (new animations, factories, and GUI elements) and in other ways (interaction and world properties). You should also discuss how approachable the code was, in terms of its documentation and organization, to support you learning how to use it.
You should write a short summary for your evaluation of the code and the documentation and then provide a priority ordered list of specific concerns you encountered while using their framework. This document will be submitted after you have completed the project and used as a basis for discussion in class as your teams merge your code to move forward on the final project. I would suggest keeping a log of your concerns during the week, but waiting to write your summary until after you have submitted this project.
Deliverables
- Sunday, April 5. The final program must be submitted (one submission per pair). No reflection or project artifact is necessary for this project.
- Monday, April 6. A review of the other team's code must be submitted(one submission per pair) and provided to the other team for a discussion during class on Monday.