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.

Viewing Parameters

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

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.

STK Programming Interface 11.0.1