Basic Scene Editing

Contents

Starting Fungimol

Fungimol does not take any useful command line arguments. It interacts with the user in two ways: with an X window that displays the scene, and by prompting the user on its standard output and reading text responses on its standard input. Thus, when you run Fungimol, you will need to have both of these available as windows on the screen. One simple way to do this is to give the command
xterm -e fungimol &
and then to rearrange the new Xterm window and the Fungimol graphics window so they do not overlap. The Xterm window will not have any interesting text yet, but the Fungimol graphics window will have a large black expanse with something like this in the lower left corner:
This initial scene is simply some test data. It is a collection of 539 balls which are affected by gravity and can bounce off of each other and some invisble planes. They aren't moving yet because we have not yet given the command that starts time.

Changing the Point of View

Objects can move on the screen because they actually moved in the simulated world, or because the point of view has changed, or both. Right now the objects are not yet moving and we will only be changing the point of view. The middle mouse button is used to change the point of view.

Translating the Point of View

First, let's move the balls from the corner of the screen to the middle. Put the mouse over the balls, press the middle mouse button, drag the middle mouse button to the center of the screen, and then release the middle mouse button. The balls will follow the mouse to the middle of the screen. This operation changes the point of view; it does not change the location of any objects in the scene relative to each other.

Rotating the Point of View

Next we can look at the balls from a more natural perspective. Press and hold the control key, move the mouse over the balls, press the middle mouse button, and move the mouse. The scene will rotate about its center and depending on exactly how you move the mouse you may end up with an image like this:
There is a user interface bug here with an easy workaround. The mouse must be over the Fungimol window when you press the control key, otherwise Fungimol will ignore the control key. Another bug is that you have to press the control key before pressing the middle mouse button.

Control-middle-mouse rotates the scene as though there were a virtual trackball. The center of the scene is the center of the trackball, except that if something is selected (see below), the center of the selection is the center of the trackball. If the mouse is less than 200 pixels from the center, then moving the mouse rotates the trackball as though the mouse were translating an infinitely large flat hand that was rolling the trackball around. If the mouse is more than 200 pixels from the center, rotating the mouse around the center of rotation twists the scene around its center. For instance, if the balls are in the center of the screen and you start with the trackball in the lower right corner and drag it in a circular arc to the upper right corner, you might wind up with something like this:

Scaling the View

Shift-middle-mouse scales the view. If you move the mouse up and down, the view will get larger and smaller. If you move the mouse left and right, the view will move left and right, just as would happen if you were doing middle-mouse and moving the mouse left and right.

Selecting Objects

To edit the scene, you must first select the part of the scene you want to edit. The selection is displayed by making the selected objects blink. The left mouse button is used to select objects.

Selecting Something New

For example, the simplest way to select the blue balls is to use control-middle-mouse to rotate the point of view until they are to the left of the red balls:
and then to position the mouse at the upper left corner of the image of the blue balls, press the left mouse button, drag it to the lower right corner of the image of the blue balls, and release the left mouse button. The blue balls will start blinking:
The left, right, top, and bottom of region that is selected in space is determined by the rectangle swept out by the mouse. The region of space also has a minimum and maximum depth. The minimum depth is the depth of the nearest object that was inside the rectangle swept out by the mouse, and the maximum depth is equal to the minimum depth plus the width or height of the rectangle swept out by the mouse, whichever is larger.

We can use this limited depth to select just a few of the blue balls. To see this, first click anywhere on the black background with the left mouse button to deselect everything, then drag with the left mouse button from the middle of the image of the cube of blue balls to the lower right corner. You'll probably select 8 of the blue balls:

Clicking the left mouse button selects one object, since a click is a zero-size drag.

Adding to the Selection

Shift left mouse can be used to add to the selection. For instance if you leave those 8 blue balls selected, and shift-click the left mouse button on the upper left blue ball, you'll have 9 blue balls selected. If you drag shift-left-mouse over a region of the screen, all objects in a region of space are selected, with the region of space determined in the same way as when the unshifted left mouse button is dragged.

Selecting Molecules

In a section about selecting things it needs to be mentioned that control-left-mouse selects the molecule that includes the object under the mouse. We don't have any molecules yet, so we give an example for this later.

Editing the Selection

You can move, copy, or delete the selection.

Moving the Selection

The right mouse button moves the selection. For example, you can select the whole blue cube, press and hold the right mouse button, and move the mouse upward a short distance to get this:
Using shift-right-mouse changes the depth of the selection. If the mouse goes up and down, the selected objects move further or nearer to you; if the mouse goes left and right, the selection translates to the left or right, just as though you were using right-mouse. Unfortunately there are not enough depth cues in the scene, so changing the depth of the selection is completely invisible unless the move changes which objects are in front of other objects. For example, we can provide the depth cue by using right-mouse to translate the selected cube of blue objects so it is in the middle of the cube of red objects:
and then we can drag upward with shift-right-mouse to increase the depth of the blue objects so they sink down further into the red cube:
Another, less disruptive, way to provide the depth cue is to use control-middle-mouse to rotate the point of view after you've changed the depth of an object.

Control-right-mouse rotates the selection, and it shares most of the code with control-middle-mouse rotating the point of view. For instance, if we use right-mouse to move the blue cube back to its previous position at the left of the red cube, then release the right mouse button, then we can use control-right-mouse to rotate the blue cube:

The need to release the right mouse button here is a user interface bug. If you didn't release the right mouse button, the control key would have been ignored.

Copying the Selection

Control-C copies the selection. The copy is selected and placed slightly to the right of the original so you can see it. For instance, if we press control-c to copy the selected blue cube, the scene looks like this:
After creating a copy, it is generally a good idea to move the copy off of the original, since interpenetrating objects are confusing and the laws of physics tend to object to them. However, for the purposes of this tutorial we can just move on to the next section.

Deleting the Selection

Control-X deletes the selection. There is no undo feature or buffer that saves the deleted objects. Press control-X to remove the copy that we recently made.

Inspecting Objects

The "/" key can be used to give information about objects in the scene. The information is printed to the standard output from Fungimol, which will be an xterm window if you started Fungimol according to the instructions above.

If the mouse is over an object, information for that object is printed; it may look like this:

The cursor is pointing at object 518 which is a BouncingBall
at position (3.634542, 0.274381, 16.779156)
with no links
If one object is selected, and the cursor is over an object, then the distance between the selected object and the object under the cursor is also printed:
The cursor is pointing at object 518 which is a BouncingBall
at position (3.634542, 0.274381, 16.779156)
with no links
The distance from selected object 517 is 1.999999
Last, if the cursor is not pointing at any object, the program will tell you how many objects are selected. For example, after selecting the entire scene, this message is possible:
539 objects selected

Starting and Stopping Time

Fungimol can also simulate physics. The command "s" either starts or stops time. It prints relevant messages to the text window. If you start time now, you can watch the balls bounce around. All scene editing operations still work when time is progressing, although they are a bit slower and it can be confusing to edit a moving object.

If you start time when there are interpenetrating objects, then they'll tend to move quite violently. For this scene, be aware that there are four invisible planes that these balls bounce off of; it is quite easy to cause a ball to interpenetrate one of these invisible planes.

Here's what the bouncing balls look like after a little bit of time passes:

After you get tired of watching the balls bounce, press "s" to stop time, press "n" to get a new scene (so the balls will be nice and tidy again), select all of the balls, and delete them. This will leave the scene empty. Then you can move on to the next chapter of the tutorial.
Copyright 2000 Tim Freeman <tim@infoscreen.com>