Documentation

vrifs2patch

Convert virtual world IndexedFaceSet nodes to MATLAB patches

Syntax

vrifs2patch(ifs)

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

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.

Introduced in R2015a

Was this topic helpful?