| Customize Help
| Save Settings

M3ddispSetView



Function Map
Synopsis
Sets the display's view.
Syntax
void M3ddispSetView(
MIL_ID Disp3dId, //in
MIL_INT64 Mode, //in
MIL_DOUBLE Param1, //in
MIL_DOUBLE Param2, //in
MIL_DOUBLE Param3, //in
MIL_INT64 ControlFlag //in
)
Description

This function changes the position and orientation of the view of the specified 3D display.

Note that, by default, you can also change the position of orientation of the view interactively using the keyboard and mouse. You can enable or disable the keyboard and mouse controls using M3ddispControl() with M_KEYBOARD_USE and M_MOUSE_USE.

This function changes the view of the 3D display by modifying the viewpoint, interest point, and/or up vector, as shown in the image below:

You can set the position of the viewpoint using M_VIEWPOINT, the position of the interest point using M_INTEREST_POINT and the direction of the up vector using M_UP_VECTOR. All other modes are alternatives to adjusting these aspects of the view directly. For example, setting the M_ROLL of the view is an alternate method to change the M_UP_VECTOR setting.

Most modes are specified in absolute terms (for example, using M_AZIMUTH with the value 90 sets the azimuth to 90, regardless of the current value). In some cases, you can instead specify to apply the operation relative to the current state of the view using M_COMPOSE_WITH_CURRENT. For example, if you use M_AZIMUTH with M_COMPOSE_WITH_CURRENT and the value 90, and the current azimuth is 30, the new azimuth is 120.

Modes that can be performed by moving either the viewpoint or the interest point will always move the viewpoint, unless you use the combination value M_MOVE_INTEREST_POINT. For example, if you use M_AZIMUTH with the value 45, by default the viewpoint is moved to the position that is rotated 45 degrees around the interest point (relative to the plane that intersects the interest point and is parallel to the ZY-plane), effectively circling the view around the interest point. If you specify M_MOVE_INTEREST_POINT, instead the interest point is moved to the position in which the viewpoint is rotated 45 degrees around the interest point, effectively panning the view. Both modes result in the same orientation (the viewpoint is rotated 45 degrees around the interest point); however, in the first case the viewpoint has a new position, and in the second case the interest point has a new position.

Optionally, you can specify not to refresh the rendered image shown in the 3D display by setting the ControlFlag parameter to M_NO_REFRESH. This is useful for making several consecutive changes to the view while only displaying the final result. The view begins refreshing again the next time you use M3ddispSetView() without specifying M_NO_REFRESH.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
Disp3dId

Specifies the identifier of the 3D display.

Mode

Specifies the mode used for setting the view.

See the Parameter associations section for possible values that can be specified.

Param1

Specifies the first parameter used to set the view.

See the Parameter associations section for possible values that can be specified.

Param2

Specifies the second parameter used to set the view.

Set this parameter to M_DEFAULT if not used.

See the Parameter associations section for possible values that can be specified.

Param3

Specifies the third parameter used to set the view.

Set this parameter to M_DEFAULT if not used.

See the Parameter associations section for possible values that can be specified.

ControlFlag

Specifies if the 3D display should be refreshed.

function map For specifying if the display should be updated
Click to summarizeValue Description
Click to summarize M_DEFAULT

Specifies to refresh the 3D display immediately after the operation is complete.

Click to summarize M_NO_REFRESH

Specifies not to refresh the 3D display immediately after the operation is complete. This can be used to call the function multiple times before the 3D display is refreshed.

(summarize)

The table below lists possible values for the Mode, Param1, Param2, and Param3 parameters.

function map For setting the view
Click to summarizeMode Description
Param1
Param2
Param3
Click to summarize M_DEFAULT

Same as M_AUTO.

(summarize)
Click to summarize M_AUTO

Sets the viewpoint and interest point position so that everything in the scene is within the view.

(summarize)
Click to summarize Param1

Specifies one of the following.

(summarize)
Click to summarize M_DEFAULT

Specifies that the orientation of the view is preserved. The viewpoint and interest point are moved so that the entire contents of the 3D graphics list are centered and visible in the view.

(summarize)
Click to summarize M_BOTTOM_TILTED

