MATLAB | 官方举办的动图绘制大赛 | 第四周(收官周)赛情回顾

MATHWORKS官方举办的迷你黑客大赛第三期(MATLAB Flipbook Mini Hack)圆满结束,虽然我的水平和很多大佬还有比较大的差距,但所有奖也算是拿满了:

专家评选前三名,以及投票榜前十:~

每周的阶段性获奖者:


下面正式开始!

本次比赛要求提交名为drawframe(f)的函数代码,生成长达2s,48帧的动态图,动图生成是依靠如下代码来做到的:

function contestAnimator()animFilename = 'animation.gif'; % Output file namefirstFrame = true;framesPerSecond = 24;delayTime = 1/framesPerSecond;% Create the giffor frame = 1:48drawframe(frame)fig = gcf(); fig.Units = 'pixels';fig.Position(3:4) = [300,300];im = getframe(fig);[A,map] = rgb2ind(im.cdata,256);if firstFramefirstFrame = false;imwrite(A,map,animFilename, LoopCount=Inf, DelayTime=delayTime);elseimwrite(A,map,animFilename, WriteMode="append", DelayTime=delayTime);endend
end

闲话少叙,一起看作品!!


作品概览

Tim / Moonrun

https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/16134

function drawframe(f)if f == 1%% Make landscape
clf
rng(4,'v4');
N=200;
q=linspace(-1,1,N);
k=abs(ifft2(exp(6i*randn(N))./(q.^2+q'.^2+1e-9)));
k=rescale(1./(k+1));
imagesc(k);[x,y]=meshgrid(linspace(-1,1,N*7)*7);
k=repmat(k,[7,7]);
surf(x,y,k/2,'edgeC','none','SpecularS',0);
axis equal
colormap(copper)hold on;% Make moon
bscl = 1e5;rng defaultnl=1e4;
rd = rand(nl,1)/3+1;
po = randn(3,nl);
po = po./vecnorm(po);
[p,k,s]=SM(po',rd,7);ms = mean(s);
ns = s - ms;
s = erf(ns*500)/50+ms;[~,~,sb]=SM(po',randn(nl,1),1);% Now, take a page from Adam D.' book for the craters
rng(1,'twister');
x = randn(3,16);     % Let's add 16 craters
x = x./vecnorm(x);mfc = @(x,y,z)y.*(erf((x-z)*30)/2+.5);  % Using erf as the crater function...for n = 1:size(x, 2)d = vecnorm(x(:,n)-p');s = mfc(d',s-1.14,rand(1)/2)+1.14;
ends = s + sb/20;
s = (s-mean(s))/10+mean(s);
p2 = (p.'./vecnorm(p.'))'.*s;E='EdgeC';
F='FaceC';
O='none';
G='FaceA';% Plot moon
hold on;
bscl=1e1;
T2=trisurf(k,bscl*p2(:,1)+1*bscl,bscl*p2(:,2)+4*bscl,bscl*p2(:,3)+1*bscl,'FaceC','flat','FaceVertexCData',rescale(s,.4,1).*[1,1,1],E,O);       % Plot
material([0,1,0,10]);
axis equal off
set(gcf,'color','k');
light('position',[1,-1,1]); 
light('position',[1,-1,1]);camproj p
campos([0,-7.2,.35]);
camva(40);endx = linspace(0, 1, 49)*2;
dx=mean(diff(x));
x = 0:dx:200*dx;
y = cos(pi*x)/15;
a=linspace(0,2*pi,49)-2;
% for n = 1:1:48
n=f;cpos = [0.05, -7.2+2, .42] + [y(n), x(n), y(n)/2];camup([0, sin(a(n))/2, cos(a(n))/2+1]);campos(cpos);camtarget([0.05, -7.2+2, .42] + [y(n+1), x(n+1), y(n+1)/2]);1;endfunction [p,k,s]=SM(in,rd,r)
n=size(in,1);
k=convhull(in);                              % Points on "in" must lie on unit circle
c=@(x)sparse(k(:,x)*[1,1,1],k,1,n,n);        % Connectivity            
t=c(1)|c(2)|c(3);                            % Connectivity
f=spdiags(-sum(t,2)+1,0,t*1.)*r;             % Weighting
s=((speye(n)+f'*f)\rd);                      % Solve for s w/regularizer
p=in.*s;                                     % Apply
end

Tim / Planet and moon

https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/16129

function drawframe(f)% Procedural planet & moon
% Apologies for the sloppy code and a couple garbage variables. Based
% around Matlon5 code but forgot to add as a remix.persistent V
if f==1rng(5,'twister');
v=@vecnorm;
ra=@rand;
bscl = 1e5;% Usng a random sphere instead of fibonacci sphere like Matlon5
nl=1e5;
r=ra(nl,1)/3+1;
p=randn(3,nl);
p=p./v(p);
[p,k,s]=SM(p',r,5e1);% Spin points to make a gaseous looking surface...
p2 = (p.'./vecnorm(p.'))';
scl=-7;
p2(:,1:2) = [p2(:,1).*cos(p2(:,3)*scl)-p2(:,2).*sin(p2(:,3)*scl),p2(:,1).*sin(p2(:,3)*scl)+p2(:,2).*cos(p2(:,3)*scl)];% Re-smooth
[p3,k2,s2]=SM(p2,s,3e0);
p3 = (p3.'./vecnorm(p3.'))';% Add a storm in it
xp=[1,1,0.5]';
xp = xp/norm(xp);p2=p3';
for nn = 1:100
pob = p2./v(p2);
for n = 1:size(xp, 2)
if n == 1
xc = XP(xp(:,n),pob);
else
xc = xc + XP(xp(:, n),pob);
end
end
p2 = (p2./v(p2) + xc/1500).*s';
end
p3 = (p2./vecnorm(p2))';E='EdgeC';
F='FaceC';
O='none';
G='FaceA';% Plot planet
T=trisurf(k2,p3(:,1)*bscl,p3(:,2)*bscl,p3(:,3)*bscl,s2,E,O);       % Plot
material([0,1,0,10]);% Make it a purple planet
c1=[88,72,154];
c2=[112,89,145];
c3=[140,120,140];
c4=[180,160,170];
c5=[250,240,242];
c=[c1;c2;c3;c4;c5];cmp = interp1(1:5, c, linspace(1, 5, 256))/255;
colormap(min(cmp.^1.5*1.5,1));
cb = caxis;% % % Add a moon...
rng default
v=@vecnorm;nl=1e4;
rd = rand(nl,1)/3+1;
po = randn(3,nl);
po = po./vecnorm(po);
[p,k,s]=SM(po',rd,7);ms = mean(s);
ns = s - ms;
s = erf(ns*500)/50+ms;[~,~,sb]=SM(po',randn(nl,1),1);% Now, take a page from Adam D.' book for the craters
rng(1,'twister');
x = randn(3,16);     % Let's add 16 craters
x = x./vecnorm(x);mfc = @(x,y,z)y.*(erf((x-z)*30)/2+.5);  % Using erf as the crater function...for n = 1:size(x, 2)d = vecnorm(x(:,n)-p');s = mfc(d',s-1.14,rand(1)/2)+1.14;
ends = s + sb/20;
s = (s-mean(s))/10+mean(s);
p2 = (p.'./vecnorm(p.'))'.*s;E='EdgeC';
F='FaceC';
O='none';
G='FaceA';% Plot moon
hold on;
T2=trisurf(k,bscl*p2(:,1)/3+4*bscl,bscl*p2(:,2)/3-1*bscl,bscl*p2(:,3)/3,'FaceC','flat','FaceVertexCData',rescale(s,.4,1).*[1,1,1],E,O);       % Plot
material([0,1,0,10]);
axis equal off
set(gcf,'color','k');
light; 
light('color',[1,1,1]*.4);
caxis(cb);
V=hgtransform('Parent',gca);
set(T2,'parent',V);
camproj p;
camtarget([0,0,.2]*bscl);
end
a=-1.45:.018:-.59;
camva(9);
c=pi/4-sin(0:.131:2*pi)/10;
campos([sin(c(f)),cos(c(f)),0]*1.3e6);
set(V,'Matrix',makehgtform('zrotate',-a(f)));
endfunction cp=XP(n,p)n=n/vecnorm(n)*.9;
d=sqrt(sum((n - p).^2));
cp=cross(p, n.*ones(1,size(p,2)))./d.^2;endfunction [p,k,s]=SM(in,rd,r)
n=size(in,1);
k=convhull(in);                              % Points on "in" must lie on unit circle
c=@(x)sparse(k(:,x)*[1,1,1],k,1,n,n);        % Connectivity            
t=c(1)|c(2)|c(3);                            % Connectivity
f=spdiags(-sum(t,2)+1,0,t*1.)*r;             % Weighting
s=((speye(n)+f'*f)\rd);                      % Solve for s w/regularizer
p=in.*s;                                     % Apply
% S.D.G.
end

Adam Danz / A light in the attic

https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/16114

function drawframe(f)
persistent h x y n wdw
rng default
if isempty(h) || f==1% Dark skyaxes(Position=[0 0 1 1])s = 99;q=linspace(50,1,s);hold on % hold before imagesc to keep ydir normalimagesc(q'.*(q./q),[20,80])% Add star rotationtd=0:0.001:.1; % theta deltan=1000; % number of starstheta = pi/1.8*rand(1,n)+pi-.1;  % range: 180:270 +/- (quadrant III)[x,y]=pol2cart(theta+td',rand(1,n).*s*sqrt(2));x = x+s; % move polaris to the upper right cornery = y+s; % move polaris to the upper right cornerh = plot(x, y,'color','w');rgba = ones(n,4);rgba(:,4) = rescale(randg(1,n,1),.1,1);set(h,{'color'},mat2cell(rgba,ones(n,1),4))% Add grassy hillg = 1000; % number of grass bladesxg = linspace(0,s+1,g);yg = cos(xg/(s+1))*30+randg(1,1,g);area(xg,yg,FaceColor='k')xg=[1,1:.1:s,s];yg=[1,cos(0:.1/98:1)*30+randg(1,1,981),1];fill(xg,yg,'k')% Add house silhouettefill([4 4 3 6 9 8 8]*5,[5 7 7 8 7 7 5]*5,'k')% Add windowwdw=fill(30+2*[-1 1 1 -1],35+[2.2 2.2 .1 .1],[.1 .1 .1]);camva(6)axis equal offxlim([1 s])ylim([1 s])colormap gray
endk = round(f/48*height(x));
set(h,{'XData'},mat2cell(x(1:k,:),k,ones(1,n))',{'YData'},mat2cell(y(1:k,:),k,ones(1,n))')
if f==24wdw.FaceColor = [0.6 0.6 0.4];
end
end

Eric Ludlam / Will O’ Wisp

https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/15974

function drawframe(f)E=4; % Size of the forest environment% AbbreviationsJ=@rand;K=@rescale;VN=@vecnorm;persistent Lif f==1set(gcf,'color','k');% Select some nice tree locations%v1=[0 0 1.3%    1.4 0 1%    -1.3 0 1.2%    1 -1 1.3%    -1 -1 1.2%    -.5 -2.1 .9%    .34 -2 1%    .7 -2.3 .8%    -1.5 -4 1%    .6 1 1.2%    .4 2 1.3%    -.55 1.5 1.4];% Below is the compressed version of the above, saving almost 50 chars!v1=reshape(K('啥猸㦴檳䀘䪿岣摏㕱戭巫䦮啥啥啥䀘䀘⢩⫋⑧0檳耀留焗檳滵焗滵梑檳晰檳滵焗猸'-'0',-4,2),12,3);% Compressed version of color array: See parent of this remixB=(['ÆJJ';'ûÁ';'ŽF.';'¶eU';'›_ ';'¡g<';'¢aa';'·‰9'-' '])/256;G=([')™‰';'B¬B';'pé˜';'o™b';' ¡ ';'U~[';'JË«';'RîR']-' ')/256;for i=1:size(v1,1)%% Tree TrunksN=30;Q=.1;  % variation in distance from centerRN=12;  % n pts in bounding ringsrv=[.05 .02]; % Radius valuesrh=[0 1]; % Radius heights% Random pts on cylinderrt=linspace(0,2*pi,RN+1);rt(end)=[];T=[J(1,N)*pi*2 rt rt];h=[K(randn(1,N)) ones(1,RN)*rh(1) ones(1,RN)*rh(2)];% Adjust the radius based on heightR=interp1(rh,rv,h);pts=[cos(T).*Rsin(T).*Rh]';% triangulate the perfect cylindertf=convhulln(pts);% Push points in/out with variance of QD=(1-Q+J(1,size(pts,1))*(Q*2))';tv=pts.*(D.*[1 1 0]+[0 0 1]);        mkP(tf,(tv+v1(i,:).*[1 1 0]).*[1 1 v1(i,3)+.1],i,B,D);%% Tree topsN=150;% Alg for random distribution of pts on a sphere.T=J(1,N)*pi*2;u=J(1,N)*2-1;pts=[0 cos(T).*sqrt(1-u.^2)0 sin(T).*sqrt(1-u.^2)0 u ]';% triangulate the perfect spherelf=convhulln(pts);% Push points around to make foliage frumphyQ=.15;D=(1-Q+J(1,size(pts,1))*(Q*2))';lvr=pts.*D;% Scale down into our world and push up into treetopsss=v1(i,3)*.34;llv=lvr.*[.12+ss .12+ss .08+ss]+[0 0 .1];mkP(lf,llv+v1(i,:),i,G,D);%% Bumpy high-res groundN=400;Q=.2;% coordinatesT=J(1,N)*2;R=J(1,N)+.05;x=cospi(T).*R*E;y=sinpi(T).*R*E;% Triangulate the flat disc so we can draw itpv=[x' y'];pf=delaunay(pv);% VariationD=(J(1,size(pv,1))*Q)';% flip faces due to normals needing to match treesmkP(fliplr(pf),[pv D],4,G,D);end%% Our Wisp!L=line(1,1,1,'Marker','.','Markers',20,'Color','y');light('color','k'); % This light forces normals to be% computed on the patches but since it% is black, it has no visible effect.%% Decorate!set(gca,'position',[0 0 1 1],'vis','off','proj','p');axis([-E E -E E -1 E]);view(3);daspect([1 1 1]);campos([0 3 .5]);camva(60);camtarget([0 0 .7]);drawnow; % Force all vertex normals to be computedend%% Update Lightlp=[cospi(f/24)*.5 sinpi(f/24)*1.5-.5 cospi(f/12)*.2+.7];set(L,'XData',lp(1),'YData',lp(2),'ZData',lp(3));%% Apply lighting to all the patchesO=findobj('type','patch');for i=1:numel(O)doL(O(i));endfunction doL(p)% Perform a lighting operation on the object provided in p.% This algorithm is an adaption from the ML lighting% algorithm in webGL, but ignoring specular (to make it% spooky) and adding in distance based ambient lighting,% and adding range to the local light.cp=campos;v=p.Vertices;% Distance from camera, extending to range.gl_dist=K(min(VN(v-cp,2,2),max(E)),'InputMin',0,'InputMax',E*3);% Weight of ambient lighting.  Desaturate some of the red on tree in frontw_amb=[.3 .4 .4].*(1.1-gl_dist);% Effects of the wisps_diff=.7; % diffuse strengthlr=1.5; % max distance light can illuminated=v-lp;l_dist=min(VN(d,2,2),lr);s_dist=1-K(l_dist,'InputMax',lr,'InputMin',0);% Diffuse Weight% Invert vertex normals due to faces being in wrong order and - being shortw_diff=L.Color.*dot(-p.VertexNormals,d./VN(d,2,2),2)*s_diff;% CbaseColorFactor (ambiant and diffuse)bcf = min(max(w_diff,0), 1).*s_dist;% Accumulate all the terms and put on patch as colorset(p,'FaceVertexCData',min(p.UserData.*(w_amb+bcf), 1));end%% Shorten patch creationfunction mkP(f,v,i,C,D)% f - faces% v - vertices% i - thing index% C - Array of colors to pick from% D - distance array% Create our colors based on DbC=C(mod(i,size(C,1))+1,:);C2=hsv2rgb(rgb2hsv(bC).*[.1 1 .3]);q=bC-C2;fvc=K(D)*q+C2;% Create patch and stash colorspatch('Faces',f,'vertices',v,'EdgeC','n','FaceC','i',...'Amb',1,'FaceL','g','FaceVertexC',fvc,'U',fvc);endend

ME / View from a train window

https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/15834

function drawframe(f)
persistent Y
if(f==1)r = rand(1,4000);for i=1:5Y(i,1:800) = smoothdata(smoothdata(r(800*(i-1)+1:i*800)));end
end
clf
hold on
phi = linspace(0,1,4);
patch([1 30 30 1],[0 0 1.5 1.5],phi);
colormap(sky);
c = bone(8);
m = fliplr(1:5);
for i=5:-1:1area(Y(i,1+(m(i)-1)*f:30+(m(i)-1)*f)+(i/10),'FaceColor',c(i,:),'EdgeAlpha',0)
end
hold off
axis([1 30 0 1.5])
set(gca,'XTick',[],'YTick',[])
end

Tim / Snowfall

https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/15824

function drawframe(f)
clf% Face parameters for the mother (right) and child (left) that control
% things such as cheek shape, general head structure, eyes (open v. closed)HP=[2,4;.35,.45;8,4;.35,.3;.48,.52;1.28,1.32;2.3,2.2;1,-1;-.4,.3;.8,.75;4,20];% Mother's face
[x,y,z]=face(400,HP(:,2));% Rotation
a=@(x,y,r)x*cos(r)-y*sin(r);
b=@(x,y,r)x*sin(r)+y*cos(r);% Plot
r=.17;
S=@(x,y,z)surf(x,y,z,'EdgeC','none','FaceC',[1,1,1],'DiffuseS',.2,'SpecularE',1,'SpecularS',1,'AmbientS', 0.0);
S(a(x,y,r)-.2,z,b(x,y,r)-.1);
axis equal off
set(gcf,'color','k');% Light
light('pos',[-1.3,-1,.6]);
camzoom(2.8);
hold on;
% Child's face
[xa,ya,z2] = face(400,HP(:,1));
x2=a(xa,ya,.1);
r=.35;
S(-b(x2,z2,r)*.8-.8, a(x2,z2,r)*.8+.4, b(xa,ya,.1)*.8-.8);
camva(5)campos([-7,-15,3]);
camtarget([-.6,0,-.45]);rng default
N=99;
r=@rand;
a=r(N,1)*2*pi;
z=r(N,1);
a=a+(0:.25:2)*pi;
z=z.*ones(1,9);
d=r(N,1)*2+1;
d=d.*ones(1,9);
g=linspace(0,pi/4,49);
a=[a;a;a;a;a];
d=[d;d;d;d;d];
d=d(:);
z=[z;z-1;z+1;z-2;z+2];
c=a(:)+g(f);
scatter3(d.*cos(c)*2-.6,d.*sin(c)*2,z(:)-f/49,rescale(-d.*(cos(c)+sin(c)))*99+1,'w','filled','MarkerFaceA',.5);
plot3(0,1,-2,'k.','markers',1000)
endfunction [x,y,z]=face(n,P)% Start with a basic sphere
[x,y,z]=sphere(n);
% General distortions to make it more face like
z=erf(z*P(10));
x(y<0)= x(y<0)-abs(y(y<0)).^P(1)*P(2);
z(y<0)= z(y<0).*(1-.5*y(y<0).^P(3));
z(y>0)=z(y>0).*(1-.1*y(y>0).^2);
x(x<0)= erf(0.6*x(x<0))/0.6;
x(x>0)=x(x>0)*.9;
y(y>0)=y(y>0)*.9;
y=y+P(4);z(y>0)=z(y>0).*exp(-x(y>0).^2/3).^y(y>0);
y=y-.3;
x=x+.6;
x(x>0)=x(x>0)*.9;
x=x-.6;m=@(x,o,s).5-erf(-s*x+o).*erf(s*x+o)/2;
c=y(x<0);
c=1-exp(-(c+(exp(c*3)-0.4)).^2*3).*(.7*m(z(x<0),.8,10)+.3).*.1;
x(x<0)=c.*x(x<0);
fc=@(x)exp(-(-x+(exp(-x*9)-.6)).^2*2);
fc2=@(x)exp(-(-x+(exp(-x*2)-.6)).^2*2);% Adding nose & lips
x(x<0)=((1-1*m(z(x<0),2,15)).*(fc(y(x<0)*1+P(5))*.15)+1).*x(x<0);
x(x<0)=((1-1*m(z(x<0),.7,8)).*(fc(y(x<0)*2+P(6))*.08)+1).*x(x<0);
x(x<0)=((.7-.7*m(z(x<0),0,8.5)).*(-fc(-y(x<0)*P(7)-1.71)*.06)+1).*x(x<0);x=x+.5;
x(x>0)=x(x>0).*(1-.35*fc2((y(x>0)+.95)/1.4));
x=x-.5;z=z.*(((x-.2).^2+(y+.4).^2).^.4*.2+.8);
x=x+.5;% Adding eyes
[x,y,z]=ey(x,y,z,P,1);
[x,y,z]=ey(x,y,z,P,-1);
endfunction [x,y,z]=ey(x,y,z,P,s)
b=@(x)tanh(exp(-4*abs(x).^2.5));
xt=(z(x<0)+s*0.33)*5;
yt=(y(x<0)+.145)*7;
ofs=max(b2(yt+P(8)*.2*xt.^2,P(9),P(11)).*b(sqrt(xt.^2+yt.^2)), b(sqrt(1.5*xt.^2+yt.^2))*.7);
x(x<0)=x(x<0)-ofs/20;
end% Bump function with edge for eyes
function m=b2(x,of,s)
m=(erf((x+of)*s)/1.5+.5)+exp(-(x+(of-.1)).^2*10)/4;    
%S.D.G.
end

Nikolay Velkov / O Christmas Tree

https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/15939

function drawframe(f)% This is Xor's AMAZING shader% https://www.shadertoy.com/view/7lKSzw% Here is my translation to MATLABiRes = 300;iTime = f/48*2;persistent fragCoordif isempty(fragCoord)[x,y]=meshgrid(1:iRes, 1:iRes);fragCoord = cat(3,x,flip(y,1));endim = mainImage(fragCoord);im = imresize(im, [3*iRes, 3*iRes], 'method', 'bilinear');imshow(im);axis equalaxis off%% magicfunction finalColor = mainImage(fragCoord)finalColor = zeros(iRes, iRes, 3);r = cat(3,iRes,iRes);for i=0:400if mod(i,8) < 6even =  mod(i,2);c = [even,1- even,0];elsec = [1 1 1];endp = (fragCoord.* 2 - r)./r(:,:,2).*300 + cat(3,0,i-230)....+ cat(3,i+mod(i,99),i/4).*cos(iTime.*0.5+cat(3,i,i+11)).*0.5;for j = 1:3finalColor(:,:,j) = finalColor(:,:,j) + c(j)./vecnorm(p,2,3).^2;end endfinalColor = sqrt(finalColor./0.1);
end
end

HyunGwang Cho / Nyancat

https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/15839

function drawframe(f)
n=nan;% resample
f = mod(ceil((f)/2)-1,12)+1;% canvas
C=ones(69,124)*13;% rainbow
r=([1;1;1]*(7:12));
r=r(:);
r1=28:45;r2=r1-1;
if mod(f,4)<2r1=r2;r2=r1+1;
end
C(r1,[1:6,15:22,31:38,47:53])=repmat(r,[1,29]);
C(r2,[7:14,23:30,39:46])=repmat(r,[1,24]);% stars
a=[2,4,2,0,0,3];
a=mod(a+f-1,6);
y=[-1,8,20,42,54,64];
x=[61,3,21,30,9,55];
x=x-(f-1)*7;
for i=1:6C=p(C,x(i),y(i),s(a(i)));C=p(C,x(i)+84,y(i),s(a(i)));
end% tail (detail)
% z=nan(10,7);
% a=z;a(3:5,3:4)=1;a(5:6,5:7)=1;a([4,7],6:7)=0;a(3:4,[2,5])=0;
% a([22,25,32,36,46])=0;t{1}=a;t{5}=a;t{7}=a;t{11}=a;
% a(2,:)=n;a([4,5,15,26,56,65])=0;a([14,25])=1;t{4}=a;t{10}=a;
% a=z;a([12:11:67,13:11:46,31:11:64,41:11:63,11,21,66])=0;
% a([22:11:55,32:11:65])=1;t{6}=a;t{12}=a;
% a=z;a(7:8,3:6)=1;a(67)=1;a([6,9],4:6)=0;
% a([17,18,27,29,58,65,66,68])=0;t{2}=a;t{8}=a;
% a([17,59,56,66])=n;a([19,30,40,55])=0;a([29,39])=1;t{3}=a;t{9}=a;
% C=p(C,46,33,t{f});% tail (simple)
z=nan(10,7);
a=z;a(3:5,3:4)=1;a(5:6,5:7)=1;a([4,7],6:7)=0;a(3:4,[2,5])=0;
a([22,25,32,36,46])=0;t{1}=a;t{6}=a;t{7}=a;t{12}=a;
a(2,:)=n;a([4,5,15,26,56,65])=0;a([14,25])=1;t{2}=a;t{5}=a;t{8}=a;t{11}=a;
a=z;a(7:8,3:6)=1;a(67)=1;a([6,9],4:6)=0;
a([17,18,27,29,58,65,66,68])=0;t{3}=a;t{4}=a;t{9}=a;t{10}=a;
C=p(C,46,33,t{f});% foot
a=nan(3,6);a(:,2:5)=0;a(1:2,3:4)=1;a(6)=n;a(16)=0;
x=[6,7,6,4,4,6];x=[x,x]+50;x=x(f);
y=[3,4,4,4,4,3];y=[y,y]+40;y=y(f);
C=p(C,x,y,a);C=p(C,x+10,y,a);C=p(C,x+15,y,a);
a=zeros(5,4);a([1,2,6,20])=n;a(3:4,2:3)=1;a(18)=1;
C=p(C,x-4,y-2,a);% body
a=zeros(18,21);a([1,2,18,19])=n;a(2:17,2:20)=4;a([20,35])=0;
a(3:16,3:19)=5;a([39,40,51,52,57,70])=4;a(:,21:-1:18)=a(:,1:4);
b=[66,77,87,100,140,152];a([b,b+143])=6;
y=ones(1,12);y([1,6,7,12])=0;y=y+26;
C=p(C,53,y(f),a);% head
a=ones(13,16);a([1:5,11:14,25:26,39])=n;
a(1,5:9)=n;a(2,6:9)=n;a(3,7:9)=n;
a(6:9,1)=0;a(2:5,2)=0;a([10:14:52,40:14:82,27])=0;
a(13,5:9)=0;a(4,8:9)=0;a(:,16:-1:8)=a(:,1:9);
a(9:10,[3,4,14,15])=2;a(11,6:12)=0;a([75,114,153,125])=0;
a(7:8,[5,6,12,13])=0;a([59,150])=3;
x=[1,1,1,0,0,0];x=[x,x]+63;
y=[0,1,1,1,0,0];y=[y,y]+31;
C=p(C,x(f),y(f),a);% color map
m=[0,0,0;164,164,164;248,176,165;254,254,254;252,218,170;247,185,251;245,123,188;245,62,31;250,167,52;254,238,71;89,216,58;19,154,248;109,92,247;0,78,147]/255;% draw
imshow(uint8(C),m);
endfunction b=s(n)
x4=@(a) a([1:4,3:-1:1],[1:4,3:-1:1]);
z=nan(4);
a=z;a(16)=3;s{1}=x4(a);
a=z;a([12,15])=3;s{2}=x4(a);
a=z;a([8,12,14,15])=3;s{3}=x4(a);
a=z;a([4,8,13,14,16])=3;s{4}=x4(a);
a=z;a([4,6,13])=3;s{5}=x4(a);
a=z;a([4,13])=3;s{6}=x4(a);
b=s{n+1};
endfunction Y=p(I,x,y,S)
Y=padarray(I,[84,84]);
a=y+83+(1:size(S,1));
b=x+83+(1:size(S,2));
Y_=Y(a,b);
i=~isnan(S);
Y_(i)=S(i);
Y(a,b)=Y_;
Y=Y(85:153,85:208);
end

Daniel Pereira / Earth, our only home

https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/15769

function drawframe(f)persistent x;if f==1gx = geoaxes(gcf,'Position',[0 0 1 1],'Basemap','colorterrain','grid','off','tickdir','none');gx.Scalebar.Visible = "off";geolimits([-90 90],[-180 180]);x = getframe(gcf);x = x.cdata;endset(gcf,'color','k');rng(41);scatter3(2*rand(20,1)-1,2*rand(20,1)-1,-ones(20,1),'.w'); hold on;scatter3(2*rand(20,1)-1,ones(20,1),2*rand(20,1)-1,'.w');scatter3(ones(20,1),2*rand(20,1)-1,2*rand(20,1)-1,'.w');lt = linspace(-90,90,size(x,1));ln = linspace(-180,180,size(x,2));[LT,LN] = meshgrid(lt,ln+7.5*f);surf(cosd(LT').*cosd(LN'),cosd(LT').*sind(LN'),-sind(LT'),'cdata',(double(x)/255).^2,'edgecolor','none');axis equal off;hold off;% camlight(30,25);light('style','infinite','color',[0.95 1 0.9],'position',[cosd(180)*cosd(45) cosd(180)*sind(45) sind(180)]);material dull;
end

Nikolay Velkov / Collatz Tree

https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/15617

function drawframe(f)%% Draw the Collatz tree% initialize cycleG = graph([1 2],[2 4]);% starting numbern = 4; % depthdepth = round(f^(3/4)); % do recursionG = collatz(G,n,depth); % remove auto-added isolated nodesisolated_nodes = find(degree(G) == 0);G = rmnode(G,isolated_nodes);% create figurefig = figure;colormap coolp = plot(G);layout(p,'layered','direction','right')for j = 1:G.numedgesedge = table2array(G.Edges(j,:));labelnode(p,edge,string(edge));endp.NodeCData = cellfun(@str2double, p.NodeLabel);p.MarkerSize = 4;p.LineWidth = 1;p.NodeLabel = {};p.EdgeColor = 'w';cbar = colorbar;cbar.Color = 'w';cbar.FontSize = 12;axis offfig.Color = 'k';
end%% Collatz conjecture rule
function G = collatz(G,n,depth)if mod(n,3) == 2R = [2*n, (2*n-1)/3];elseR = 2*n;enddepth = depth -1;if ~depth return endfor j = 1:length(R)G = G.addedge(n,R(j));G = collatz(G,R(j),depth);end
end

O / Skywheel

https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/15367

function drawframe(f)persistent u w c gu g1 g2 c1 cd a0;
cp=@(a,c) colormap(a,c);if f==1rd=@(v) round(v);
sf=@(x,y,z) surface(x,y,z,EdgeColor='no');n=1e2;[x,y,z]=mkp(10,9.8,n);
z=.2*z-.1;[x1,y1,z1]=sphere(4);
x1=.1*rd(x1);
y1=.1*rd(y1);
z1=12*rd(z1);[z2,y2,x2]=mkp(1,.95,n);
z2=z2+12;
x2=.1*x2-.05;[z3,y3,x3]=mkp(.9,.01,n);
z3=z3+12;
x3=.9*x3-.45;a0=axes;
view(3);r0=30;
[x0,y0,z0]=sphere(n);
sf(r0*x0,r0*y0,r0*z0);hold on;c0=cp(a0,'abyss');
c0=flip(c0);
c0(:,1:2)=c0(:,1:2)/2;
c0(:,3)=c0(:,3)/1.4;c1=cp(a0,'sky');
cp(a0,c1);cd=(c0-c1)/48;rs=25;
ns=2e2;
ts=rand(ns, 1)*pi+pi;
ps=acos(rand(ns, 1));
xs=rs*sin(ps) .* cos(ts);
ys=rs*sin(ps) .* sin(ts);
zs=rs*cos(ps);rdsz=3*rand(ns, 1);
rdc=repmat((rand(ns, 1)+1)*.5, 1, 3);u=scatter3(xs,ys,zs,rdsz,rdc,'fi');gu=hgtransform(Pa=a0);
set(u,Pa=gu);campos([-10 -2 5]);
camtarget([0 -15 10]);
camva(49);axis equal off;a1=axes;
view(3);cm=cp(a1,'spring');
cm=cm/2;
cp(a1,cm);
material metal;light(Po=[-10 0 20],St='local');
light(Po=[-10 -30 5],St='local');
light(Po=[-20 -20 20],Col=[.7 .7 .5],St='local');axis equal off;s=[1 .8 .7];for i=1:3x=s(i)*x;y=s(i)*y;z=s(i)*z;w(i+12)=sf(z-.5,y,x);w(i+14)=sf(z+.5,y,x);
endt=pi/6;
rx=[1 0 0;0 cos(t) -sin(t);0 sin(t) cos(t)];for i=1:6[x1,y1,z1]=rot(x1,y1,z1,rx);w(i)=sf(x1-.5,y1,z1);w(i+6)=sf(x1+.5,y1,z1);
endfor i=1:12[x2,y2,z2]=rot(x2,y2,z2,rx);c(i,1)=sf(x2-.4,y2,z2);c(i,2)=sf(x2+.4,y2,z2); 
endfor i=1:12[x3,y3,z3]=rot(x3,y3,z3,rx);c(i,3)=sf(x3,y3,z3);
endalpha(c(:,3),0.2);g1=hgtransform(Pa=a1);
set(w,Pa=g1);g2=hgtransform(Pa=g1);
set(c,Pa=g2);campos([-10 -2 5]);
camtarget([0 -15 10]);
camva(49);endr=f*pi/6/48;
rx1=makehgtform(xrotate=r);
tl1=makehgtform(translate=[0 -sin(r) -cos(r)]);
set(g1,Ma=rx1);
set(g2,Ma=tl1);
rx2=makehgtform(yrotate=pi/9,zrotate=r/10);
set(gu,Mat=rx2);if f<=24c1=c1+cd;alpha(u,f/24)
elsec1=c1-cd;alpha(u,(48-f)/24)
end
cp(a0,c1);endfunction [x,y,z]=mkp(or,ir,n)x=zeros(5,n+1);y=x;z=x;[x([1 4],:),y([1 4],:),z([1 4],:)]=cylinder(ir,n);[x(2:3,:),y(2:3,:),z(2:3,:)]=cylinder(or,n);x(5,:)=x(1,:);y(5,:)=y(1,:);z(5,:)=z(1,:);
endfunction [x,y,z]=rot(x,y,z,t)r=@(v,s) reshape(v,s);s=size(x);p=[x(:) y(:) z(:)]';p=(t*p)';x=r(p(:,1),s);y=r(p(:,2),s);z=r(p(:,3),s);
end

Tim / Icy Comet

https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/15262

function drawframe(f)% Icy cometpersistent frms
if f == 1% A problem with texturing a sphere is what to do about the poles. It is difficult
% to texture the [x, y, z] surface matrices created using the
% sphere command without getting significant anisotropy, pinching and/or
% discontinuities near the top and bottom.
%
% In this example a randomly sampled sphere will be generated, then uniform noise will be added,
% followed by smoothing using the the connectivity matrix relating adjacent points. The
% smoothing allows the noise distribution to be made more realistic and
% avoids the pole pinching artifacts & discontinuities.% % % Creating the comet nodes% Random sphere used here: replace with a fibonacci sphere for a different
% effect% Predictable
rng(7,'twister');% Number of vertices on Asteroid
n=5e4;% Randomly sampled sphere
g=randn(3,n);
p=g./vecnorm(g);% % % Determining connectivity between points
k=convhull(p');
c=@(x)sparse(k(:,x)*[1,1,1],k,1,n,n);                   
t=c(1)|c(2)|c(3);% % % Create the roughness penalizer
w=spdiags(-sum(t,2)+1,0,t*1.);              % t*1. is to convert t from logical to double% % % Random radial distance function to be penalized:
r=rand(n,1);% % % Solve for smoothed surface. Smoothing will be different for ice vs.% rock components.
s=(speye(n)+1e3*w'*w)\r-.43;
s2=(speye(n)+3e3*w'*w)\r-.4;        % Smoother for the ice component
s=s/mean(s);
s2=s2/mean(s2);% % % Apply surface to vertices for rock & ice components
p1 = p.*s';
p2 = p.*s2';% % % Plot.
T(1)=trisurf(k,p2(1,:),p2(2,:),p2(3,:),'FaceC', 'w', 'EdgeC', 'none','AmbientS',0,'DiffuseS',1,'SpecularS',0);
hold on;
T(2)=trisurf(k,p1(1,:),p1(2,:),p1(3,:), s,'EdgeC', 'none','AmbientS',0);
colormap(flipud(gray));
caxis([-1,1]*std(s)+1);
T(1).Parent.Parent.Position(3:4) = [1120, 840];% % % For looping
H=hgtransform('Parent',gca);
H2=hgtransform('Parent',gca);
set(T,'parent',H);% Add stars in the background
rd = rand(n,1);
C=scatter3(p(1,:)*50, p(2,:)*50, p(3,:)*50, rd*300, [1,1,1].*rd,'.');
set(C,'parent',H2);% % % pretty
axis equal off                                          % Pretty
set(gcf,'color','k');
camproj p
camva(6);
camtarget([0,0,0.3]);
light('position',[2,-3,10],'style','local');
light('position',[2,-3,10],'style','local','color',[1,1,1]*.3);ags = linspace(0, pi/3, 48);
for n = 1:48set(H, 'Matrix', makehgtform('xrotate',n/(16*pi)));set(H2, 'Matrix', makehgtform('zrotate',n/(16*pi)));camtarget([0,0,0.3]);campos([21*sin(ags(n)), -21*cos(ags(n)), 0]);frms{n}=getframe(gcf);
endcnt = 1;
close
endimage(frms{f}.cdata);axis equal off
camva(4.5);% S.D.G.
end

Nikolay Velkov / Energy

https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/16004

function drawframe(f)% This is Xor's AMAZING shader% https://www.shadertoy.com/view/cltfRf% Here is my translation to MATLABiRes = [800 450];
iTime = f/16;
persistent fragCoord
if isempty(fragCoord)[x,y]=meshgrid(1:iRes(1),iRes(2):-1:1);fragCoord = cat(3,x',y');
end
im4 = mainImage(fragCoord);
imr = imresize(im4, flip(iRes).*2, 'method', 'bilinear');
im = imshow(imr);function finalColor=mainImage( fragCoord )
finalColor = zeros(iRes(1), iRes(2), 3);
r = cat(3,iRes(1),iRes(2));for i = 0:0.01:1% Center and scale outwardp = (fragCoord.* 2 - r)./iRes(2).*i;% Compute zz = max(1 - vecnorm(p,2,3).^2, 0);% Sphere distortion p = p./(0.2 + sqrt(z).*0.3);% Offset for hex patternp(:,:,1) = p(:,:,1)./0.9 + iTime;p(:,:,2) = p(:,:,2) + mod(ceil(p(:,:,1))*0.5, 1) + iTime * 0.1625;% Mirror quadrantsv = abs((mod(p, 1))-0.5);% Add colorc = [2, 3, 5]./2e3;d1 =max(v(:,:,1).*1.5+ v(:,:,1), v(:,:,1).*2);d2 =max(v(:,:,1).*1.5+ v(:,:,2), v(:,:,2).*2);d3 =cat(3,d1,d2);for j = 1:3finalColor(:,:,j) = finalColor(:,:,j) + c(j).*z./(abs(d3(:,:,2) - 1) + 0.1 - i * 0.09);end
end
finalColor = tanh(finalColor.^2);
finalColor = permute(finalColor,[2 1 3]);
end
end

Lateef Adewale Kareem / Six-Linked Bars Mechanism

https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/15492

function drawframe(f)persistent L1 L2 L3 L4 L5 L6 L7 L8 t2 t3 t4 t5 t6 ...Bar2 Bar3 Bar4 Bar5 Bar6 f1 f2 if f==1L1=5;L2=2;L3=6;L4=4;L5=6;L6=4;L7=5;L8=1;f1=@(t2,t)(L2*cos(t2)-(L1+L4*cos(t)))^2+(L2*sin(t2)-L4*sin(t))^2-L3^2;f2=@(x5,y5,T)[x5+L5*cos(T(1))-(L1+L7+0.9*L6*cos(T(2)))y5+L5*sin(T(1))-(L8+0.9*L6*sin(T(2)))];t=linspace(0,2*pi,7); brown=[206,179,140]/255;s=sin(t);c=cos(t);R=1.15;wclr=0.7*[1,1,1];hold on;fill(R*c,R*s,wclr); fill(L1+R*c,R*s,wclr); fill((L1+L7)+R*c,L8+R*s,wclr);xline(0);yline(0);axis equalt4=acos(((L2+L3)^2-L1^2-L4^2)/(2*L1*L4));c4=cos(t4);s4=sin(t4);t2=asin(sin(t4*L4/(L2+L3)));c2=cos(t2);s2=sin(t2);x3=L2*c2;y3=L2*s2;t3=atan2(L4*s4-L2*s2,L1+L4*c4-L2*c2);x5=L2*c2+(2/3)*((L1+L4*c4)-L2*c2);y5=L2*s2+(2/3)*(L4*s4-L2*s2);t56=fsolve(@(T)f2(x5,y5,T),[1.5*pi;1.5*pi]);t5=t56(1);t6=t56(2);Bar2=BarMaker(L2,'g',0); Bar2.Rotate(t2);Bar3=BarMaker(L3,'b',[0,0.45]); Bar3.Rotate(t3);Bar3.Trans([x3,y3]);Bar4=BarMaker(L4,'g',0);Bar4.Rotate(t4);Bar4.Trans([L1,0]);Bar5=BarMaker(L5,brown,0.3); Bar5.Rotate(t5);Bar5.Trans([x5,y5]);Bar6=BarMaker(L6,'r',0); Bar6.Rotate(t6);Bar6.Trans([L1+L7,L8]);axis([-2.6,11.4,-5,5])elset2=t2+2*pi/48; c2=cos(t2);s2=sin(t2);x3=L2*c2;y3=L2*s2;t4=fzero(@(t)f1(t2,t),t4); c4=cos(t4);s4=sin(t4);t3=atan2(L4*s4-L2*s2,L1+L4*c4-L2*c2);x5=L2*c2+(2/3)*((L1+L4*c4)-L2*c2);y5=L2*s2+(2/3)*(L4*s4-L2*s2);t56=fsolve(@(T)f2(x5,y5,T),[t5;t6]); t5=t56(1);t6=t56(2);Bar2.Rotate(t2);  Bar3.Rotate(t3);Bar3.Trans([x3,y3]); Bar4.Rotate(t4);Bar5.Rotate(t5); Bar5.Trans([x5,y5]); Bar6.Rotate(t6);end
endfunction B=BarMaker(L,clr,F)t1=pi/2+linspace(0,pi); t2=t1+pi; s1=sin(t1);s2=sin(t2);c1=cos(t1);c2=cos(t2);Xl=[0.5*c1,L+0.5*c2];Yl=[0.5*s1,0.5*s2];X=Xl; Y=Yl;Xl=[Xl,Xl(1)]; Yl=[Yl,Yl(1)]; for n=1:numel(F)f=F(n);X=[X,f*L,f*L+0.3*[c1,c2],f*L];Y=[Y,0.5,0.3*[s1,s2],0.5];Xl=[Xl,nan,f*L+0.3*[c1,c2]];Yl=[Yl,nan,0.3*[s1,s2]];endax=gca;H=hgtransform('Parent',ax);K=hgtransform('Parent',H);B.line=plot(Xl,Yl,'k','Parent',K);B.fill=fill(X,Y,clr,'EdgeColor','none','Parent',K);B.Rotate=@(t)set(K,'Matrix',makehgtform('zrotate',t));B.Trans=@(p)set(H,'Matrix',makehgtform('translate',[p,0]));
end

本次活动圆满结束,想参加只能等明年了,可以在比赛页面蹲一下:

  • https://ww2.mathworks.cn/matlabcentral/contests.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/214396.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

MongoDB的连接数据库,创建、删除数据库,创建、删除集合命令

本文主要介绍MongoDB的连接数据库&#xff0c;创建、删除数据库&#xff0c;创建、删除集合命令。 目录 MongoDB连接数据库连接到本地 MongoDB 实例连接到远程 MongoDB 实例 MongoDB创建和删除数据库MongoDB创建和删除集合创建集合删除集合 MongoDB连接数据库 连接 MongoDB 数…

2023济南大学acm新生赛题解

通过答题情况的难度系数&#xff1a; 签到&#xff1a;ACI 铜牌题&#xff1a;BG 银牌题&#xff1a;EF 金牌题&#xff1a;DHJKO 赛中暂未有人通过&#xff1a;LMNP A - AB Problem 直接根据公式计算就行。 #include<stdio.h> int main(){int a,b;scanf("%…

2021年第十届数学建模国际赛小美赛A题气道阻力的评估解题全过程文档及程序

2021年第十届数学建模国际赛小美赛 A题 气道阻力的评估 原题再现&#xff1a; 气道阻力的定义是通过肺气道产生单位气流所需的经肺压力的变化。更简单地说&#xff0c;它是嘴和肺泡之间的压力差&#xff0c;除以气流。影响气道阻力的因素是多方面的&#xff0c;我们需要探讨这…

理解基于 Hadoop 生态的大数据技术架构

转眼间&#xff0c;一年又悄然而逝&#xff0c;时光荏苒&#xff0c;岁月如梭。当回首这段光阴&#xff0c;不禁感叹时间的匆匆&#xff0c;仿佛只是一个眨眼的瞬间&#xff0c;一年的旅程已成为过去&#xff0c;而如今又到了画饼的时刻了 &#xff01; 基于 Hadoop 生态的大数…

倪海厦:教你正确煮中药,发挥最大药效

同样的一个汤剂&#xff0c;我开给你&#xff0c;你如果煮的方法不对&#xff0c;吃下去效果就没那么好。 所以&#xff0c;汤&#xff0c;取它的迅捷&#xff0c;速度很快&#xff0c;煮汤的时候还有技巧&#xff0c;你喝汤料的时候&#xff0c;你到底是喝它的气&#xff0c;…

Codeforces Round 913 (Div. 3) A~E

目录 A. Rook 问题分析: B. YetnotherrokenKeoard 问题分析: C. Removal of Unattractive Pairs 问题分析: D. Jumping Through Segments 问题分析: E. Good Triples 问题分析: A. Rook 问题分析: 给一个棋子将其同行同列的位置输出 #include<bits/s…

[每周一更]-(第76期):Go源码阅读与分析的方式

读源码可以深层理解Go的编写方式&#xff0c;理解作者们的思维方式&#xff1b;也有助于对Go语法用法深刻的理解&#xff0c;我们从这一篇说一下如何读源码&#xff0c;从哪些源码着手&#xff0c;从 简单到深入的方式学习源码&#xff1b; 学习源码也是一个修炼过程&#xff0…

react中使用react-konva实现画板框选内容

文章目录 一、前言1.1、API文档1.2、Github仓库 二、图形2.1、拖拽draggable2.2、图片Image2.3、变形Transformer 三、实现3.1、依赖3.2、源码3.2.1、KonvaContainer组件3.2.2、use-key-press文件 3.3、效果图 四、最后 一、前言 本文用到的react-konva是基于react封装的图形绘…

【数据结构】——二叉树简答题模板

目录 一、树和二叉树的概念&#xff08;一&#xff09;二叉树的定义和性质&#xff08;二&#xff09;树和二叉树的区别 二、完全二叉树和满二叉树三、二叉树的遍历&#xff08;一&#xff09;由序列确定二叉树&#xff08;二&#xff09;不同遍历序列的关系 四、二叉树的性质&…

tomcat源码学习记录

tomcat 学习记录 tomcat 编译ant 下载编译运行 源码Debug运行 Bootstrap运行Tomcat查看状态 pom.xml测试EmbeddedTomcat 参考书籍博客 tomcat 编译 下载 tomcat 10 源码&#xff0c;解压然后idea导入 包存放的默认位置如下&#xff1a;base.path${user.home}/tomcat-build-lib…

2024 年顶级的 Android 系统修复软件与方法

您是否正在寻找可以修复 PC 上 Android 操作系统的工具&#xff1f;这是我们精选的最好的 Android 系统修复软件&#xff01; Android 是世界著名的智能手机操作系统。全世界有数百万人使用这个操作系统&#xff0c;这使得它安全可靠。然而&#xff0c;这仍然不能使它完美无缺…

数据分析基础之《matplotlib(4)—柱状图》

一、柱状图绘制 1、柱状图要素 有类别 2、需求&#xff1a;对比每部电影的票房收入 电影数据如下图所示&#xff1a; 3、matplotlib.pyplot.bar(x, height, width0.8, bottomNone, *, aligncenter, dataNone, **kwargs) 说明&#xff1a; x&#xff1a;有几个类别 height&am…

vscode 编译运行c++ 记录

一、打开文件夹&#xff0c;新建或打开一个cpp文件 二、ctrl shift p 进入 c/c配置 进行 IntelliSense 配置。主要是选择编译器、 c标准&#xff0c; 设置头文件路径等&#xff0c;配置好后会生成 c_cpp_properties.json&#xff1b; 二、编译运行&#xff1a; 1、选中ma…

vue 实现返回顶部功能-指定盒子滚动区域

vue 实现返回顶部功能-指定盒子滚动区域 html代码css代码返回顶部显示/隐藏返回标志 html代码 <a-icontype"vertical-align-top"class"top"name"back-top"click"backTop"v-if"btnFlag"/>css代码 .top {height: 35px;…

MA营销自动化如何助力商家实现精准营销?

惟客数据 MAP 是一个跨渠道和设备的自动化营销平台&#xff0c;允许接触点编排个性化旅程&#xff0c;通过短信、社交推送等方式为您的客户创建无缝的个性化体验&#xff0c;加强客户关系并赢得忠诚度。可与惟客数据CDP 产品无缝配合使用&#xff0c;通过数据驱动做出更实时&am…

Kotlin Flow 操作符

前言 Kotlin 拥有函数式编程的能力&#xff0c;使用Kotlin开发&#xff0c;可以简化开发代码&#xff0c;层次清晰&#xff0c;利于阅读。 然而Kotlin拥有操作符很多&#xff0c;其中就包括了flow。Kotlin Flow 如此受欢迎大部分归功于其丰富、简洁的操作符&#xff0c;巧妙使…

当使用RSA加密,从手机前端到服务器后端的请求数据存在+

将转成了空格&#xff0c;导致解密出错 将空格转成了

字节开源的netPoll底层LinkBuffer设计与实现

字节开源的netPoll底层LinkBuffer设计与实现 为什么需要LinkBuffer介绍设计思路数据结构LinkBufferNodeAPI LinkBuffer读 API写 APIbook / bookAck api 小结 本文基于字节开源的NetPoll版本进行讲解&#xff0c;对应官方文档链接为: Netpoll对应官方文档链接 netPoll底层有一个…

Google Bard vs. ChatGPT 4.0:文献检索、文献推荐功能对比

在这篇博客中&#xff0c;我们将探讨和比较四个不同的人工智能模型——ChatGPT 3.5、ChatGPT 4.0、ChatGPT 4.0插件和Google Bard。我们将通过三个问题的测试结果来评估它们在处理特定任务时的效能和响应速度。 导航 问题 1: 统计自Vehicle Routing Problem (VRP)第一篇文章发…

【C++】简单工厂模式

2023年12月6日&#xff0c;周三下午 今天又学习了一次简单工厂模式 每多学习一次&#xff0c;都会加深对设计模式的理解 目录 什么是简单工厂模式简单工厂模式的优缺点举例说明 什么是简单工厂模式 简单工厂模式&#xff08;Simple Factory Pattern&#xff09;是一种创建型…