当前位置: 首页 > news >正文

江西企业网站建设费用虚拟货币做空网站

江西企业网站建设费用,虚拟货币做空网站,成都广告设计公司排行,石青网站推广软件今天带来一下MATHWORKS官方举办的迷你黑客大赛第三期(MATLAB Flipbook Mini Hack)的最新进展#xff01;#xff01;目前比赛已经进行了两周非常荣幸能够成为第一周的阶段性获奖者#xff1a; 本来并不打算每周进行一次赛况讲解#xff0c;但是由于字符限制改成了2000…今天带来一下MATHWORKS官方举办的迷你黑客大赛第三期(MATLAB Flipbook Mini Hack)的最新进展目前比赛已经进行了两周非常荣幸能够成为第一周的阶段性获奖者 本来并不打算每周进行一次赛况讲解但是由于字符限制改成了2000大家的创造力仿佛上了一个台阶一周内又是超级多优秀的作品被给出 本次比赛要求提交名为drawframe(f)的函数代码生成长达2s48帧的动态图动图生成是依靠如下代码来做到的 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, LoopCountInf, DelayTimedelayTime);elseimwrite(A,map,animFilename, WriteModeappend, DelayTimedelayTime);endend end闲话少叙一起看作品 作品概览 Tim大佬继续大展身手 Tim / Lanterns https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/14082 function drawframe(f) tic persistent frms % Once again, doing all the primary plotting at f1 and just% Storing the frame data rng default if f1 NL200; % Number of lanterns xyzLrand(3,NL).*[6;6;3]*10[0;0;2]*1; % Locations % Create lanterns interiors and store handles for n 1:NL[xc,yc,zc,cmp]lantern(.6.4*rand(1),(rand(1)-.5)*.1);rsqrt(xc(1).^2yc(1).^2);[xl,yl,zl]ll(r,zc(1));S{n}warp(xcxyzL(1,n),ycxyzL(2,n),zcxyzL(3,n),cmp);hold on;S2{n}warp(xlxyzL(1,n),ylxyzL(2,n),zlxyzL(3,n),cmp(1:10,1,:).^.5);C1{n}S{n}.CData;C2{n}S2{n}.CData; end % Twinkler lgtexp(-linspace(-1,1,49).^2*200)*ones(1,NL); for n1:NLlgt(:,n)1-circshift(lgt(:,n),randi(48,1))*rand(1)*.7; end % This lantern will be the focus of the scene sl[5,5,3]; [xc,yc,zc,cmp]lantern(.6.4*rand(1),(rand(1)-.5)*.1); rsqrt(xc(1).^2yc(1).^2); [xl,yl,zl]ll(r,zc(1)); warp(xcsl(1),ycsl(2),zcsl(3),cmp); warp(xlsl(1),ylsl(2),zlsl(3),cmp(1:10,1,:).^.6); % Create motion vector for each lantern rand(6,NL); % Jogging the random stream to a position I like xmrandn(3,NL).*[1;.5;1]/40; % Make figure big to reduce aliasing S{1}.Parent.Parent.Position(3:4)[1120,840]; % Pretty axis equal off set(gcf,color,[.2,.1,.15]); camproj p camva(40); camtarget(sl); % Loop poses for n 1:48% Update lantern positions twinklefor m 1:NLS{m}.XDataS{m}.XDataxm(1,m);S2{m}.XDataS2{m}.XDataxm(1,m);S{m}.YDataS{m}.YDataxm(2,m);S2{m}.YDataS2{m}.YDataxm(2,m);S{m}.ZDataS{m}.ZDataxm(3,m);S2{m}.ZDataS2{m}.ZDataxm(3,m);S{m}.CDataC1{m}.*lgt(n,m);S2{m}.CDataC2{m}.*lgt(n,m);end% Update camera positioncampos([n/(17),n/100,n/80]);% Get frame, apply anti-alias filter and decimateRgetframe(gcf);Rimgaussfilt(double(R.cdata)/255,2);frms{n}R(1:2:end,1:2:end,:); end close end % Load frame IGfrms{f}; % Apply glow for n 1:2 IGmax(IG,imgaussfilt(IG,21)); end % Final frame: image(IG); axis equal off camva(5) toc end % Lantern interior: a lit hemisphere function [x,y,z]ll(r,zo) [x,y,z]sphere(20); xx(11:end,:)*r; yy(11:end,:)*r; zz(11:end,:)zo; end % Lantern exterior % f (randomized when called) controls shape % s (randomized when called) controls hue function [x,y,z,cmp]lantern(f,s) wntukeywin(30,f); [xc,yc,zc]cylinder(wn,20); xcxc(9:end,:); ycyc(9:end,:); zczc(9:end,:); zczc-.5; xxc.*(rescale(zc)2)/3; yyc.*(rescale(zc)2)/3; zerf(zc*4)*1.5; zz*max((min(1-f,.3)/.3),.5); % Special colormap for lanterns y1[245,241,130]/255; y2[255,142,76]/255; y3[203,121,71]/255; cmpinterp1([1,80,256],[y1;y2;y3*.5],(1:256),spline); % Rotate hue of colormap grgb2hsv(min(cmp,1)); g(:,1)g(:,1)s; g(g0)1g(g0); cmphsv2rgb(g); cmppermute(cmp,[1,3,2]); %S.D.G. endTim / Morning ascent https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/13820 function drawframe(f) % Trying to meet last years character limits! if f 1 rng(1,v4) x(-1:.005:1).^2; g30*abs(ifft2(exp(6*i*rand(401))./(xx1e-5))); s(x,y)surf(x,EdgeC,none,FaceC,y); s(g,k); hold s(conv2(g1,ones(20)/400),w); axis equal off camproj p; camva(40); end campos([20 20f 45f/2]); set(gcf,color,[0,.1,.3]f/69); light(color,[2,1,1]/4); enTim / Ruby https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/13952 function drawframe(f) % Red version / bigger scales. persistent frms % All we will be keeping is the cell array of frames because% the whole loop will run on the first function call.% The reason for this is that some spatially variant% blurring will be applied to the RGB data on each% loop. tic if f 1% Base texture scale xlinspace(-4, 4, 400); % Shape of scale - ovalish but extended on one side m1-(erf(50*(3*x.^2x.^2-.5)max(24*x.^5,-20))1)/2; % Basic scale shape mask mmax(m,circshift(m,[0,5])); % Needs to be a bit longer % Scales are slightly curved sm.*cos(2*x); ss-x.*m/3; % Needs change in height so that it overlaps well km.*rescale(1./(abs(x) 0.01))*0.1.*(min(0,x-0.3).^2); % Add keel sskconv2(m.*randn(size(k))/100, ones(1,11)/11, same); % Some textury-noise % Now the tiling... sos; SS40; for n 1:9so max(so, circshift(s, n*SS)); end so max(so, circshift(so, [SS/2, 40])); for n 1:4;so max(so, circshift(so, [0, 80*n])); end so(so0.7)0.7; % Turn into radial distance soso*0.4; soso10; soflipud(so); % More tiling so[so,so]; so[so;so]; % Apply to snake body. Snakes are not cylindrical, they have a prominent % spine and flat underside (sort of / lots of variation here) alinspace(0,2*pi,size(so, 2))-pi; sobso; so so (exp(-(a).^2*50) - exp(-(api).^2*2)*2)- exp(-(a-pi).^2*2)*2; xsin(a).*so; ycos(a).*so; zlinspace(-1,1,size(x,1)).*ones(1,length(a))*8*3; % Woops, that was too high resolution. Cut off the backside so it renders xx(:, (1:325)375); yy(:, (1:325)375); zz(:, (1:325)375); sobsob(:, (1:325)375); % Still too high resolution. Decimate... % xx(1:2:end, 1:2:end); % yy(1:2:end, 1:2:end); % zz(1:2:end, 1:2:end); % sobsob(1:2:end, 1:2:end); % Plot Ssurf(x,z,y,rescale(sob).*cat(3,1,.2,0), SpecularStrength, 0.5, DiffuseStrength, 1, AmbientStrength, 0); shading flat % Too pixelated. Make larger S.Parent.Parent.Position(3:4)[1120,840]; % Camera setup etc. axis equal off set(gcf, color, k); light(position, [0, 0, 1]); view([90, 10]); camtarget([0,-4,5]); campos([265, 0.05*n*4, 48]); camproj p camva(5); % Rotate snake through image in 48 frames for n 1:48 S.YData z -.05*n*4;S.ZData y - .004*(S.YData4).^2;drawnow;frms{n}getframe(gcf); end % Close because we are actually going to work with the rgb data close end % Now lens blur simulation - weight w/cosine tapering wnmin((1-cos(linspace(0, 2*pi, size(frms{f}.cdata(:,:,1),2))))/1.9, 1); IGflt(frms{f}.cdata,wn,2); % Decimate IGIG(1:2:end, 1:2:end, :); image(IG); axis equal off camva(6) toc end % Local smoother function inflt(in,wgt,nits) if nargin 1wgt zeros(size(in(:,:,1)));nits1; end in double(in)/255; % Blur kernel krn [1, 2, 3, 4, 5, 4, 3, 2, 1]; krn krn*krn; krn krn/sum(krn(:)); % Apply to each color channel for m 1:3for mm 1:nitsin(:, :,m) wgt.*in(:,:,m) (1-wgt).*conv2(in(:,:,m), krn, same);end end % S.D.G. endTim / Fracture https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/14377 function drawframe(f) % Done with my kids! Explosion using voronoi cells. persistent V T T2 Vg Xo R C L L2 rng default N150; % Number of voronoi domains v(x)vecnorm(x); % This is used a lot...if f1% Distribute points in the unit sphere, biased toward the centerXorandn(3,N);XoXo./v(Xo).*rand(1, N);% Bounding layer of points that will create our outer surface. Need% lots of them...NA100;psrandn(3,NA);ps1.3*ps./v(ps);% ConcatenateX[Xo,ps];% Voronoi diagram[V,R]voronoin(X);mnRcellfun(min, R)~1; % Which cells have infsgindsunique(cell2mat(R(~mnR))); % Get bordering nodesIindssetdiff(1:size(V,1), ginds); % Get interior nodesmxrmax(v(V(Iinds,:)));ginds(1)[]; % Get rid of inf % Make non-inf outer-nodes have unit radius * some small scale factorV(ginds,:)1.3*V(ginds,:)./v(V(ginds,:));% GlowVgones(size(V,1),1);Vg(ginds)0; TS(k,x,y,z,C)trisurf(k,x,y,z,FaceC,C,EdgeC,none);cnt 1;for n 1:length(mnR)if mnR(n) 1xtV(R{n},1);ytV(R{n},2);ztV(R{n},3);C[1,1,1];k convhull(xt,yt,zt);T{n}TS(k,xt,yt,zt,C/2);hold on;material(T{n},[0,1,0,3]);s1.1;T2{n}TS(k,xt*s,yt*s,zt*s,C);material(T2{n},[1,0,0,3]);set(T2{n},FaceAlpha,interp,FaceVertexAlphaData,.1*Vg(R{n}),AlphaDataMapping,None);if cnt 1set(gca, color, k);axis equal offaxis([-1,1,-1,1,-1,1]*6);cnt cnt 1;camproj pcamva(70);campos([-55-5 -71 52]/30);set(gcf,color,k);L2light;L{1}light(position,[0,0,0],style,local);L{2}light(position,[0.1,0,0], style,local); endendendelseif f10for n1:NT2{n}.FaceVertexAlphaData .1*Vg(R{n})*f;endL2.Color C/f;elseif f 10 % Loop over fragments and expandfor n 1:NT2{n}.Vertices1.3*V(R{n},:)*4000/f.^3;T2{n}.FaceVertexAlphaDataT2{n}.FaceVertexAlphaData*.95;T{n}.VerticesT{n}.Vertices2.5*Xo(:,n)/f; endif f 20for n1:2L{n}.ColorL{n}.Color*.96;endL2.Color C*f/48;endend endJr大佬的一系列字符够成的画 Jr / the rise of Matzilla! https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/14292 %Hello all!! %I started this code with one of my 2021 mini hack images: %https://www.mathworks.com/matlabcentral/communitycontests/contests/4/entries/3626 %The result is just some layers of ocean made with two sines each, a good %capture of them, and an emoji of our cute monster up and down. %Aah, and some triangles to make him not so cute. %First, we make layers of blue waves, then we make MATzilla and finally, we finish adding more waves. function drawframe(f)c1200;d700;n800;m.37;hold on;%Lets make the ocean (1st part): we have some layers here [18-9] (behind Matzilla). for i18:-1:9yi/11*d;a10*m^(i-1);uc*(1-(i-1)/8);xlinspace(0,c,n);py/d*4*pi;tx*2*pi/u;qsin(f/4.3*t)sin(f/8.2*t); %if youll remix another ocean, %you can change the frequency of them, or the amplitude... I used a frequency%division whose result is an integer to make the waves move 1 period within 2%seconds.ryq*120*.8^(i-1);3^(i-1);v[x r;c 0;0 0];%making the ocean blue;fill(v(:,1),v(:,2),i/18*[.1 .7 1],EdgeColor,n); end %Now we can use emojis to make Matzilla: Dino triangles. %Move them with the variable f forward and backward. if 24fhttext(380f,670f,,color,black,FontSize,60);ht.Rotation -55ittext(850f,609f,▲,color,black,FontSize,20);it.Rotation -55jttext(975f,579f,▲,color,black,FontSize,30);jt.Rotation -65kttext(1040f,525f,▲,color,black,FontSize,30);kt.Rotation -65 elsehttext(405(25-f),695(25-f),,color,black,FontSize,60);ht.Rotation -55ittext(875(25-f),634(25-f),▲,color,black,FontSize,20);it.Rotation -55jttext(1000(25-f),604(25-f),▲,color,black,FontSize,30);jt.Rotation -65kttext(1065(25-f),550(25-f),▲,color,black,FontSize,30);kt.Rotation -65 end %Ocean (2 part): we have more layers here [9-7] (in front of Matzilla). for i9:-1:7yi/11*d;a10*m^(i-1);uc*(1-(i-1)/8);xlinspace(0,c,n);py/d*4*pi;tx*2*pi/u;qsin(f/4.3*t)sin(f/8.2*t);ryq*120*.8^(i-1);3^(i-1);v[x r;c 0;0 0];fill(v(:,1),v(:,2),i/18*[.1 .7 1],EdgeColor,n); end %final adjustments for plotting. Hope you like it. ;) axis off; ylim([250,n]) endJr大佬的一系列字符够成的画 Jr / NOOO!!! Matzilla hit us!! https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/14302 %well, I made this just by changing (again) my previous code. The %process is the same: % 1. We make layers of the blue sky; % 2. We add emojis up and down (its funny to control the movement of them) % 3. We make layers of green mountains; function drawframe(f)c1200;d700;n800;m.37;hold on; %Making the sky: for i15:-1:13yi/11*d;a20*m^(i-1);uc*(1-(i-1)/8);xlinspace(0,c,n);py/d*4*pi;tx*2*pi/u;qsin(f/4.3*t)sin(f/8.2*t);ryqcumsum(sqrt(a)*randn(1,n));3.2^(i-1);v[x r;c 0;0 0];fill(v(:,1),v(:,2),i/18*[.7 .7 .7],EdgeColor,n); end %Using emojis and moving them with our parameter f as well: httext(380-(f*5),670-(f*5),,color,black,FontSize,40); if f38httext(50,500,,color,r,FontSize,80); end hctext(10f*2,660,☁,color,w,FontSize,20); ictext(450f*4,780,☁,color,w,FontSize,30); kctext(850f*3.5,610,☁,color,w,FontSize,50); %Making the mountains for i9:-1:4yi/11*d;a170*m^(i-1);uc*(1-(i-1)/8);xlinspace(0,c,n);py/d*4*pi;tx*2*pi/u;qsin(f/2.3*t)sin(f/8.2*t);ryqcumsum(sqrt(a)*randn(1,n));3.2^(i-1); %unlike the previous code,%here there is a random/noisy component to make it look like grass/earthv[x r;c 0;0 0];fill(v(:,1),v(:,2),i/18*[216 171 100]/255,EdgeColor,n); end %final adjustments for plotting. axis off; ylim([200,n]) end以下就直接放代码不咋说明啦 Adam Danz / Rainy window https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/14367 function drawframe(f) persistent T dropSzFcn dropFcn if f1 || isempty(T)rng(359,twister) % set the random number generator for reproducibilitync50; % number of colors in colormapcmapgray(nc); % used to set the background coloraxes(Position[0 0 1 1]) % example axes to full size of figurecolormap(cmap(1:ceil(0.4*nc),:)) % cut out the upper (lighter) part of the colormaphold on% background imagebx1:50; % set size of the square imagebyexp(-(((bx-6).^2)/(2*8.^2))); % gaussianIimagesc([0,1],[0,1],by0*bx); axis tight equal off% add distant lightsncl99; % number of colors for the lightsLChot(ncl); % light colorsnl30; % number of lightsr()rand(nl,1); % generate nlx1 random numbers 0:1bbubblechart(r(),r(),r(),LC(randi(ncl,nl,1),:),MarkerEdgeColorn); % street lightsfigSzget(gcf,Pos);bubblesize([3,0.1*max(figSz(3:4))]) % Scale light size to figure size% blur the image% the background and lights are flattened into a single image and% blurred.fgetframe;b.deleteI.CDataimfilter(flipud(f.cdata),ones(10)/100);% Add rain dropsnd99; % number of dropsTtable(); % use a table to store some variablesT.objgobjects(nd,1); % droplet surf objectsT.dropSznan(nd,1); % scale factor for drop sizedropSzFcn()max(min(randg(1),6),.8)/150; % Drop size, truncated gamma distribution[x,y,z]sphere(20); % use a larger number for smoother raindrop surfaces, but slower.dropFcn(sz)surf(sz*xrand,2*sz*yrand*1.1,sz*max(z,0),... % function to create raindropsFaceCow,FaceAl.2,EdgeCon,...SpecularSt1,SpecularExp2, ...DiffuseSt1,AmbientSt.1);for i1:nd % Create the rain dropsT.dropSz(i)dropSzFcn();T.obj(i)dropFcn(T.dropSz(i));endlight(Po[0.5 -1 0.1]); % rain drops should be dark on top and light on bottomxlim([0,1])ylim([0,1])set(gcf,Colork) end % Add new drops n5; % number of rain drops to add T2table(); % create a temporary table to store variables T2.objgobjects(n,1); % droplet surf objects T2.dropSznan(n,1); % scale factor for drop size for k1:n % add more raindropsT2.dropSz(k)dropSzFcn();T2.obj(k)dropFcn(T2.dropSz(k)); end T[T;T2]; % Determine which rain drops are falling by drop size (larger ones fall) % figure(); histogram(T.dropSz) % for decision making T.isFallingT.dropSz 0.01; % Reduce threshold to increase the number of falling rain drops % The amount of downward displacement is determined by drop size for jfind(T.isFalling)T.obj(j).YDataT.obj(j).YData-T.dropSz(j); % shift downward end % Determine if any drops overlap % Reduce the computational expense by assuming drops are rectangular and % useing MATLABs rectint, though it contains 1 extra step that isnt needed % (computing area of overlap) but its still fast and clean. [mmy(:,1),mmy(:,2)]arrayfun((h)bounds(h.YData,all),T.obj); % [min,max] for ydata [mmx(:,1),mmx(:,2)]arrayfun((h)bounds(h.XData,all),T.obj); % [min,max] for xdata % Covert the drops x and y data to rectangular vectors [x,y,width,height] T.xywh[mmx(:,1),mmy(:,1),diff(mmx,1,2),diff(mmy,1,2)]; % If a water drop is off the figure, remove it T.isoffmmy(:,2) 0; T.obj(T.isoff).delete; T(T.isoff,:)[]; % Compare all pairs of drops without duplicate comparisons objPairsnchoosek(1:height(T),2); overlapfalse(height(objPairs),1); for q1:height(objPairs)% Because were treating the raindrops as rectangles, there will be% falsely labeled overlaps in the corner of the rectangles. To reduce% the number of false positives, well require the overlap to be at least% 21.5% of the smallest raindrop since a circle consumes 78.5% of its% bounding box.minAreamin(prod(T.xywh(objPairs(q,:),[3,4]),2))*(1-.785);overlap(q)rectint(T.xywh(objPairs(q,1),:),T.xywh(objPairs(q,2),:)) minArea;if overlap(q) all(isvalid(T.obj(objPairs(q,:))))% highlight the overlapping raindrops, for troubleshooting% set(T.obj(objPairs(q,:)),facecolor,m,AmbientStrength,1 )% Which drop has the smallest width?[~,minidx]min(T.xywh(objPairs(q,:),3));% The smaller drop is absorbed (removed)T.obj(objPairs(q,minidx),:).delete;% Elongate the surviving dropletmaxidxabs(3*(minidx-1)-2); % converts 2 to 1 or 1 to 2;ydT.obj(objPairs(q,maxidx)).YData;ydmumean(yd,all);ef1.05; % elongation factorT.obj(objPairs(q,maxidx)).YData(ef*(yd-ydmu))ydmu;% Update dropSzT.dropSz(objPairs(q,maxidx))ef*T.dropSz(objPairs(q,maxidx));% Make the elongaged drops narrowerxdT.obj(objPairs(q,maxidx)).XData;xdmumean(xd,all);T.obj(objPairs(q,maxidx)).XData(1/ef*(xd-xdmu))xdmu;end end % Remove rows of the table that belong to deleted rain drops T(:,3:end)[]; % Remove the columns that will be recomputed on next iteration T(~isvalid(T.obj),:)[]; endEric Ludlam / Lonely Lighthouse https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/14022 function drawframe(f)% shortennersrrand;lslinspace;% Make all our circles the samenv300;thls(0,2,nv);Xcospi(th);Ysinpi(th);Zones(1,nv); % Stuff in front needs to be pushed ahead of the backdrop imagesFZ2;if f1set(gca,position,[0 0 1 1],clipping,off);hold onimagesc([-1 1],[1.5 0],(1:256));colormap(abyss.^2) % square to get more black, but it made the blue niftier too%% Starry sky% do first due to newplotN120;sir(1,N); % Size and Color are related, so use same random #sscatter(r(1,N)*2-1,r(1,N)*1.3.1,(si.2)*40,(si*.5.5).*[1 1 1],Marker,.);%% Lighthouselh_r[.16 .1 .15 .15 .05 .05 .14 0]*.5;lh_y[.1 .78 .78 .82 .82 .89 .89 1];lh_c[.5 .5 .3 .3 1 1 .3 .3]; % shade of gray means I only need 1 # per profile ringHCones(1,nv,3).*lh_c; % convert lh_c to RGB colorsurface(X.*lh_r,Z.*lh_y,Y.*lh_rFZ,HC,FaceC,f,EdgeC,n);% Make the light part brighter by setting FaceLighting to nonelhlr[.1 .1]*.5;surface(X.*lhlr,Z.*[.8 .9],Y.*lhlrFZ,FaceC,w,EdgeC,n,FaceL,n);%% The lighthouse sits on a rockN120;RN12;% This computes random points on a half sphere.r_thr(1,N)*2;ur(1,N)*2-1;rthls(0,2,RN1);rth(end)[];pts[0 cospi(r_th).*sqrt(1-u.^2) cospi(rth)0 sinpi(r_th).*sqrt(1-u.^2) sinpi(rth)0 abs(u) zeros(1,RN)];% Form the patch around the random pts using convex hulllfconvhulln(pts);% Move pts in/out to make it bumpy and scale into our world.% You have to make it bumpy after convex hull b/c that ignores pts inside the hull.D(.9r(1,NRN1)*.3);lvpts.*D.*[.5 .11 .3];% Adjust colors to be darker in depths.I[.55 .41 .36];% brownChsv2rgb(rgb2hsv(I).*[1 1 .5]);qI-C;patch(Faces,lf,Vertices,lv(:,[1 3 2])[0 0 FZ],FaceC,i, ...EdgeC,none,FaceVertexCData,rescale(D)*qC,FaceL,g);%% The light beam (fill in later)patch(tag,LB,vertices,[],faces,[],...edgec,n,facec,w,facea,i,facel,n)%% Reflection off the ocean (fill in later)image([-1 1],[-.5 .02],rand(200),tag,O);%% Nicify axesmaterial([.6 .6 .8 2 .8])axis([-1 1 -.5 1.5],off);daspect([1 1 1])light(pos,[0 0 0],color,[.5 .5 .6 ],tag,LBO);end% Find all our objects from initial creationLBfindobj(tag,LB);LBOfindobj(tag,LBO);Ofindobj(tag,O);%% Create the light-beam eminating from the lighthouseAinterp1([1 49],[0 2],f); % Angle to point light beam for this frame% Create a mask (pts) to project through.% Mask is a circle in cylindrical coords with a wavy radius (defined by wf)wfcospi(th*50)*.003;osX*.15A;mxcospi(os).*(.08wf);myY*.03.85;mzsinpi(os).*(.07wf);pts[mxmymz];% Light posn for projectionL[0 .85 0];% Set posn of our actual light so the tower/rock is illuminated by% the light bean reflecting off the air / virtual fogset(LBO,Pos, [ cospi(A) L(2) sinpi(A) ]);%% Extrude a cone of light through the mask% Compute normalized vectors away from light through each vertexvv(pts-L)./vecnorm(pts-L,2,2);% Compute length and alpha based on angle to camera.% The idea is that the more volume of light you see through the more particles% in the air it reflects off. Whe light points at you, simulate by less transparency.% when pointing at the side, more transparency.% To do it right, wed use dot product, but we can estimate in less% characters using sin instead since were pointing flat out in Z%ctr[mx(2) my(2) mz(2)]; % center%cp[0 .5 10];Ssinpi(A); %dot(ctr,dn(mean(pts,1),cp),2);cevv*(max(S,0)^2*21);% Extrudeedmod((0:(nv-1))[0 1],nv)1;R1:nv;%size(ed,1)c1[ed(R,[2 1 2])[0 0 nv];% edges connecting top/bottomed(R,[1 1 2])[0 nv nv]];f[c1c1nvc1nv*2];v[ptsptsce*.3ptsce*.5ptsce];av[S .9 .7 0];M(a)repmat(a,nv,1);a[ M(av(1))M(av(2))M(av(3))M(av(4)) ] * ...rescale(S,.2,.8,inputmax,1,inputmin,-.8)^2;set(LB,vertices,v[0 0 FZ],faces,f,facevertexalphadata,a);%% Reflect the upper half into the oceanfgetframe(gca);% Darken it by passing through hsv and lowering V% Use guass filter to blur slightly so it doesnt look so computeryO.CDatahsv2rgb(rgb2hsv(imgaussfilt(f.cdata(1:end-110,:,:),1)).*reshape([1 1 .7],1,1,3)); endDhimas Mahardika Sanggung Utara / A 2D Candle Equation https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/14272 function drawframe(f) h linspace(0,100*pi,48); syms x y eqn ((2*x^2)- (((sin(3*y^0.5))^2)/15) - 0.12*x*sin(3*yh(f)) y^200 0.007)*(abs(5*xy1.6)abs(5*x-y-1.6)-3)*(abs(15*x0.75*(y-0.033))abs(15*x-0.75*(y-0.033))-0.2) 0; fimplicit(eqn,[-1,1,-3.3,1.2], MeshDensity500,LineStyle-); axis equal endhiahiahia我写的一个超简单的小人 Zhaoxu Liu / slandarer / Math-Matchstick Man https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/14012 function drawframe(n) persistent txtHdl armHdl if n1 axgca; ax.DataAspectRatio[1,1,1]; ax.XLim[-5,5]; ax.YLim[-5,5]; ax.XColornone; ax.YColornone; hold on txtHdl text(0,3.5,y x,FontSize,20,FontName,Times New Roman,FontWeight,bold,...HorizontalAlignment,center,Color,[0,.25,.45]); armHdl plot([-pi,pi],[-pi,pi],Color,[.8,0,0],LineWidth,3); tlinspace(0,2*pi,200); fill(cos(t),sin(t)1,[1,1,1],EdgeColor,[.4,.4,1],LineWidth,3) plot(cos(t(101:200)).*.5,sin(t(101:200)).*.51,Color,[.4,.4,1],LineWidth,3) fill(cos(t).*.8,sin(t).*1.4-1.4,[1,1,1],EdgeColor,[.4,.4,1],LineWidth,3) plot([-0.38,-0.97,-1.81],[-2.64,-4.50,-4.76],Color,[.4,.4,1],LineWidth,3) plot([ 0.38, 0.97, 1.81],[-2.64,-4.50,-4.76],Color,[.4,.4,1],LineWidth,3) plot([-0.15,-0.42],[ 1.98, 2.15],Color,[.4,.4,1],LineWidth,3) scatter([-0.2,0.2],[1.2,1.2],25,[.4,.4,1],filled,o) end switch truecase n7 n12armHdl.XData [-pi,0, pi];armHdl.YData [ pi,0, pi];txtHdl.String y |x|;case n13 n18armHdl.XData [-pi,0, pi];armHdl.YData [-pi,0,-pi];txtHdl.String y - |x|;case n19 n24armHdl.XData -2:.02:2;armHdl.YData (-2:.02:2).^2;txtHdl.String y x^2;case n25 n30armHdl.XData -2:.02:2;armHdl.YData (-2:.02:2).^3;txtHdl.String y x^3;case n31 n36armHdl.XData -pi:.01:pi;armHdl.YData sin(-pi:.01:pi);txtHdl.String y sin(x);case n37 n42armHdl.XData -2.5:.02:2.5;armHdl.YData 2.^(-2.5:.02:2.5)-1;txtHdl.String y 2^x - 1;case n43 n48tlinspace(0,2*pi,200);armHdl.XData cos(t).*2;armHdl.YData sin(t).*22;txtHdl.String x^2 (y-2)^2 4; end endEric Ludlam / Snake Toy https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/14042 function drawframe(f)%% Core Matricesnumblock24;v [ -1 -1 -1 ; 1 -1 -1 ; -1 1 -1 ; -1 1 1 ; -1 -1 1 ; 1 -1 1 ];pf [ 1 2 3 nan; 5 6 4 nan; 1 2 6 5; 1 5 4 3; 3 4 6 2 ];clr hsv(numblock);% Left in a few options for anyone interested in remixing other shapes% and colors%n pi/2;shapes [ 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 % box%0 0 .5 -.5 .5 0 1 0 -.5 .5 -.5 0 1 0 .5 -.5 .5 0 1 0 -.5 .5 -.5 0 % fluer%0 0 1 1 0 .5 -.5 1 .5 .5 -.5 -.5 1 .5 .5 -.5 -.5 1 .5 .5 -.5 -.5 1 .5 % bowl%0 1 0 0 0 1 1 0 1 0 0 1 0 1 1 0 0 0 1 0 1 1 0 1 % dog%0 1 0 0 0 0 0 1 1 0 .5 0 1 1 0 1 1 0 -.5 0 1 1 0 0 % chicken%0 1 0 0 0 1 1 0 0 0 0 1 0 0 1 0 0 0 0 1 1 0 0 0 % filled box%0 1 -n 0 0 0 1 n n 0 1 0 0 0 n 0 1 1 0 1 1 0 n 0 % cobra0 .5 -.5 -.5 .5 -.5 .5 .5 -.5 .5 -.5 -.5 .5 -.5 .5 .5 -.5 .5 -.5 -.5 .5 -.5 .5 .5]; % ball% Helper for making transform matrices.xform(R)makehgtform(axisrotate,[0 1 0],R,zrotate,pi/2,yrotate,pi,translate,[2 0 0]);if f1%% Create a neon type snake toy on a black backgroundset(gcf,color,black);axes(position,[0 0 1 1],visible,off)Phgtransform(Parent,gca,Matrix,makehgtform(xrotate,pi*.5,zrotate,pi*-.8));for i 1:numblockP hgtransform(Parent,P,Matrix,xform(shapes(end,i)*pi));patch(Parent,P, Vertices, v, Faces, pf, FaceColor,clr(i,:),EdgeColor,none);patch(Parent,P, Vertices, v*.75, Faces, pf(end,:), FaceColor,none,...EdgeColor,w,LineWidth,2);end%% Axes setupdaspect([1 1 1]);view([10 60]);axis tight vis3d offcamlightend% Get our stack of transforms. These will magically be in the right order.hfindobj(type,hgtransform);hh(2:end); % Skip the first one% Orbit once aroundview([-f*360/48 20]);% Script Steps (transform there and back again)if f5returnelseif f41steps35;rshapes(end,:)*pi; % Start at the Ball shapeshshapes(1,:)*pi; % Go to the box shapesf-6;% Transform to next stepdf (sh-r)/steps;arrayfun((tx)set(h(tx),Matrix,xform(r(tx)df(tx)*s)),1:numblock);end endEric Ludlam / Open The Box https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/14167 function drawframe(f)% Hack to make a good 1st pic for the galleryf mod(f-2,48)1;%% Polyhedra Data so we can vectorize% The following polyhedra data can be downloaded from:% https://netlib.org/polyhedra/1% And was pre-processed into these compressed arrays.% % For Positive Integers:% Convert to char, and offset into the printable character range by% Adding something like 0 to it.% 0 is convenient as you know what the first 10 #s are by sight.% % DecoderD(v,c)reshape(v-0,numel(v)/c,c);% Faces ArrayFD(5624945138;8947;9:58,4);% Compress Doubles:% Identify # of unique values. If that # is small, create reference% array with the unique values. Then compress the indices into the% array of unique values to recreate the original array% If unique values can be represented as colonop easily, do that.% % Vertex ArrayV-1.5:0.5:2.5;VV(D(113333555577993513571357353544444444444444,3));% Origin of faces so we can offset/foldO-0.5:0.5:1;OO(D(231134233112222222,3));% Rotation AxisR-1:1;RR(D(212322221233222222,3));% Angle of rotation for the solidA[01.5708];AA(D(122222,1));% Children indices for each face to create the graphCD(300060400000500000200000,4);%% Fold factor% 0 is wide open, 1 is fully solidff1-(mod(f-1,24)1)/24; % Fold factor for this segmentsc(1-ff)*.8.2; % size of the cube inside the unfolding cube.%% Build child graph usingpersistent TX1 TX2 R1 R2if f48axes(pos,[0 0 1 1],clipping,off,Proj,p);TX gobjects(0);%% Create the object tree using recursive fcnR1hgtransform;coi0;rP(1,R1,O(1,:));arrayfun((fi)xform(TX,ff,fi),1:size(F,1));TX1TX;R2hgtransform;coisize(F,1);rP(1,R2,O(1,:));arrayfun((fi)xform(TX,1,fi),1:size(F,1));TX2TX;%% Make axes niceset(gcf,color,w);daspect([1 1 1]);axis([-1.5 2.5 -1.5 2.5 -1 2],off)view(3)camzoom(1.5)endif f24% Mode 1ff1ff;ff21;sc11;sc2sc;else% Mode 2ff11;ff2ff;sc1sc;sc21;end% Configure the 2 cubes based on the modearrayfun((fi)xform(TX1,ff1,fi),1:size(F,1));arrayfun((fi)xform(TX2,ff2,fi),1:size(F,1));set(findobj(TX1,type,patch),FaceA,ff1^.5);set(findobj(TX2,type,patch),FaceA,ff2^.5);rt1(1-sc1)*pi*2;rt2(1-sc2)*pi*2;set(R1,Matrix,makehgtform(scale,sc1,translate,[0 0 (1-sc1)*3],...zrotate,rt1,xrotate,rt1));set(R2,Matrix,makehgtform(scale,sc2,translate,[0 0 (1-sc2)*3],...zrotate,pi/2-rt2,yrotate,rt2));%% Helper Fcnsfunction xform(tx,ff,fi)if A(fi)set(tx(fi),Matrix,makehgtform(axisrotate,R(fi,:), ff*(A(fi)-pi)));endendfunction rP(fidx, parent, po)% Recursive function for creating the tree of gfx objectsTXThgtransform(parent,Matrix,makehgtform(translate,O(fidx,:)));TX(fidx)hgtransform(TXT);% Total offset for vertices is local offset plus parent accum offsettoO(fidx,:)po;% Colors to usecoorderedcolors(gem12);patch(TX(fidx),Vertices,V(F(fidx,:),:)-to,Faces,1:size(F,2),...FaceC,co(fidxcoi,:),EdgeC,w,LineW,2);% Create child nodesfor i1:size(C,2)if C(fidx,i)0rP(C(fidx,i),TX(fidx),to);endendend endAdam Danz / Pi to 10080 decimal places (polar pi patch) https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/13962 function drawframe(f) persistent x y d pitxt nDecimalPlaces 10080; if f1 || isempty(x)digits(nDecimalPlaces2);piStr char(vpa(pi));pDigits piStr(3:end-1)-0;% Assign each digit an angular coordinate based on its value 0:9theta ((0:36:324)linspace(0,36,nDecimalPlaces1))*pi/180;ang theta(sub2ind(size(theta),1:nDecimalPlaces,pDigits1));% Compute the length of each line segment; used to set color[x,y] pol2cart(ang,1);[~,~,d] uniquetol(hypot(diff(x),diff(y)));d [d;d(end)];% Plot line segements using the edge property of a Patch object% Plot segments using patch so we can control transparency within one% graphics object.set(gcf, Color,k);axes(Position [0 0 1 1]);pitxt plotpitxt(text());hold onaxis equal padded off% Labelsgap 3; % gap between segments in degreesstartpt ((0:36:324) gap/2)*pi/180; % starting point of each segment, radianssegAng (0:0.02:1).*((36-gap)*pi/180) startpt; % angular coordinates for segmentsradius 1.08;[segx,segy] pol2cart(segAng,radius);plot(segx,segy,-w,LineWidth1,Color[.8 .8 .8])% add bounds labelsmidAng ((0:36:324)18) * pi/180;tradius radius .08;[tx,ty] pol2cart(midAng,tradius);text(tx, ty, string(0:9), ...,FontUnitsnormalized,...FontSize0.05, ...Color[.8 .8 .8], ...HorizontalAlignmentcenter,...VerticalAlignmentmiddle); end nFrames 48; frameIdx [1,find(mod(1:nDecimalPlaces,nDecimalPlaces/nFrames)0)]; plotalpha (parent,x,y,color,alpha) patch(parent,XData,[x(:);nan],YData,[y(:);nan],EdgeColor,color,EdgeAlpha,alpha); cmap jet(10); for i frameIdx(f) : frameIdx(f1)if inDecimalPlacescontinueendplotalpha(gca,x(i:i1),y(i:i1),cmap(d(i),:),0.1) end pitxt plotpitxt(pitxt); % faster than uistackfunction pitxt plotpitxt(h)h.deletepitxt text(0,0.05,\pi, ...HorizontalAlignmentCenter, ...FontUnitsnormalized, ...FontSize 0.2, ...Color k);end endNed Gulley / Blender https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/13847 function drawframe(f)c(sqrt(5)1)/2;d2*pi/c;alpha interp1([0 48],[0 48*2*pi/12],f);theta (1:600)*d;r sqrt(theta);theta theta alpha;x r.*cos(theta);y r.*sin(theta);sz 30*(1-(1:numel(x))/numel(x)) 1;clr sz;scatter(x,y,sz,clr,filled)axis equal offaxis(45*[-1 1 -1 1])set(gcf,Color0.3*[1 1 1])endEric Ludlam / Foggy Forest https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries/14422 function drawframe(f)E5; % Size of one forest environment segment% FogColor Vibe%FC[0 0 0];FC[1 1 1];% AbbreviationsJrand;if f1set(gcf,color,FC);% Random placement of trees. Clump neare middlen40;v1[rescale(randn(n,1)) J(n,1) rescale(J(n,1),.3,.5)]*E-[E/2 0 0];% Place a navigable path around zeroMv1(:,1).1;v1(M,1)v1(M,1)-.2;v1(:,3)v1(:,3)*.2.2;% Duplicate so we are in a repeating donutvx[v1;v1[0 E 0]];%Bvalidatecolor([#A52A2A% #DAA06D% #6E260E% #954535% #7B3F00% #80471c% #814141% #966919],...% multiple);%Gvalidatecolor([#097969% #228b22% #50C878% #4F7942% #008000% #355E3B% #2AAA8A% #32CD32],...% multiple);% How to compress some colors:%% % Turn into flints% Ufloor(CLRS*256);% % Turn that into chars, offset forward by SPACE% CHchar(U );% % % Turn this into decode code% ACH;% disp(([ join(A,;) - ])/256;);% % Compressed version of above:B([ÆJJ;ûÁ;ŽF.;¶eU;›_ ;¡g;¢aa;·‰9- ])/256;G([)™‰;B¬B;pé˜;o™b; ¡ ;U~[;JË«;RîR]- )/256;for i1:size(vx,1)%% Tree TrunksN30;Q.1; % variation in distance from centerRN12; % n pts in bounding ringsrv[.05 .02]; % Radius valuesrh[0 1]; % Radius heights% Random pts on cylinderrtlinspace(0,2*pi,RN1);rt(end)[];T[J(1,N)*pi*2 rt rt];h[rescale(randn(1,N)) ones(1,RN)*rh(1) ones(1,RN)*rh(2)];% Adjust the radius based on heightRinterp1(rh,rv,h);pts[cos(T).*Rsin(T).*Rh];% triangulate the perfect cylindertfconvhulln(pts);% Push points in/out with variance of QD(1-QJ(1,size(pts,1))*(Q*2));tvpts.*(D.*[1 1 0][0 0 1]); mkP(tf,(tvvx(i,:).*[1 1 0]).*[1 1 vx(i,3).1],i,B,D);%% Tree topsN150;% Alg for random distribution of pts on a sphere.TJ(1,N)*pi*2;uJ(1,N)*2-1;pts[0 cos(T).*sqrt(1-u.^2)0 sin(T).*sqrt(1-u.^2)0 u ];% triangulate the perfect spherelfconvhulln(pts);% Push points around to make foliage frumphyQ.15;D(1-QJ(1,size(pts,1))*(Q*2));lvrpts.*D;% Scale down into our world and push up into treetopsssvx(i,3)*.15;llvlvr.*[.12ss .12ss .08ss][0 0 .1];mkP(lf,llvvx(i,:),i,G,D);%% Lumpy Ground!N200;Q.2;% coordinatesTJ(1,N)*2;RJ(1,N).05;xcospi(T).*R*E;ysinpi(T).*R*E*2E;% Triangulate the flat disc so we can draw itpv[x y];pfdelaunay(pv);% VariationD(J(1,size(pv,1))*Q);mkP(pf,[pv.5 D],4,G,D);%% Decorate!set(gca,position,[0 0 1 1],vis,off,proj,p);view(3);daspect([1 1 1]);endend%% Navigate!ypf/48*E;cp[0 yp .3];campos(cp);camtarget(cp[0 10 0]);camva(90);Ofindobj(type,patch);for i1:numel(O)addFog(cp,O(i));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 DbCC(mod(i,size(C,1))1,:);C2hsv2rgb(rgb2hsv(bC).*[.1 1 .3]);qbC-C2;fvcrescale(D)*qC2;% Create patch and stash colorssetappdata(patch(Faces,f,vertices,v,EdgeC,n,FaceC,i,...FaceVertexCData,fvc),...fvc,fvc);endfunction addFog(cp,p)v1p.Vertices-cp; % Center around camera position.clrgetappdata(p,fvc);% Compute depth from camera, and rescale as 0-1Brescale(hypot(hypot(v1(:,1),v1(:,2)),v1(:,3)),InputMin,0,InputMax,5).^.25;% Treat fog as a semi-transparent white on top of the patch.% The depth implies the volume of fog you need to see through to get to the vertex.set(p,FaceVertexCData,FC.*Bclr.*(1-B))end end完 比赛还有12天才结束感兴趣的快去参加 https://ww2.mathworks.cn/matlabcentral/communitycontests/contests/6/entries
http://www.pierceye.com/news/115819/

