Main Content


(To be removed) Convert virtual world IndexedFaceSet nodes to MATLAB patches

vrifs2patch will be removed in a future release. For more information, see Version History.



vrifs2patch(ifs) converts the ifs array of existing IndexedFaceSet nodes to MATLAB® patch objects.


This function converts only geometry and color data of the source IndexedFaceSet node.


collapse all

This command converts three IndexedFaceSet nodes to MATLAB® patch objects.

Open virtual world containing an IndexedFaceSet node.

w1 = vrworld('*sl3dlib/objects/Components/Shapes/Torus_High.wrl');

View the virtual world as a virtual figure.

vrfig1 = vrfigure(w1, ...
           'Name', 'Virtual world containing source IndexedFaceSet node', ...
           'CameraBound', 'off', ...
           'CameraPosition',[0 40 0], ...
           'CameraDirection',[0 -1 0], ...
           'CameraUpVector',[0 0 -1]);

Convert the IndexedFaceSet a MATLAB patch and show it.

figure('Name', 'Resulting patch');
tp = vrifs2patch(w1.torushi.children.geometry);

Change the patch color, show the axes grid, rotate the camera, and enable mouse rotation.

tp.FaceColor = 'red';

axs = gca;
axs.XGrid = 'on';
axs.YGrid = 'on';
axs.ZGrid = 'on';

camorbit(45, -20);

rotate3d on

Input Arguments

collapse all

IndexedFaceSet nodes, specified as an array.

Version History

Introduced in R2015a

collapse all

R2023b: To be removed

The vrifs2patch will be removed in a future release. Instead, use sim3d classes and Simulation 3D blocks to interface MATLAB and Simulink® with the Unreal Engine® 3D simulation environment. To get started, see Create 3D Simulations in Unreal Engine Environment.