Specifies to use a view that is an interpolation between bottom, front, and left views.

Click to summarize M_BOTTOM_VIEW

Specifies to set the orientation of the view so that the viewpoint is directly below the interest point (parallel to the Z-axis of the working coordinate system of the 3D display).

Click to summarize M_FRONT_VIEW

Specifies to set the orientation of the view so that the viewpoint is directly in front of the interest point (parallel to the Y-axis of the working coordinate system of the 3D display).

Click to summarize M_LEFT_VIEW

Specifies to set the orientation of the view so that the viewpoint is directly to the left of the interest point (parallel to the X-axis of the working coordinate system of the 3D display).

Click to summarize M_REAR_VIEW

Specifies to set the orientation of the view so that the viewpoint is directly behind the interest point (parallel to the Y-axis of the working coordinate system of the 3D display).

Click to summarize M_RIGHT_VIEW

Specifies to set the orientation of the view so that the viewpoint is directly to the right of the interest point (parallel to the X-axis of the working coordinate system of the 3D display).

Click to summarize M_TOP_TILTED

Specifies to use a view that is an interpolation between top, front, and left views.

Click to summarize M_TOP_VIEW

Specifies to set the orientation of the view so that the viewpoint is directly above the interest point (parallel to the Z-axis of the working coordinate system of the 3D display).

Click to summarize M_AZIM_ELEV_ROLL +

Sets the azimuth and elevation of the viewpoint relative to the interest point, and the roll of the view. These are the viewpoint position and up vector, described in a spherical coordinate system (additionally described by M_DISTANCE).

Azimuth is the angle of the viewpoint relative to the interest point on the XY-plane. An azimuth of 0 corresponds to a view where the viewpoint and interest point are parallel to the X-axis on the XY-plane, with the viewpoint on the positive side. Increasing values for the azimuth correspond to rotating the view counter-clockwise around the interest point.

Elevation is the angle of the viewpoint relative to the interest point on the XZ-plane. An elevation of 0 corresponds to a view where the viewpoint and interest point are parallel to the X-axis on the XZ-plane, with the viewpoint on the positive side. Increasing values for the elevation correspond to rotating the view counter-clockwise around the interest point in the XZ-plane.

Roll is the angle that describes how much the view is rotated to the right. A roll of 0 corresponds to a view for which up is positive on the Z-axis.

(summarize)
Click to summarize Param1

Specifies the azimuth of the viewpoint relative to the interest point, in degrees.

Click to summarize Param2

Specifies the elevation of the viewpoint relative to the interest point, in degrees.

Click to summarize Param3

Specifies the roll of the view, in degrees.

Click to summarize M_AZIMUTH +

Sets the azimuth of the view.

(summarize)
Click to summarize Param1

Specifies the azimuth of the view relative to the interest point.

Click to summarize M_DISTANCE +

Sets the distance between the viewpoint and the interest point.

(summarize)
Click to summarize Param1

Specifies the distance between the viewpoint and the interest point.

Click to summarize M_ELEVATION +

Sets the elevation of the view relative to the interest point.

(summarize)
Click to summarize Param1

Specifies the elevation of the view relative to the interest point.

Click to summarize M_FLIP

Sets the view to a position and orientation that is flipped around the interest point in the specified axis.

(summarize)
Click to summarize Param1

Specifies one of the following.

(summarize)
Click to summarize M_AXIS_X

Specifies to flip the viewpoint around the interest point in the specified axis.

Click to summarize M_AXIS_Y

Specifies to flip the viewpoint around the interest point in the specified axis.

Click to summarize M_AXIS_Z

Specifies to flip the viewpoint around the interest point in the specified axis.

Click to summarize M_INTEREST_POINT +

Sets the position of the interest point.

(summarize)
Click to summarize Param1

Specifies the X-coordinate of the position of the interest point.

Click to summarize Param2

Specifies the Y-coordinate of the position of the interest point.

Click to summarize Param3

Specifies the Z-coordinate of the position of the interest point.

Click to summarize M_ORBIT_HORIZONTAL +