相关文章:

  • 建设电影推荐网站的项目背景网站开发的公司电话
  • 建设银行 福建分行招聘网站cctv5体育现场直播
  • 网站那个做的比较好的微信辅助网站制作
  • 网站设计大全推荐wordpress后台登录
  • 网站运营与数据分析网站开发学习什么
  • 上海网站备案在哪里查询网站建设哪家稳妥
  • 建设网站做什么赚钱网站制作.
  • 小企业公司网站怎么建做网站英文编辑有前途吗
  • 优化图片传网站wordpress背景图片
  • 网站服务器哪家好些外包做网站不付尾款
  • 建站系统wordpress下载哪个公司的微信商城系统
  • 网站建设app开发合同深圳企业网站制作设计方案
  • 免费网站整站模板下载寻找做网站
  • 做此广告的网站做家纺的网站
  • 湖南畅想网站建设个人网站建设基本定位
  • 建站公司外包钓鱼网站怎么做
  • 个人网站logo需要备案吗鑫灵锐做网站多少钱
  • .xyz做网站怎么样网站产品预算
  • 建网站先要申请网址吗做网站给文件不侵权
  • 一元夺宝网站建设Wordpress 普通图片裁剪
  • 网站推广都有哪些自己有网站怎么优化
  • 宠物交易网站模板更改wordpress后台登录地址
  • 有电脑网站怎样建手机正规网络游戏平台
  • 网站抓取QQ获取系统cms监控手机客户端
  • 郑州网站推广价格优礼品网站模板
  • 百度指数不高的网站怎么优化网站图片类型
  • 北京专业做网站怎么样app软件开发摄像头
  • 网站建设导向erp系统软件免费版
  • 手表网站网站开发毕业设计文献综述
  • 台州网站制作维护关于微网站策划ppt怎么做