### 3.5 Using the Mouse to Manipulate Objects

Geomview lets you manipulate objects with the mouse. There are six different mouse motion modes: Rotate, Translate, Cam Fly, Cam Zoom, Geom Scale, and Cam Orbit. The tools panel has a button for each of these modes; to switch modes, click on the corresponding button. You can also select these through the Motion Mode browser on the Main panel.

This section describes basic mouse interaction. For details, see Commands.

Figure 3.4: The Tools Panel.

Each of the motion modes uses a common paradigm for how the motion is applied. In particular, each depends on the current target object and the current center object. These are explained in the following paragraphs.

The current target object is shown in the Target field in the Tools panel. This is the same as the selected object in the Targets browser in the Main panel, and you can change it by either selecting a new object in the browser, by typing a new entry in the field, or by picking an object in a camera window by double-clicking the right mouse button with the cursor over the object.

The current center object is shown in the Center field in the Tools panel. Its default value is the special word "target", which means that the center object is whatever the target object is. You can change the center to any object by typing it in the Center field. The origin of the center object is held fixed in Rotate and Orbit modes. Normally the center object is one of the existing geoms listed in the Targets browser, and the actual center of rotations is the origin of that object's coordinate system. It is possible, however, to select an arbitrary point of interest on an object as the center. For details, see Point of Interest.

It is also possible to toggle the button BBox Center to set the center of motion to the center of the current object's bounding box. Once toggled, the active geometry's bounding box center will become the center of motion. If you select another object, then the center of motion will become the center of that object's bounding box. Nothing changes when a camera or the World is selected; you have to type in the word `target` in the Center field to reset to the default.

You apply a mouse motion by holding down either the left or middle mouse button with the cursor in a camera window and moving the mouse. Most of the modes have inertia, which means that if you let go of the button while moving the mouse, the motion will continue. It may be helpful to imagine the mouse cursor as being a gripper; when you hold a mouse button down, it grips the target object and you can move it. When you let go of the mouse button, the gripper releases the object. Letting go of the mouse button while moving the mouse is like throwing the object — the object continues moving independent of the mouse. Inertia can be turned off; see the Main panel's Motion menu, described below.

Generally, the left mouse button controls motion in the screen plane, while the middle mouse controls motion along or around the forward direction.

Pressing the shift key while dragging with left or middle mouse buttons in most motion modes gives slow-speed motions, useful for fine adjustment.

You can pick any point on an object (not just its origin) as the center of motion by holding down the shift key while clicking the right mouse button; this chooses a point of interest.

Rotate
  In Rotate mode, hold the left mouse button down to rotate the target object about the center object. Rotation proceeds in the direction that you move the mouse. Specifically, the axis of rotation passes through the origin of the center object, is parallel to the camera view plane, and is perpendicular to the direction of motion of the mouse. When the center is "target", this means that the target object rotates about its own origin.

  The middle mouse button in Rotate mode rotates the target object about an axis perpendicular to the view plane.

Translate
  In Translate mode, hold the left mouse button down to translate the target object in the direction of mouse motion. The middle mouse button translates the target along an axis perpendicular to the view plane.

  In Euclidean space, the center object is essentially irrelevant for translations. In hyperbolic and spherical spaces, where translations have a unique axis, this axis is chosen to go through the origin of the center object.

Cam Fly
  Cam Fly is a crude flight simulator that lets you fly around the scene. It works by moving the camera. Move the mouse while holding the left mouse button down to point the camera in a different direction. To move forward or backward, hold down the middle button and move the mouse vertically. Both of these motions have inertia; typically the easiest way to fly around a scene is to give the camera a slight forward push by letting go of the middle button while moving the mouse upward, and then using the left button to steer.

  Cam Fly affects the camera window that the mouse is in; it ignores the target object and the center object.

Cam Orbit
  Cam Orbit mode lets you rotate the current camera around the current center. The left mouse button does this rotation. The middle mouse button in Cam Orbit mode acts as in Cam Fly mode: it moves the camera forward or backward.

  In general Cam Orbit does not move the target object, although if the current camera is selected as the target and the center is also the target, it will pivot that camera about itself just as in Cam Fly mode.

Cam Zoom
  Cam Zoom mode lets you change the current camera's field of view with the mouse; hold the left mouse button down and move the mouse to change it. The numeric value of the field of view is shown in the FOV field in the Camera panel.
Geom Scale
  Geom Scale mode lets you enlarge or shrink a geom. It operates on the target object if that object is a geom. If the target is a camera, Geom Scale operates on the geom that was most recently the target object. Moving the mouse while holding down the left mouse button scales the object either up or down, depending on the direction of mouse motion. The center of the applied scaling transformation is the center object.

  Scaling is meaningful only in Euclidean space; attempts to scale are ignored in other spaces.

  Geom Scale mode does not have inertia.

The Stop, Look At, Center, and Reset buttons on the Tools panel perform actions related to motions but do not change the current motion mode.

Stop
  The Stop button causes all motions to stop. It affects all moving objects, not just the target object. Its keyboard shortcut is `H`.

  The keyboard command `h`, which does not correspond to a panel button, stops the current motion for the target object only.

Look At
  The Look At button causes the current camera to be moved to a position such that it is looking at the target object, and such that the target object more or less fills the window.

  The Look At command is unreliable in non-Euclidean spaces.

Center
  The Center button undoes the target object's transformation, moving it back to its home position, which is where it was when you originally loaded it into Geomview.
Reset
  The Reset button stops all motion and causes all objects to move back to their home positions.

The Tools panel also sports a Main button, to invoke the main panel in case it was dismissed or buried, and a Done button to close the Tools panel.

The Main panel's Motion menu has special controls affecting how mouse motions are interpreted; the toggles are also accessible through a GCL command. See `(ui-motion ...)`.

[ui] Inertia
  Normally, moving objects have inertia: if the mouse is still moving when the button is released, the selected object continues to move. When Inertia is off, objects cease to move as soon as you release the mouse.
[uc] Constrain Motion
  It's sometimes handy to move an object in a direction aligned with a coordinate axis: exactly horizontally or vertically. Selecting Constrain Motion changes the interpretation of mouse motions to allow this; approximately-horizontal or approximately-vertical mouse dragging becomes exactly horizontal or vertical motion. Note that the motion is still along the X or Y axes of the camera in which you move the mouse, not necessarily the object's own coordinate system.
[uo] Own Coordinates
  It's sometimes handy to move objects with respect to the coordinate system where they were defined, rather than with respect to some camera's view. While Own Coordinates is selected, all motions are interpreted that way: dragging the mouse rightward in translate mode moves the object in its own +X direction, and so on. May be especially useful in conjunction with the Constrain Motion button.