Sets the angle of the viewpoint's horizontal orbit around the interest point. This angle is used relative to the M_UP_VECTOR of the view. For more information, see the Orbit, up-vector, and distance subsection of the Manipulating the view section of Chapter 37: 3D Display and graphics.

Note that orbit is always specified relative to the current position of the view. For example, repeatedly using this function with M_ORBIT_HORIZONTAL and the value 90 will repeatedly orbit the viewpoint horizontally around the interest point, in 90 degree increments.

(summarize)
Click to summarize Param2

Specifies the angle of the viewpoint's horizontal orbit around the interest point.

Click to summarize M_ORBIT_VERTICAL +

Sets the angle of the viewpoint's vertical orbit around the interest point. This angle is used relative to the M_UP_VECTOR of the view. For more information, see the Orbit, up-vector, and distance subsection of the Manipulating the view section of Chapter 37: 3D Display and graphics.

Note that orbit is always specified relative to the current position of the view. For example, repeatedly using this function with M_ORBIT_VERTICAL and the value 90 will repeatedly orbit the viewpoint vertically around the interest point, in 90 degree increments.

(summarize)
Click to summarize Param2

Specifies the angle of the viewpoint's vertical orbit around the interest point.

Click to summarize M_ROLL +

Sets the roll of the view. This is an angle which defines what direction the top of the view will be pointing, with 0 degrees specifying that the view will be perfectly level. As this value increases, the view rolls to the right.

(summarize)
Click to summarize Param1

Specifies the roll of the view, in degrees.

Click to summarize M_TRANSLATE

Applies a translation to the viewpoint and interest point without altering their relative position and orientation.

(summarize)
Click to summarize Param1

Specifies the translation along the X-axis to apply to the positions of the viewpoint and interest point.

Click to summarize Param2

Specifies the translation along the Y-axis to apply to the positions of the viewpoint and interest point.

Click to summarize Param3

Specifies the translation along the Z-axis to apply to the positions of the viewpoint and interest point.

Click to summarize M_UP_VECTOR

Sets the vector which defines what direction the top of the view is pointing.

Note that this setting is normalized and adjusted to a unit vector that is orthogonal to the current orientation of the view. If you use M3ddispGetView() with M_UP_VECTOR after setting the up vector, the returned value will therefore typically be different from the vector you specified.

(summarize)
Click to summarize Param1

Specifies the X-component of the up vector of the view.

Click to summarize Param2

Specifies the Y-component of the up vector of the view.

Click to summarize Param3

Specifies the Z-component of the up vector of the view.

Click to summarize M_VIEW_BOX

Sets the viewpoint and interest point (without altering the orientation) such that the interest point is at the center of the box and the entire region defined by the box is within view.

(summarize)
Click to summarize Param1

Specifies one of the following.

(summarize)
Click to summarize M_WHOLE_SCENE

Specifies to set the viewpoint and interest point so that everything in the scene is within the view.

Click to summarize 3D box geometry object ID

Specifies the identifier of the 3D box geometry object used to set the 3D display's view. The 3D box geometry object must have been previously allocated using M3dgeoAlloc() with M_GEOMETRY, and must have been successfully defined.

(summarize)
Click to summarize Param2

Specifies one of the following.

(summarize)
Click to summarize M_DEFAULT

Specifies the default value; the default value is 1.

Click to summarize Value > 0

Specifies the scale factor. The position for the viewpoint is calculated as though the box is scaled by this factor.

(summarize)
Click to summarize M_VIEW_MATRIX +

Sets the view to match a transformation matrix. If the transformation matrix is the identity matrix, the viewpoint will be at (0,0,1), with the interest point at the origin (0,0,0) and an up-vector of (0,1,0). This can also be thought of as a direct top-down view, with the up-vector aligned with the Y-axis.

You must specify the MIL identifier of a similarity transformation matrix. You can determine whether a transformation matrix is a similarity transformation matrix using M3dgeoInquire() with M_SIMILARITY.

(summarize)
Click to summarize Param1

Specifies the following.

(summarize)
Click to summarize MatrixId

Specifies the MIL identifier of a similarity transformation matrix (previously allocated using M3dgeoAlloc() with M_TRANSFORMATION_MATRIX).

Click to summarize M_VIEW_ORIENTATION +

