exponenta event banner

Аэро. VirtualRealityAnimation

Создание анимационного объекта виртуальной реальности

Синтаксис

h = Aero.VirtualRealityAnimation

Описание

h = Aero.VirtualRealityAnimation создает объект анимации виртуальной реальности. Объект анимации возвращается в h. Объект анимации имеет следующие методы и свойства.

Ограничения

Aero.VirtualRealityAnimation недоступен для Aerospace Toolbox Online.

Сводка конструктора

КонструкторОписание
VirtualRealityAnimationСоздание объекта анимации виртуальной реальности.

Сводка по методу

МетодОписание
addNodeДобавление существующего узла в текущий мир виртуальной реальности.
addRouteДобавление инструкции VRML ROUTE в анимацию виртуальной реальности.
addViewpointДобавление точки обзора для анимации виртуальной реальности.
deleteУничтожить анимационный объект виртуальной реальности.
initializeСоздание и заполнение объекта анимации виртуальной реальности.
nodeInfoСоздание списка узлов, связанных с объектом анимации виртуальной реальности.
playАнимация мира виртуальной реальности для заданного положения и угла в данных временных рядов.
removeNodeУдаление узла из объекта анимации виртуальной реальности.
removeViewpointУдаление узла точек обзора из анимации виртуальной реальности.
saveasСохранение мира виртуальной реальности, связанного с анимационным объектом виртуальной реальности.
updateNodesУстановка нового перевода и поворота подвижных элементов в анимации виртуальной реальности.

Заметки о методах анимации Aero.VirtureTalkedAnimation

Методы Aero.VirtureTalkAnimation, изменяющие текущий мир виртуальной реальности, используют временный .wrl для управления этими изменениями. Эти методы включают в себя:

Помните о следующем:

  • После того, как методы вносят изменения, они повторно инициализируют мир, используя информацию, хранящуюся во временном .wrl файл.

  • При удалении объекта анимации виртуальной реальности это действие удаляет временный файл.

  • Используйте saveas метод сохранения временного .wrl файл.

  • Эти методы не влияют на созданные пользователем .wrl файлы.

Сводка по свойствам

СобственностьОписаниеЦенности
Name

Укажите имя объекта анимации.

Вектор символов | строка

VRWorld

Возвращает объект vrworld, связанный с объектом анимации.

Массив MATLAB

VRWorldFilename

Укажите .wrl файл для vrworld.

Вектор символов | строка

VRWorldOldFilename

Укажите старый .wrl файлы для vrworld.

Массив MATLAB

VRWorldTempFilename

Укажите временный .wrl для анимационного объекта.

Вектор символов | строка

VRFigure

Возвращает объект vrfigure, связанный с объектом анимации.

Массив MATLAB

Nodes

Укажите узлы, содержащиеся в объекте анимации.

Массив MATLAB

Viewpoints

Укажите точки обзора, которые содержит анимационный объект.

Массив MATLAB

TimeScaling

Укажите масштаб времени в секундах.

дважды

TStart

Укажите время начала записи в секундах.

дважды

TFinal

Укажите время окончания в секундах.

дважды

TCurrent

Укажите текущее время в секундах.

дважды

FramesPerSecond

Укажите скорость в кадрах в секунду.

дважды

ShowSaveWarning

Укажите параметр отображения предупреждения о сохранении.

дважды

  • 0 - Предупреждение не отображается.

  • Ненулевое - отображается предупреждение.

VideoFileName

Укажите имя файла видеозаписи.

Вектор символов | строка

VideoCompression

Укажите тип файла сжатия видеозаписи. Дополнительные сведения о сжатии видео см. в разделе VideoWriter.

  • 'Archival'

    Создайте файл формата Motion JPEG 2000 со сжатием без потерь.

  • 'Motion JPEG AVI'

    Создайте сжатый файл формата AVI с помощью кодека Motion JPEG.

  • 'Motion JPEG 2000'

    Создайте сжатый файл формата JPEG 2000.

  • 'MPEG-4'

    Создайте сжатый файл формата MPEG-4 с кодировкой H.264 (только для систем Windows ® 7).

  • 'Uncompressed AVI'

    Создание несжатого файла формата AVI с RGB24 видео.

Aero.VideoProfileTypeEnum

По умолчанию: 'Archival'

VideoQuality

Укажите качество видеозаписи. Для получения дополнительной информации о качестве видео см. Quality имущество VideoWriter.

Значение между 0 и 100.

дважды

По умолчанию: 75

VideoRecord

Включить запись видео.

  • 'on'

    Включить запись видео.

  • 'off'

    Отключить запись видео.

  • 'scheduled'

    Планирование видеозаписи. Использовать это свойство с VideoTStart и VideoTFinal свойства.

По умолчанию: 'off'

VideoTStart

Укажите время начала видеозаписи для запланированной записи.

Значение между TStart и TFinal.

дважды

По умолчанию: NaN, которая использует значение TStart.

VideoTFinal

Укажите время остановки видеозаписи для запланированной записи.

Значение между TStart и TFinal.

дважды

По умолчанию: NaN, которая использует значение TFinal.

Примеры

свернуть все

