Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

View Rotating 3-D Point Cloud

Load point cloud.

ptCloud = pcread('teapot.ply');

Define a rotation matrix and 3-D transform.

x = pi/180; 
R = [ cos(x) sin(x) 0 0
     -sin(x) cos(x) 0 0
      0         0   1 0
      0         0   0 1];

tform = affine3d(R);

Compute x-_y_ limits that ensure that the rotated teapot is not clipped.

lower = min([ptCloud.XLimits ptCloud.YLimits]);
upper = max([ptCloud.XLimits ptCloud.YLimits]);
  
xlimits = [lower upper];
ylimits = [lower upper];
zlimits = ptCloud.ZLimits;

Create the player and customize player axis labels.

player = pcplayer(xlimits,ylimits,zlimits);

xlabel(player.Axes,'X (m)');
ylabel(player.Axes,'Y (m)');
zlabel(player.Axes,'Z (m)');

Rotate the teapot around the z-axis.

for i = 1:360      
    ptCloud = pctransform(ptCloud,tform);     
    view(player,ptCloud);     
end