Back to DFS's Workshop Page
Back to Agenda Page


Center of Gravity Problem

For this problem, you are to cannibalize any available code (such as that discussed in Graphics on the Fly) and write a trio of scripts which will allow up to five masses to be placed on a Cartesian grid and will calculate and show the center of gravity for this system.

  1. The HTML Page: centerofgravity.html
  2. The Driver PHP Script: centerofgravity.php
  3. The Graphics PHP Script: drawcenterofgravity.php
    Using all of the information passed to it by centerofgravity.php, create a PNG utilizing different, coordinated, contrastive colors to draw the following.

To see how this could work, view this possible solution.


© 2005 DFStermole
Created 7 Dec 05
Last Modified 8 Dec 05