CSE 131 Module 8: List Structures


Falling Arches


In the past labs, we have come to view recursion as a powerful paradigm for computation. Similarly, recursive data structures allow one to build large, interconnected using relatively little effort. In this bridge, you construct a model for simulating the shape of a catenary: the shape of our beloved St. Louis arch.


By the end of this lab, you should

Before starting:

Problem description:

Long before our city began its expansion into the NFL, the pioneers of our country expanded to the West, crossing the Mississippi and braving the perils of midwestern life. As a monument to their efforts, the City of St. Louis erected Eero Saarinen's famous Arch in 1965. Its grace, beauty, and elegance have inspired poets, musicians, and artists of the past five decades.

It's time that CSE131 had its turn.

A catenary is the shape made when you suspend a string by holding its ends, and let gravity pull on the string. If you look at a telephone wire strung between two poles, the shape you see is a catenary, though not one that would necessarily garner artistic praise.

It turns out that our Arch is also a catenary, but situated upside down.

How are we to simulate an catenary acting on a string? If we look really closely at the string, we see that it is composed of a series of mass points, with each adjacent pair of masses connected by a spring.

With gravity turned off, the picture is as shown in Figure 1(a).

(a) (b)
Gravity turned off After 100 iterations
Figure 1. A sequence of masses connected by springs, at the beginning and end of the simulation.
Generally, the Javadoc is the best resource for understanding how the objects of this project's design relate to each other. Some notes follow but be sure to read the documentation carefully before you get started on writing code.
  • A MassRect is-a Mass that can display itself as a rectangle.
  • There are two extensions to Mass: FixedMass and MovableMass.
  • A spring obeys Hook's Law.

    After letting gravity have its way with the masses, and accounting for the springs between the masses, our picture as shown in Figure 1(b).

    To receive credit

    Be prepared to answer the following questions when you demo:
    1. What happens when the spring constant is large?
    2. Why do the masses continue to wiggle, even after the Arch seems finished?
    3. What happens when you have more masses, but the same gravity and spring constant?
    4. What happens when gravity increases?

    Extra fun: Modify your solution so that the Arch starts at the bottom of the screen, and falls up instead of down.