


下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、function demoDisplayclearclcclose all;x,y,z = heart;bottomZ = min(z(:);radius = abs(bottomZ);axis vis3daxis offdaspect(1.6, 1, 1.875);hold on;markerColor = 0.5, 0.5, 0.5;lineColor = 0.7, 0.7, 0.7;figWidth = 800figHeight = 600;screenSize = get(0, ScreenSize);X0 = (screenSize(3)-figWidth)/2;Y0 = (scre
2、enSize(4)-figHeight)/2;set(gcf, Position, X0,Y0, figWidth, figHeight);camtarget(0, 0, 0);set(gcf,Renderer,zbuffer);set(gcf,DoubleBuffer,on);% RGB(255 105 180) is for pink colorset(gcf, color, 255 255 255/255);startAZ = 30;satrtEL = 20;view(startAZ, satrtEL);% draw pointsfor iLoop = 1:size(x, 1)plot3
3、(x(iLoop, :), y(iLoop,:), z(iLoop, :), Marker, ., MarkerEdgeColor, markerColor, LineStyle, none);pause(0.2);end% draw wire framesfor iLoop = 1:size(x, 1)plot3(x(iLoop, :), y(iLoop,:), z(iLoop, :), color, lineColor, LineStyle, -);pause(0.1);endfor iLoop = 1:size(x, 2)plot3(x(:, iLoop), y(:, iLoop), z
4、(:, iLoop), color, lineColor, LineStyle, -);pause(0.1);end% rotate wire framefor i=1:36camorbit(10,0,data);pause(0.1);end% clean the curent axesdelete(get(gca, Children);camlight left;newLineColor = 0.7, 0.4, 0.4;% re-draw the whole heart with surf functionh = surf(x,y,z, EdgeColor, newLineColor, Fa
5、ceColor, r);for i=1:36camorbit(10,0,data);pause(0.1);endmediumColor = 0.8, 0.3, 0.3;set(h, EdgeColor, mediumColor,FaceLighting,gouraud);for i=1:36camorbit(10,0,data);drawnow;endset(h, EdgeColor, none);drawnow;% define the Z-path for heart re-shapedeltaZ = linspace(-.3, 0, 5);deltaZ = fliplr(deltaZ),
6、 deltaZ;deltaZ = repmat(deltaZ, 1, 3);zlim(manual);for iLoop = 1:length(deltaZ)% draw the bouncing heartcurDeltaZ = deltaZ(mod(iLoop,length(deltaZ)+1);ratio = (radius+curDeltaZ)*radius;newZ = z*ratio + curDeltaZ;if exist(h, var)& ishandle(h), delete(h);end;h = surf(x,y, newZ, EdgeColor, none, FaceCo
7、lor, r,FaceLighting,gouraud);camorbit(-1, 0, data);drawnow;end% draw the bouncing heartdeltaZ = generateSimulatedBouncingPath;zlim(-1, 3);for iLoop = 1:length(deltaZ)if exist(h, var)& ishandle(h), delete(h);end;curDeltaZ = deltaZ(iLoop);if curDeltaZ 0% when deltaZ is under the zero bar, its hitting
8、the groundratio = (radius+curDeltaZ)*radius;newZ = z*ratio + curDeltaZ;else% when deltaZ is bigger than zero, its a free objectnewZ = z + curDeltaZ;endh = surf(x, y, newZ, EdgeColor, none, FaceColor, r,FaceLighting,gouraud);% zoom in and out for more vivid effectif iLoop = length(deltaZ)/2camzoom(0.
9、99);elsecamzoom(1.005);endcamorbit(390/length(deltaZ), 0, data);drawnow;endtext(0.3,2.4, X,FontSize,25,FontName,Times New Roman)%text(0.3,1.8, X,FontSize,30,FontName,Times New Roman)%endfunction z = generateSimulatedBouncingPath(iterationNum, roundTimes)% define the z path of the center of ball for
10、rountTimes of bouncing along z-axisif nargin 2roundTimes = 3;endif nargin 1iterationNum = 40;endradius = 1;deltaH = 1.5; % the highest point comapred with radiusdeltaL = -0.3;% the lowest point comapred with radiusrangeY = -2, 1;% gravity accelerator constant% Note: this is smaller to the real 9.8 v
11、alue, but this makes the bouncing slowerg = 5;% define the accelerator for the z 0plusZtime = sqrt(2*deltaH*radius/g);% time for z 0zPlus = startZ - 0.5 * g * qPeriodTime(qPeriodTimeplusZtime).2;% z path when z =plusZtime)-plusZtime) + 0.5 * k* (qPeriodTime(qPeriodTime =plusZtime)-plusZtime).2;z = z
12、Plus, zMinus, fliplr(zMinus), fliplr(zPlus);% the last zPlus is for the stop actionz = repmat(z, 1, roundTimes), zPlus;y = linspace(rangeY(1), rangeY(2), numel(z);endfunction cordX, cordY, cordZ = heart(sizeTheta, sizeFai)if nargin =0sizeTheta = 30;sizeFai = 40;elseif nargin 2error(heart:NotEnoughAr
13、ugments, Please give at least two input arugments);end;theta = linspace(0, pi, sizeTheta);nudge = 0.0001; % used to avoid the operlappingfai = linspace(0 + nudge, pi/2 - nudge, round(sizeFai/4);a = 9/4;b = 9/80;A = 1+(a-1)*(sin(theta).2) * (sin(fai).2);B = (sin(theta).2.*cos(theta).3) * (1 + (b-1)*(
14、sin(fai).2);rou = zeros(size(A);for iLoop = 1:numel(A);curA = A(iLoop);curB = B(iLoop);% this is the polar coordinates version of the sextic equation found on% /HeartSurface.htmlpolyFactors = curA3, -curB, -3*curA2, 0, 3*curA, 0, -1;solutions = roots(polyFactors);realRou = real(solutions(abs(imag(solutions)0);end% x,y,z for the quater of whole heartx = rou .* (sin(theta)
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 江蘇南京秦淮中學(xué)等五校聯(lián)合體2024~2025學(xué)年高一下冊期末考試數(shù)學(xué)試題學(xué)生卷
- 河南南陽地區(qū)2024~2025學(xué)年高二下冊期末適應(yīng)性考試數(shù)學(xué)試題含解析
- 保溫容器生產(chǎn)過程自動化檢測設(shè)備研發(fā)技術(shù)考核試卷
- 品牌體驗式營銷在交通運輸領(lǐng)域的實踐考核試卷
- 跨領(lǐng)域技能提升考核試卷
- 場館設(shè)施維護標準考核試卷
- 2025年中國EVA天線球數(shù)據(jù)監(jiān)測研究報告
- 2025年中國ABS彎頭數(shù)據(jù)監(jiān)測報告
- 2025至2030年中國魚塘投飼機市場分析及競爭策略研究報告
- 2025至2030年中國防靜電T/C面料市場分析及競爭策略研究報告
- 光刻機行業(yè)深度報告博采眾星之光點亮皇冠明珠-華福證券
- 江蘇譯林版小學(xué)英語單詞匯總表-帶音標可打印
- 大學(xué)物理A1試卷B稿及參考答案
- 滁州市機電工程學(xué)校工作人員招聘考試真題2022
- 無腳手架安裝方法講師用培訓(xùn)修改版
- 紅旗農(nóng)貿(mào)擴建項目建議書
- 攪拌器的型式
- 傳感器原理 磁電式傳感器
- XX印務(wù)有限公司采購控制程序
- 2.溝槽開挖(檢驗批)質(zhì)量驗收記錄表
- GB/T 18451.1-2022風(fēng)力發(fā)電機組設(shè)計要求
評論
0/150
提交評論