Documentation

Aero.VirtualRealityAnimation

Construct virtual reality animation object

Syntax

h = Aero.VirtualRealityAnimation

Description

h = Aero.VirtualRealityAnimation constructs a virtual reality animation object. The animation object is returned to h. The animation object has the following methods and properties.

Constructor Summary

ConstructorDescription
VirtualRealityAnimationConstruct virtual reality animation object.

Method Summary

MethodDescription
addNodeAdd existing node to current virtual reality world.
addRouteAdd VRML ROUTE statement to virtual reality animation.
addViewpointAdd viewpoint for virtual reality animation.
deleteDestroy virtual reality animation object.
initializeCreate and populate virtual reality animation object.
nodeInfoCreate list of nodes associated with virtual reality animation object.
playAnimate virtual reality world for given position and angle in time series data.
removeNodeRemove node from virtual reality animation object.
removeViewpointRemove viewpoint node from virtual reality animation.
saveasSave virtual reality world associated with virtual reality animation object.
updateNodesSet new translation and rotation of moveable items in virtual reality animation.

Notes on Aero.VirtualRealityAnimation Methods

Aero.VirtualRealityAnimation methods that change the current virtual reality world use a temporary .wrl file to manage those changes. These methods include:

Be aware of the following behavior:

  • After the methods make the changes, they reinitialize the world, using the information stored in the temporary .wrl file.

  • When you delete the virtual reality animation object, this action deletes the temporary file.

  • Use the saveas method to save the temporary .wrl file.

  • These methods do not affect user-created .wrl files.

Property Summary

PropertyDescriptionValues
Name

Specify name of the animation object.

Character vector

VRWorld

Returns the vrworld object associated with the animation object.

MATLAB array

VRWorldFilename

Specify the .wrl file for the vrworld.

Character vector

VRWorldOldFilename

Specify the old .wrl files for the vrworld.

MATLAB array

VRWorldTempFilename

Specify the temporary .wrl file for the animation object.

Character vector

VRFigure

Returns the vrfigure object associated with the animation object.

MATLAB array

Nodes

Specify the nodes that the animation object contains.

MATLAB array

Viewpoints

Specify the viewpoints that the animation object contains.

MATLAB array

TimeScaling

Specify the time scaling, in seconds.

double

TStart

Specify the recording start time, in seconds.

double

TFinal

Specify end time, in seconds.

double

TCurrent

Specify current time, in seconds.

double

FramesPerSecond

Specify rate, in frames per second.

double

ShowSaveWarning

Specify save warning display setting.

double

  • 0 — No warning is displayed.

  • Non-zero — Warning is displayed.

VideoFileName

Specify video recording file name.

Character vector

VideoCompression

Specify video recording compression file type. For more information on video compression, see VideoWriter.

  • 'Archival'

    Create Motion JPEG 2000 format file with lossless compression.

  • 'Motion JPEG AVI'

    Create compressed AVI format file using Motion JPEG codec.

  • 'Motion JPEG 2000'

    Create compressed Motion JPEG 2000 format file.

  • 'MPEG-4'

    Create compressed MPEG-4 format file with H.264 encoding (Windows® 7 systems only).

  • 'Uncompressed AVI'

    Create uncompressed AVI format file with RGB24 video.

Aero.VideoProfileTypeEnum

Default: 'Archival'

VideoQuality

Specify video recording quality. For more information on video quality, see the Quality property of VideoWriter.

Value between 0 and 100.

double

Default: 75

VideoRecord

Enable video recording.

  • 'on'

    Enable video recording.

  • 'off'

    Disable video recording.

  • 'scheduled'

    Schedule video recording. Use this property with the VideoTStart and VideoTFinal properties.

Default: 'off'

VideoTStart

Specify video recording start time for scheduled recording.

Value between TStart and TFinal.

double

Default: NaN, which uses the value of TStart.

VideoTFinal

Specify video recording stop time for scheduled recording.

Value between TStart and TFinal.

double

Default: NaN, which uses the value of TFinal.

Examples

collapse all

