Advertisement
Guest User

Euler Spirale

a guest
Oct 18th, 2014
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.50 KB | None | 0 0
  1. % Graphical presentation of a variant of the Euler-Spirale
  2. % by Faxter, 2014
  3.  
  4. % starts with a line of given length, then adds another line from the
  5. % ending point with same length and incremented angle.
  6.  
  7. % uses fxLine: function [p1] = fxLine(phi,l,p0)
  8. % where phi is an angle in degree, l is length of the line, p0 the
  9. % starting point, p1 the destination point
  10.  
  11. % initialisation
  12. % _________________________________________________________________________
  13.  
  14. start = [0 0];      % start at origin
  15. rep = 5000;         % number of cycles to do
  16. linelen = 1;        % length of the lines to use
  17. phi0 = 0;           % starting value of angle
  18. deltaphi = 300;     % amount of angle to be added per rep
  19. incphi = 3.7;       % amount of angle to be incremented between lines per rep
  20.  
  21. % implementation
  22. % _________________________________________________________________________
  23.  
  24. figure('units','normalized','outerposition',[0 0 1 1]);
  25. for i = 1:rep
  26.     dest = fxLine(phi0,linelen,start);                  % determine destination of line
  27.     plot([start(1) dest(1)],[start(2) dest(2)]);        % draw line
  28.     hold on;                                            % keep plot alive
  29.     phi0 = phi0 + deltaphi;                             % increment angle
  30.     deltaphi = deltaphi + incphi;                       % increment angle between lines
  31.     start = dest;                                       % set destination as start for next line
  32.     if i<20
  33.         pause(0.3);
  34.     else
  35.         pause(0.01);
  36.     end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement