Advertisement
Guest User

original_prog

a guest
May 13th, 2014
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. clf
  2. %set limits and select view
  3. ax = axes('XLim', [-2 2], 'YLim', [-2 10], 'ZLim', [-1.5 1.5]);
  4. view(3);
  5. grid on;
  6. axis equal
  7.  
  8. [xc, yc, zc] = cylinder([0.1 0.0]); %cone
  9. [x, y, z] = cylinder([0.2 0.2]);
  10.  
  11. h(1) = surface(xc, zc, -yc, 'FaceColor', 'red');
  12. h(2) = surface(z, y, 0.5*x, 'FaceColor', 'blue');
  13. h(3) = surface(-z, y, 0.5*x, 'FaceColor', 'yellow');
  14. h(4) = surface(x, -1.5*z, 0.5*y, 'FaceColor', 'red');
  15. h(5) = surface(xc, (1.5*yc)-1.3, z, 'FaceColor', 'red');
  16.  
  17. %create group object and parent surfaces
  18. t = hgtransform('Parent', ax);
  19. set(h, 'Parent', t)
  20.  
  21. % Set the renderer to OpenGL and update the display
  22. set(gcf, 'Renderer','opengl')
  23.  
  24. drawnow
  25.  
  26. x_loc = [0 1 2 3 4 5 6 7 8 9 10];
  27. lat = [0 1 1 1 0 0 0 -1 -1 -1 -1];
  28. bea = [0 -0.5 0 0 0.5 0 0 0.5 0 0 0];
  29.  
  30. for i = 1:numel(lat)
  31. trans = makehgtform('translate',[lat(i) x_loc(i) 0]);
  32. rotz = makehgtform('zrotate',bea(i));
  33. set(t, 'Matrix', trans*rotz);
  34. pause
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement