For this assignment, you will create a rope simulator subject to gravity and collision detection. To simulate rope, you should use the mass spring model discussed in our lectures and in the readings. In this model, your rope is created from a series of particles connected with invisible springs. The springs exert forces on the particles. Gravity also exerts forces on the particles.
Your program should use a minimum of 10 particles.
There is no maximum number of particles. Experiment and use more if you'd like!
The particles should be evenly spaced along the length of the rope.
Both ends of your rope should be immobile. This means the particle at either end of your rope should not be subject to forces of gravity or spring forces.
You may choose the length of the rope as long as (1) the rope length is entirely visible on the screen and (2) there's some visible spacing between the particles.
Before your simulation begins, your rope should be in an initial horizontal rest state.
The particles all have the exact same weight: 1 kg
The invisible springs that connect each particle are weightless. You do not need to include the weight of the spring in your calculations.
The particles are subject to gravity. Choose a value for the gravitational constant. It does NOT need to be 9.8 m/s2 as your constant for gravity because that might be too much gravitatational pull. Experiment with different values.
The rope must detect when the particles come in contact with a stationary sphere.
The sphere must be below the rope's initial rest position. The sphere should not touch the rope at the initial rest position. This gives the rope an opportunity to fall on to the sphere when gravational and spring forces are applied.
The sphere is stationary. It does not move.
When one or more particles collide with the sphere, the sphere should absorb all the kinetic energy from the particles that come in contact. It is a perfectly inelastic collision. The sphere will not ever move.
I have provided you with a start program as basis for this assignment at http://www.robertjamesbruce.com/cs116b_assignment3.tar.gz (right mouse click then press "Save Link As...")
Your particles will be subject to spring forces and weight.
Use Hooke's law to compute spring forces: Force = k * x. The constant 'k' is a spring constant. Higher k values equate to a stiffer spring. The variable x refers to the spring's displacement from its rest position. The rest position of a spring is when the spring is neither in tension or compression. It's the natural rest state of the spring.
Use Weight = mass * acceleration of gravity (w = m * g).