Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clf
- %set limits and select view
- ax = axes('XLim', [-10 200], 'YLim', [-10 120], 'ZLim', [-10 120]);
- view(3);
- grid on;
- axis equal
- h = cube([10 10 10], [5 5 5], 60);
- %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 = linspace(1,200);
- y_loc = 100 - ( (x_loc-100).^2)./(4*25);
- z_loc = 100 - ( (x_loc-100).^2)./(4*25);
- x_rot = sin(x_loc.*(pi / 180));
- for i = 1:numel(x_loc)
- trans = makehgtform('translate',[x_loc(i), y_loc(i), z_loc(i)]);
- rotx = makehgtform('zrotate',x_rot(i));
- set(t, 'Matrix', trans*rotx);
- pause (1/20)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement