Plane and Thread Example
14-January-2006

This is a simple demonstration with plane and thread objects.

The following example will help you get started using SPRING with a mouse and some simple models.

  1. Compile, link, and start the SPRING application. If you have difficulties with this, please contact me at cwcornelius@stanford.edu>.
  2. Once the program has started, select the menu item "Simple Games" under Scenarios button in the menu bar. Under that tab, select "thread + plane".
    At this point, the screen will show a rectangular plane plus a straight red object in front of it. Note also that the word "paused" appears at the upper right, indicating that the physical simulation part of SPRING is not running. You may also note a small green marker at the center of the window. This shows the location of the "sensor", which will be connected to the mouse later in the scenario. In this scenario, the user can move the thread object, effectively sewing it through the plane. Tools can also be used to move the nodes of the plane object, deforming it interactively.
  3. At this point the mouse and keyboard are able to manipulate the view. Note that the Mouse menu item changes the mouse's actions. By default, the mouse is in the "Rotate/Clip/Drag" mode. In this mode, left mouse drags rotate the view, middle mouse drags move a clipping plane in and out, and the right mouse drags move the scene horizontally and also nearer or farther from the viewer. Move the 3-D scene by using clicking and dragging the left mouse button. This should change the orientation of the view. Next, experiement with moving the view in and out by clicking and dragging the right mouse button. Click and drag of the right button while moving left and right moves the scene left and right too. Next, click and drag with the middle mouse key pressed to see how the clipping plane is moved.
  4. Next, experiment with different mouse modes: a. Choose "Rotate" under the Mouse menu. Note that this restricts motions to rotations about a point. b. Choose "Translate" in the same menu. Note the actions of the mouse buttons when dragging. c. For the moment, avoid the "Clipping Plane" option.
  5. SPRING uses many keyboard "shortcuts". The most commonly used are:
    1. The keys "j" and "k" rotate the view left and right.
    2. Keys "i" and "m" rotate the view up and down.
    3. Arrow keys move the view in the directions up, down, left, and right.
    4. The "-" key moves the view away from the user, and "+" moves it toward the viewer.
    5. The Tab key selects the visible objects, drawing a red outline enclosing an object. Each time the Tab key is pressed, the selection moves to the next object in SPRING's "universe", the set of objects being presented.
    6. The space bar toggles the state of the simulation from paused to running and back.
    Practice using these keys to move the viewpoint, and to select the objects shown. Also note the change from "paused" to "running" when the space bar is pressed. Return the state to "paused" before proceeding. *** Very important: All key commands are case-sensitive. Check the caps lock state if the keys do not work as expected.
  6. Change the size of the display window. Note that the view magnifies to match the change in shape of the window.
  7. Now we're ready to try some of the default tools, using the mouse to control the 3-D position and orientation.
    1. Under the Toolbox menu item, choose the "forceps" submenu, then select "forcep". Observe that a white object similar to a tweezers is now shown poking through the plane.
    2. Move the view using either the mouse or the keyboard controls to see the forceps half way through the plane.
    3. Now select the "Sensor" option under the Mouse menu. Click and drag with the right mouse button. You will see that the green marker moves parallel to to plane.
    4. Use the rotate keys to look at the motion from different points of view.
    5. Now start the simulation by pressing the space bar. Make sure that the state changes to "running".
    6. f. Click and drag with the left mouse button. Note that the angular orientation of the forceps changes, while leaving the end with the green marker stationary. Reposition the view with the rotate keys to observe the motion better.
    7. Next, click and drag with the right mouse button. Note that the forceps moves laterally parallel to the plane. Rotate the view to show the plane "head on" to observe the two directions of motion of the forceps.
  8. Now we're ready to move the forceps in 3-D. This requires changing the mouse's control for full 3-D motion, since the mouse only provides 2 values for the computer.
    1. Under the Mouse menu, choose "Grabby". This allows the 3-D motion, and also lets the user control the forceps's pinching action.
    2. Position the view with the rotate keys to view the side of the forceps.
    3. Click the left mouse button. You should see the tips of the forceps close when the left mouse is pushed.
    4. While the left mouse is pushed, select the right mouse key and drag. Note that the forceps remains closed while the forceps moves in a 2-D plane.
    5. Now, change the directions that the right mouse button affects by pressing the "z" key. Drag with the right mouse button, observing that forward and backward motions now move the forceps perpendicular through the plane (the "z" direction.)
    6. Position the tips of the forceps near the plane's surface. Hint: change the 3-D view using the rotate keys to observe the plane from its side.
    7. g. Now "grab" the surface of hte plane by clicking and holding the left mouse button. Then, click and hold the right mouse button (don't let go of the left button), and move the forceps in the z direction. The plane surface will move with the forceps tips deforming the surface.
    8. h. Release the plane surface and observe that it relaxes toward it's original shape (slowly).
    9. i. Move to another position, grab the surface, and push the forceps into the plane. This will push the plane, again deforming the surface.
    Continue working with the motions of the mouse to bend the plane.
  9. Select the plane object by pressing the tab key until a red wireframe appears around the plane on the screen.
    1. Under the "View" item on the menu bar, choose the "Object Attributes" option. A dialog of the objects characteristics will be displayed. Use the mouse to drag this dialog out of the way so the plane object is visible.
    2. Expand the "Graphics" option on the right side of the dialog. This controls how the object is shown.
      1. Change the Mode to "Wireframe" and see how the plane object is shown as a set of connected triangles. These are the 3-D nodes and edges of the plane's definition. Note that the coarse grid results in the "tenting" of the surface when a single point is pulled with the forceps.
      2. While in the wireframe mode, grab a point with the forceps to see how the grid deforms as a point is moved. Release the point, and note how the surface slowly relaxes.
      3. Experiment with "Flat" shading vs. "Smooth"
      4. Turn on the "Face Normals" option to see lines that show the direction perpendicular to each face. Watch these change as points are moved.
      5. Now select "Draw Initial Position" to see where the grid points were originally placed.
      6. Choose the "Smooth" mode. Next, select the material properties control, and modify the Green entry under "Front Diffuse" to 1.0. The plane will now be a light green color.
  10. You have probably noticed that the plane appears completely black when the view is rotated behind the object. This is because the default lighting model has only one light source, and there is no ambient lighting.
    1. First, change the "Back ambient" lighting of the plane to the value 0.2 for each of the Red, Green, and Blue values. Note that the back side of the plane is now visible, as if lit by a dim source.
    2. Now, under the "View" item in the menu bar, select "Lighting", then pick "Create New Light". Note that the scene is more brightly lit, due to the addition of a second light source.
    3. Next, select "Lighting Options..." under the Lighting selection under View. Select "Light #1"
      This presents a dialog that allows control of the X, Y, and Z origin of the light source, as well as the color, diffuse, and specular aspects of the source.
      Manipulate the characteristics of this new light source, observing the effect on the view.
      Hint: rotate the view to see the effect of X, Y, and Z positions of the light source.
  11. Now try changing the characteristics of the plane's physics. a. Reopen the Object Attributes of the plane object. b. Open the tab "Simuation". Change the Spring Constant to 5.0. c. Grab part of the plane and move it. Observe changes in its relaxation with different spring constant values.
  12. Next, manipulate the "thread" object. a. First, use Tab to select the thread object. b. Open its Object Attributes and change the color to yellow by changing the Front Diffuse values for both Red and Green to 1.0. c. Now move the forceps so the tip is near one end of the thread. d. Use the left mouse to close the forceps and "grab" the end. e. Use right mouse dragging to move the thread through the plane. f. Now move the forceps to the left or right while continuing to "hold" the thread. Use the rotate keys to see the thread on the back of the plane object. g. Now pull the thread back through the plane. Observe that the thread is pulled through the plane in a natural "follow the leader" motion.
This is an introduction to some simple tools in SPRING. The simulation has many other options, and we recommend that you try some of other simple games under "Scenarios", including the Microsurgery options. Note that some of the scenarios require data that we have not yet provided.
Spring and thread
And please look for additional documentation on SPRING's use as it becomes available on SourceForge.

Please contact us at our SourceForge e-mail.