• /
• # Eigen Walkers Heading ball

on 22 Nov 2023
• 20
• 156
• 0
• 1
• 1692
drawframe(1)
function drawframe(f)
% EIGENWALKER Human gait
% Cleve's Corner, http://blogs.mathworks.com/cleve/2016/04/11.
fps=48;
scale=0.1;
ot=(f-1)*2*pi/fps;
s=sin(ot);
c=cos(ot);
C=scale*[1,s,c,2*s*c,c*c-s*s]';
V=coefficients;
X=reshape(V*C,15,3);
L={[1 5],[5 12],[2 3 4 5 6 7 8],[9 10 11 12 13 14 15]};
B=[1 -17.6 22.8 1392.3
24 781.9 24.3 1390.2
48 -16.9 23.8 1390.2];
cla
axis([-750 1500 -750 750 0 2500])
daspect([1,1,1])
set(gcf,'Color','k');
hspec=@(cc){'color',cc, 'marker','o',...
'markersize',8, 'markerfacecolor', cc...
'linestyle','-','linewidth',2};
specs=@(cc){'color',cc, 'marker','o',...
'markersize',5, ...
'linestyle','-','linewidth',2};
view(-160,10)
rs = specs('r');
gs = specs('g');
rh = hspec('r');
gh = hspec('g');
for k=1:4
x=X(L{k},1);
y=X(L{k},2);
z=X(L{k},3);
if(k==1)
line(800-x,y,z,gh{:});
line(x,y,z,rh{:});
else
line(800-x,y,z,gs{:});
line(x,y,z,rs{:});
end
end
b = interp1(B(:,1),B(:,2:4),f);
f = mod(f,24);
b(3)=b(3)+990-6*(f-12)^2;
bh = hspec('y');
line(b(1),b(2),b(3),bh{:});
axis off
function V = coefficients
V = [ 5 -43 -182 0 1
2064 14 -131 11 39
2092 -215 -192 28 15
1660 -72 -173 -1 3
-7 -78 -173 2 1
-1664 -79 -178 4 -3
-2097 -246 -200 -28 -20
-2016 -36 -168 -19 -49
536 53 127 0 15
794 11 83 -3 47
931 -73 -145 1 -2
20 -63 -113 1 0
-883 -74 -146 1 -1
-831 17 74 2 -47
-567 61 125 0 -20
205 -11 -4 -37 27
500 -1010 -256 37 9
-686 -606 -174 -11 17
-59 -153 -52 -57 32
-114 -7 -4 -62 35
-177 139 44 -61 34
-717 691 170 -12 16
414 1174 254 36 0
-544 2214 -576 327 -259
859 1247 170 51 264
-42 -10 -29 -115 80
78 -10 0 -115 67
-58 -10 33 -116 79
832 -1240 -175 56 266
-557 -2227 586 349 -271
13837 1 0 70 86
7695 -189 -11 124 6
9721 61 44 82 59
12251 -20 22 76 85
12058 1 0 74 85
12320 21 -23 78 82
9774 -65 -39 83 49
7766 224 17 119 -23
984 -120 548 -105 266
4122 250 49 123 30
7897 -12 -31 70 84
8766 1 1 70 87
7889 13 32 70 86
4157 -249 -52 124 35
985 127 -548 -116 269];
end
end