Sets the direction in which the view is looking. This moves the viewpoint (or interest point if combined with M_MOVE_INTEREST_POINT) so that line of sight matches a given orientation, specified using either a predefined orientation or a vector that defines the direction from the viewpoint to the interest point.

(summarize)
Click to summarize Param1

Specifies one of the following.

(summarize)
Click to summarize M_BOTTOM_TILTED

Specifies to use a view that is an interpolation between bottom, front, and left views.

Click to summarize M_BOTTOM_VIEW

Specifies to set the orientation of the view so that the viewpoint is directly below the interest point (parallel to the Z-axis of the working coordinate system of the 3D display).

Click to summarize M_FRONT_VIEW

Specifies to set the orientation of the view so that the viewpoint is directly in front of the interest point (parallel to the Y-axis of the working coordinate system of the 3D display).

Click to summarize M_LEFT_VIEW

Specifies to set the orientation of the view so that the viewpoint is directly to the left of the interest point (parallel to the X-axis of the working coordinate system of the 3D display).

Click to summarize M_REAR_VIEW

Specifies to set the orientation of the view so that the viewpoint is directly behind the interest point (parallel to the Y-axis of the working coordinate system of the 3D display).

Click to summarize M_RIGHT_VIEW

Specifies to set the orientation of the view so that the viewpoint is directly to the right of the interest point (parallel to the X-axis of the working coordinate system of the 3D display).

Click to summarize M_TOP_TILTED

Specifies to use a view that is an interpolation between top, front, and left views.

Click to summarize M_TOP_VIEW

Specifies to set the orientation of the view so that the viewpoint is directly above the interest point (parallel to the Z-axis of the working coordinate system of the 3D display).

Click to summarize Value

Specifies the X-component of the vector that defines the orientation of the view.

Click to summarize Param2

Specifies the Y-component of the vector that defines the orientation of the view.

Click to summarize Param3

Specifies the Z-component of the vector that defines the orientation of the view.

Click to summarize M_VIEWPOINT +

Sets the position of the view.

(summarize)
Click to summarize Param1

Specifies the X-coordinate of the position of the view.

Click to summarize Param2

Specifies the Y-coordinate of the position of the view.

Click to summarize Param3

Specifies the Z-coordinate of the position of the view.

Click to summarize M_ZOOM +

Zooms the view in or out by a factor. This is equivalent to dividing M_DISTANCE by the specified factor.

(summarize)
Click to summarize Param1

Specifies the factor by which to zoom the view. This must be set to a value greater than 0.0.

(summarize)

You can add the following value to the above-mentioned values to specify that the viewpoint is moved relative to the current position and orientation of the viewpoint..

function map Specifies whether the motion is absolute or relative.
Click to summarizeCombination value Description
Click to summarize M_COMPOSE_WITH_CURRENT

Specifies that the view is altered relative to the current position and orientation of the view.

You can add the following value to the above-mentioned values to specify that the interest point is moved instead of the viewpoint..

function map Specifies whether the interest point should move
Click to summarizeCombination value Description
Click to summarize M_MOVE_INTEREST_POINT

Specifies that the interest point is moved instead of the viewpoint.

Compilation information
Header Include mil.h.
Library Use mil.lib; mil3d.lib.
DLL Requires mil.dll; mil3d.dll.
DEFAULT NO REFRESH DEFAULT AUTO DEFAULT BOTTOM TILTED BOTTOM VIEW FRONT VIEW LEFT VIEW REAR VIEW RIGHT VIEW TOP TILTED TOP VIEW AZIM ELEV ROLL AZIMUTH DISTANCE ELEVATION FLIP AXIS X AXIS Y AXIS Z INTEREST POINT ORBIT HORIZONTAL ORBIT VERTICAL ROLL TRANSLATE UP VECTOR VIEW BOX WHOLE SCENE BOX DEFAULT VIEW MATRIX VIEW ORIENTATION BOTTOM TILTED BOTTOM VIEW FRONT VIEW LEFT VIEW REAR VIEW RIGHT VIEW TOP TILTED TOP VIEW VIEWPOINT ZOOM COMPOSE WITH CURRENT MOVE INTEREST POINT