Main Content

vrifs2patch

Convert virtual world IndexedFaceSet nodes to MATLAB patches

Description

example

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

Note

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

Examples

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');
open(w1);

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]);

Figure Virtual world containing source IndexedFaceSet node contains objects of type hgjavacomponent, uimenu, uipanel, uitoolbar.

vrdrawnow;

Convert the IndexedFaceSet a MATLAB patch and show it.

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

Figure Resulting patch contains an axes object. The axes object contains an object of type patch.

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

Figure Resulting patch contains an axes object. The axes object contains an object of type patch.

Input Arguments

collapse all

IndexedFaceSet nodes, specified as an array.

Introduced in R2015a