В этом примере показано, как записывать анимацию виртуальной реальности моделирования объекта.

  • Запись моделирования объекта анимации виртуальной реальности

  • Моделирование и запись полетных данных

  • Создание объекта анимации

h = Aero.VirtualRealityAnimation;
% 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 property determine the
% time step of the simulation. These settings result in a time step of
% approximately 0.5 s.
% This code sets the .wrl file to use in the virtual reality animation.

h.VRWorldFilename = [matlabroot,'/toolbox/aero/astdemos/asttkoff.wrl'];

% Copy the .wrl file to a temporary directory and set the world file name
% to the copied .wrl file.

copyfile(h.VRWorldFilename,[tempdir,'asttkoff.wrl'],'f');
h.VRWorldFilename = [tempdir,'asttkoff.wrl'];

% Load the animation world described in the 'VRWorldFilename' field of the
% animation object.

h.initialize();

% Set simulation timeseries data. takeoffData.mat contains logged simulated
% data. takeoffData is set up as a 'StructureWithTime', which is one of the
% default data formats.

load takeoffData
[~, idxPlane] = find(strcmp('Plane', h.nodeInfo));
h.Nodes{idxPlane}.TimeseriesSource = takeoffData;
h.Nodes{idxPlane}.TimeseriesSourceType = 'StructureWithTime';

% Use the example custom function vranimCustomTransform to correctly line
% up the position and rotation data with the surrounding objects in the
% virtual world. This code sets the coordinate transformation function for
% the virtual reality animation.

h.Nodes{idxPlane}.CoordTransformFcn = @vranimCustomTransform;

% Set up recording properties.

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

% Play the animation.

h.play();

% Verify that a file named astMotion_JPEG_VR.avi was created in the current folder.
% Disable recording to preserve the file.

h.VideoRecord = 'off';

В этом примере показано, как моделировать полетные данные в течение четырех секунд.

% Create an animation object.
h = Aero.VirtualRealityAnimation;

% 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. These settings result in a time step of 
% approximately 0.5 s.
% This code sets the .wrl file to use in the virtual reality animation.
h.VRWorldFilename = [matlabroot,'/toolbox/aero/astdemos/asttkoff.wrl'];

% Copy the .wrl file to a temporary directory and set the world file name 
% to the copied .wrl file.
copyfile(h.VRWorldFilename,[tempdir,'asttkoff.wrl'],'f');
h.VRWorldFilename = [tempdir,'asttkoff.wrl'];

% Load the animation world described in the 'VRWorldFilename' field of the 
% animation object. 
h.initialize();

% Set simulation timeseries data. takeoffData.mat contains logged simulated 
% data. takeoffData is set up as a 'StructureWithTime', which is one of the 
% default data formats.
load takeoffData
[~, idxPlane] = find(strcmp('Plane', h.nodeInfo));
h.Nodes{idxPlane}.TimeseriesSource = takeoffData;
h.Nodes{idxPlane}.TimeseriesSourceType = 'StructureWithTime';

% Use the example custom function vranimCustomTransform to correctly line 
% up the position and rotation data with the surrounding objects in the 
% virtual world. This code sets the coordinate transformation function for 
% the virtual reality animation.
h.Nodes{idxPlane}.CoordTransformFcn = @vranimCustomTransform;

% 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_VR.avi was created in the 
% current folder. When you rerun the recording, notice that the play time 
% is faster than when you record for the length of the simulation time.

% Disable recording to preserve the file.
h.VideoRecord = 'off';

В этом примере показано, как запланировать трехсекундную запись моделирования анимации объекта виртуальной реальности.

% Create an animation object.
h = Aero.VirtualRealityAnimation;

% 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. These settings result in a time step of
% approximately 0.5 s.
% This code sets the .wrl file to use in the virtual reality animation.
h.VRWorldFilename = [matlabroot,'/toolbox/aero/astdemos/asttkoff.wrl'];

% Copy the .wrl file to a temporary directory and set the world file name
% to the copied .wrl file.
copyfile(h.VRWorldFilename,[tempdir,'asttkoff.wrl'],'f');
h.VRWorldFilename = [tempdir,'asttkoff.wrl'];

% Load the animation world described in the 'VRWorldFilename' field of the
% animation object.
h.initialize();

% Set simulation timeseries data. takeoffData.mat contains logged
% simulated data. takeoffData is set up as a 'StructureWithTime', which is
% one of the default data formats.
load takeoffData
[~, idxPlane] = find(strcmp('Plane', h.nodeInfo));
h.Nodes{idxPlane}.TimeseriesSource = takeoffData;
h.Nodes{idxPlane}.TimeseriesSourceType = 'StructureWithTime';

% Use the example custom function vranimCustomTransform to correctly line
% up the position and rotation data with the surrounding objects in the
% virtual world. This code sets the coordinate transformation function for
% the virtual reality animation.
h.Nodes{idxPlane}.CoordTransformFcn = @vranimCustomTransform;

% 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_VR.avi was created in the
% current folder. When you rerun the recording, notice that the play time
% is faster than when you record for the length of the simulation time.
% Disable recording to preserve the file.
h.VideoRecord = 'off';
Представлен в R2007b