Viewing

Topic Description
Default Camera Behavior The 3D control automatically provides rotating and zooming.
Viewing Parameters The camera's position, direction, and up vectors.
Viewing Central Bodies ViewCentralBody zooms so that an entire central body is visible.
Viewing Extents ViewExtent zooms to a rectangular extent on the globe.
General Viewing View and ViewDirection provide direct control over the camera's position, direction, and up vector.

Default Camera Behavior

With no effort on your part, the 3D control automatically provides rotating and zooming in a 3D scene using the mouse.
  • Hold down the left mouse button and move the mouse to rotate.
  • Hold down the right mouse button and move to zoom in and out. Zooming uses a logarithmic scale; as the camera approaches the viewed object, the zooming speed slows down.
  • Hold down the shift key and the left mouse button and move to change the view direction without changing the camera position.
  • Hold down control and the left mouse button and move to lock horizontal movement so you can rotate vertically without accidentally changing your horizontal axis.
  • Hold down alt and the left mouse button and move to lock vertical movement.

Viewing Parameters

The Camera, provides full control over the camera's position and orientation. These are defined by three primary parameters:

  • Camera Position - The position of the virtual camera in the 3D scene.
  • Direction - A unit length vector indicating the direction that the camera is looking.
  • Up Vector - A unit length vector indicating the orientation of the camera. Informally, this can be thought of as how the camera's head is tilted.

The camera's position can be retrieved using the camera's Position property. The Position is returned in PositionReferenceFrame. Similarly, the direction and up vectors can be retrieved using Direction and UpVector, respectively. They are returned in the Axes.

Viewing Central Bodies

ViewCentralBody is used to set the camera's position so that an entire central body is visible. The view direction is set so that the camera is looking toward the center of the central body. ViewCentralBody is commonly used to restore a default view or view different central bodies as shown below.

[C#] Copy Code
scene.Camera.ViewCentralBody("Moon", root.CentralBodies.Moon.Vgt.Axes["Inertial"]);
scene.Render();

The second parameter to ViewCentralBody defines the axes of rotation. When the user holds down the left mouse button and moves, this is the axes that the camera is rotated around.

Viewing Extents

ViewExtent zooms to a rectangular extent on the globe. In the GraphicsHowTo, this is used to set the camera such that an entire image overlay is visible.

[C#] Copy Code
Array extent = ((IAgStkGraphicsGlobeOverlay)overlay).Extent;
scene.Camera.ViewExtent("Earth", ref extent);
scene.Render();

ViewExtent

Azimuth is an angle from the positive x axis, in this case local east, to rotate around z. Elevation is an angle to rotate from the xy plane toward z.

In the rotation axes used by the camera after a ViewExtent, an azimuth of 90 degrees is looking south, and an azimuth of 0 is looking west. An elevation of 90 degrees is looking straight down, and an elevation of 0 is looking toward the horizon.

General Viewing

View and ViewDirection are used for general purpose viewing. They provide direct control over the camera's position, direction, and up vector - as opposed to ViewCentralBody and ViewExtent, which set these parameters implicitly.

VGT is used to create a view position and a reference point at the point that the camera will look at; next, an axes of rotation is created using east-north-up axes, similar to the axes created by ViewExtent.