Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clf
- %set limits and select view
- ax = axes('XLim', [-2 2], 'YLim', [-2 10], 'ZLim', [-1.5 1.5]);
- view(3);
- grid on;
- axis equal
- [xc, yc, zc] = cylinder([0.1 0.0]); %cone
- [x, y, z] = cylinder([0.2 0.2]);
- h(1) = surface(xc, zc, -yc, 'FaceColor', 'red');
- h(2) = surface(z, y, 0.5*x, 'FaceColor', 'blue');
- h(3) = surface(-z, y, 0.5*x, 'FaceColor', 'yellow');
- h(4) = surface(x, -1.5*z, 0.5*y, 'FaceColor', 'red');
- h(5) = surface(xc, (1.5*yc)-1.3, z, 'FaceColor', 'red');
- %create group object and parent surfaces
- t = hgtransform('Parent', ax);
- set(h, 'Parent', t)
- % Set the renderer to OpenGL and update the display
- set(gcf, 'Renderer','opengl')
- drawnow
- x_loc = [0 1 2 3 4 5 6 7 8 9 10];
- lat = [0 1 1 1 0 0 0 -1 -1 -1 -1];
- bea = [0 -0.5 0 0 0.5 0 0 0.5 0 0 0];
- for i = 1:numel(lat)
- trans = makehgtform('translate',[lat(i) x_loc(i) 0]);
- rotz = makehgtform('zrotate',bea(i));
- set(t, 'Matrix', trans*rotz);
- pause
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement