% close all
% q=0:.1:100*pi;
% major =50;
% minor=30;
% ratio=10;
% f=pi/40
% x = major * sin (q) + minor * sin (ratio*q-f)
% y = major * cos (q) + minor * cos (ratio*q+f)
% plot(x,y)
%
% x = major * sin (q) + minor * sin (ratio*q-f)
% y = major * cos (q) + minor * cos (ratio*q+f)
%
% I think these things pretty much count as trochoids, being the trails left by a point on a wheel as it rolls around another wheel.
% Conventionally though trochoids are divided into two categories: Epitrochoids and hypotrochoids.
% Epitrochoids are the trail from a wheel rolling around the outside of a fixed circle.
% Hypotrochoids are those formed from a wheel rolling around the inside of a fixed circle.
% These curves belong to a more general class, with the wheel being rolled around also turning.
nframes = 50;
n=300;
s=.02;
close all
q=0:.1:100*pi;
major =50;
minor=30;
ratio=10;
f=pi/.4;
x = major * sin (q) + minor * sin (ratio*q-f);
y = major * cos (q) + minor * cos (ratio*q+f);
% x = rand(n,1)-0.5;
% y = rand(n,1)-0.5;
if x<0
h = plot(x,y,'.r');
else
h=plot(x,y,'.b');
end
set(h,'MarkerSize',8);
axis ([-80 80 -80 80])
axis square
grid off
for k = 1:nframes
x = major * sin (q) + minor * sin (ratio*q-f)+ s*rand.*100;
y = major * cos (q) + minor * cos (ratio*q+f)+ s*rand.*100;
%
% x = x + s*randn(n,1);
% y = y + s*randn(n,1);
set(h,'XData',x,'YData',y)
M(k) = getframe;
end
movie(M,2)
No comments:
Post a Comment