Simulate and record flight data. Create an animation object.

h = Aero.Animation;

Control the frame display rate.

h.FramesPerSecond = 10;

Set the time-scaling (TimeScaling) property on the animation object to specify the data per second.

h.TimeScaling = 5;

The combination of FramesPerSecond and TimeScaling properties determines the time step of the simulation. These settings result in a time step of approximately 0.5 s.

Create and load a body for the animation object.

idx1 = h.createBody('pa24-250_orange.ac','Ac3d');

Load simulated flight trajectory data (simdata), located in matlabroot\toolbox\aero\astdemos.

load simdata;

Set the time series data for the body.

h.Bodies{1}.TimeSeriesSource = simdata;

Create a figure object for the animation object.

h.show();

Set up recording properties.

h.VideoRecord = 'on';
h.VideoQuality = 50;
h.VideoCompression = 'Motion JPEG AVI'
h.VideoFilename = 'astMotion_JPEG';
h =

	Aero.Animation

Play the animation.

h.play();

Verify that a file named astMotion_JPEG.avi was created in the current folder.

Disable recording to preserve the file.

h.VideoRecord = 'off';

Simulate flight data for four seconds. Create an animation object.

h = Aero.Animation;

Control the frame display rate.

h.FramesPerSecond = 10;

Configure the animation object to set the seconds of animation data per second time-scaling (TimeScaling) property.

h.TimeScaling = 5;

The combination of FramesPerSecond and TimeScaling properties determines the time step of the simulation (TimeScaling/|FramesPerSecond|). These settings result in a time step of approximately 0.5 s.

Create and load a body for the animation object.

idx1 = h.createBody('pa24-250_orange.ac','Ac3d');

Load simulated flight trajectory data (simdata), located in matlabroot\toolbox\aero\astdemos.

load simdata;

Set the time series data for the body.

h.Bodies{1}.TimeSeriesSource = simdata;

Create a figure object for the animation object.

h.show();

Set up recording properties.

h.VideoRecord='on';
h.VideoQuality = 50;
h.VideoCompression = 'Motion JPEG AVI';
h.VideoFilename = 'astMotion_JPEG';

Play the animation from TFinal to TStart.

h.TSTart = 1;
h.TFinal = 5;
h.play();

Verify that a file named astMotion_JPEG.avi was created in the current folder. When you rerun the recording, notice that the play time is shorter than that in the previous example when you record for the length of the simulation time.

Disable recording to preserve the file.

h.VideoRecord = 'off';

Schedule three second recording of animation object simulation. Create an animation object.

h = Aero.Animation;

Control the frame display rate.

h.FramesPerSecond = 10;

Configure the animation object to set the seconds of animation data per second time-scaling (TimeScaling) property.

h.TimeScaling = 5;

The combination of FramesPerSecond and TimeScaling properties determines the time step of the simulation (TimeScaling/|FramesPerSecond|). These settings result in a time step of approximately 0.5 s.

Create and load a body for the animation object.

idx1 = h.createBody('pa24-250_orange.ac','Ac3d');

Load simulated flight trajectory data (simdata), located in matlabroot\toolbox\aero\astdemos.

load simdata;

Set the time series data for the body.

h.Bodies{1}.TimeSeriesSource = simdata;

Create a figure object for the animation object.

h.show();

Set up recording properties.

h.VideoQuality = 50;
h.VideoCompression = 'Motion JPEG AVI';
h.VideoFilename = 'astMotion_JPEG';

Set up simulation time from TFinal to TStart.

h.TSTart = 1;
h.TFinal = 5;

Set up to record between two and four seconds of the four second simulation.

h.VideoRecord='scheduled';
h.VideoTSTart = 2;
h.VideoTFinal = 4;

Play the animation.

h.play();

Verify that a file named astMotion_JPEG.avi was created in the current folder. When you rerun the recording, notice that the play time is shorter than that in the previous example when you record for the length of the simulation time.

Disable recording to preserve the file.

h.VideoRecord = 'off';

Introduced in R2007b

Was this topic helpful?