- /
-
Lissajous Curve Illusion
on 10 Nov 2023
- 17
- 127
- 0
- 0
- 421
drawframe(2);
Write your drawframe function below
function drawframe(f)
x = @(t) sin(3*t);
y = @(t) sin(2*t);
z = @(t) sin(2*t + pi/2);
t = 0:0.1:600;
X = x(t); Y = y(t); Z = z(t);
Rx = @(a) [1 0 0; 0 cos(a) -sin(a); 0 sin(a) cos(a)];
Ry = @(b) [cos(b) 0 sin(b); 0 1 0; -sin(b) 0 cos(b)];
Rz = @(g) [cos(g) -sin(g) 0; sin(g) cos(g) 0; 0 0 1];
Po = [X' Y' Z'];
Po = Po*Rz(pi/2);
figure('Position',[675 623 779 339]);
theta = linspace(-.5*pi,.16*pi,48)
P = Po*Ry(theta(f));
plot3(P(:,1),P(:,2),P(:,3),'.')
view(2)
axis off
end