Main Content

camheading

Set or get heading angle of camera for Satellite Scenario Viewer

Description

example

camheading(viewer,heading) sets the heading angle of the camera for the specified Satellite Scenario Viewer. Setting the heading angle shifts the camera left or right about its z-axis.

Camera with double-headed arrow, pointing left and right in front of lens

outHeading = camheading(viewer,___) returns the heading angle of the camera. If the second input is heading, then the function sets the output equal to the input heading.

Examples

collapse all

Create a satellite scenario object.

sc = satelliteScenario;

Add a ground station to the scenario.

latitude = 42.3001;                         % degrees
longitude = -71.3504;                       % degrees
groundStation(sc,latitude+0.05,longitude);

Launch the Satellite Scenario Viewer.

v = satelliteScenarioViewer(sc);

In the Satellite Scenario Viewer, set the height of the camera to 50 meters.

height = 50;                        % meters
campos(v,latitude,longitude,height);
pause(2);

Set the pitch angle of the camera to 0 degrees.

pitch = 0;
campitch(v,pitch);
pause(2);

Set the heading angle of the camera to 20 degrees.

heading = 20;         % degrees
camheading(v,heading);

Input Arguments

collapse all

Satellite Scenario Viewer, specified as a scalar satelliteScenarioViewer object.1

Heading angle of the camera in degrees, specified as a scalar value in the range [–360, 360].

Output Arguments

collapse all

Camera heading angle in degrees, returned as a numeric scalar.

Tips

  • When the pitch angle is near –90 (the default value) or 90 degrees, the camera loses one rotational degree of freedom. As a result, when you change the roll angle, the heading angle might change instead. This phenomenon is called gimbal lock. To avoid the effects of gimbal lock, call the camheading function instead of the camroll function.

Version History

Introduced in R2021a


1 Alignment of boundaries and region labels are a presentation of the feature provided by the data vendors and do not imply endorsement by MathWorks®.