NAME

viewget - get MGED view parameters

viewset - set MGED view parameters

SYNOPSIS

viewget s(ize)|e(ye)|c(enter)|a(et)|y(pr)|q(uat)

viewset type params ?type? ?params? ...

DESCRIPTION

Viewget returns the current value of the requested viewing parameters. The following viewing parameters may be requested:
size
The current viewsize.
eye
The current eye point, in the order x y z.
center
The current center point, in the order x y z. The center point is always directly in front of the eye point. The distance from the center to the eye is one half the viewsize.
aet
The azimuth, elevation, and twist of the current view. These angles are defined as follows: an aet of 0 0 0 indicates that the view faces the negative x direction, with the y-axis leading to the right and the z-axis going up. To reach any other aet, the eye is rotated +twist degrees about the x-axis, -elevation degrees about the y-axis, and azimuth degrees about the z-axis.
ypr
The yaw, pitch, and roll of the current view. These angles are defined as follows: a ypr of 0 0 0 indicates that the view faces the positive x direction, with the y-axis leading to the left and the z-axis going up. To reach any other ypr, the eye is rotated +twist degrees about the x-axis, -elevation degrees about the y-axis, and +yaw degrees about the z-axis.
quat
A unit quaternion representing the current view orientation, in the order x y z w. The identity quaternion, 0 0 0 1, represents the orientation of the press top command: facing the negative z direction with the x-axis to the right and the y-axis going up. For any other unit quaternion, x y z represents an axis of rotation, and w represents cos(theta / 2), where theta is the angle the view is rotated about the given axis. For example, the quaternion 0.707106 0.0 0.0 0.707106 represents the orientation achieved by the press right button, since this orientation can be obtained from the "top" orientation by rotating 90 degrees about the positive x-axis.

Viewset sets the current viewing parameters. Any of the parameter types returned by viewget can be set with viewset. For example,

mged> viewset ypr 35 25 0

sets the yaw, pitch, and roll to 35 25 0. More than one view parameter may be specified at one time. If two view parameters conflict with each other, then one of the parameters will be ignored. For example, if ypr and aet are set in the same command, one of the two is ignored. If neither center or eye is specified, then the center point will remain fixed while the eye point changes to accommodate a change in orientation or viewsize.

If no orientation or viewsize parameter is set, then the orientation and viewsize are normally unchanged. The exception occurs when center and eye are both specified in the same viewset command. In that case, the viewsize and orientation are calculated from the relationship between the center point and eye point. Fixing the center and eye point still leaves an extra degree of freedom; this ambiguity is resolved by selecting a "right-side up" orientation (in terms of aet, an orientation with no twist).

EXAMPLES

The following command could be executed in an MGED interaction window to obtain a typical top view:
mged> viewset center 0 0 0 size 2000 quat 0 0 0 1
mged> viewget ypr
Warning: roll arbitrarily set to 0.0; yaw set to 1.570796 radians.
90 -90 0
The warning message always occurs in relation to ypr and aet when the pitch or elevation is an odd multiple of 90 degrees. In that case, the yaw and roll become indistinguishable, and the arbitrary decision is made to set the roll or twist to 0.0.

In order to change the view orientation without moving the eye point, the following commands could be used:

mged> viewget eye
0 0 1000
mged> viewset eye 0 0 1000 ypr 0 0 0
mged> viewget center
1000 0 1000
mged> viewget eye
0 0 1000

Last updated July 8, 1997