- /
-
Hyperboloid_3D
on 21 Nov 2023
- 5
- 16
- 5
- 0
- 545
drawframe(1);
Write your drawframe function below
function drawframe(f)
N = 40;
dAz = pi/48;
maxAz = 2*pi/N * 10 - dAz;
w = 30 * 1.5;
edth = 2/4*pi;
offs = [maxAz*2:-dAz:maxAz maxAz:dAz:maxAz*2];
off = offs(f);
if off <= maxAz
dz = off/maxAz;
z = dAz;
else
dz = 1-max((off-maxAz*1),0)/maxAz;
z = 1;
end
for l=1:N
th = l*2*pi/N;
r = 30;
x1 = r * cos(th);
y1 = r * sin(th);
x2 = r * cos(th+edth*dz);
y2 = r * sin(th+edth*dz);
p = plot3([x1 x2],[y1 y2],[0 z],'b-', LineWidth=1.0);
if (l==1)
hold on
end
end
hold off
axis off
xlim([-w w])
ylim([-w w])
zlim([0 1])
threshold = 3*maxAz/2;
if off <= threshold
camorbit(abs(off-threshold)*180,abs(off-threshold)*45,'camera')
end
end