您现在的位置:首页 >> ★免费资源 >> 源码下载 >> 内容

matlab代做highspeedlogic★跳动的心

时间:2023/1/5 22:46:39 点击:

  核心提示:matlab代做,FPGA代做,淘宝,专业代做MATLAB、FPGA博士/硕士/本科毕业设计、项目仿真、Coursework、Assignment ...

matlab代做FPGA代做淘宝专业代做MATLABFPGA博士/硕士/本科毕业设计项目仿真CourseworkAssignment

QQ: 1224848052

function demoDisplay
% This demo displays the generation of heart and also the possible re-shape and movemen
close all;

[x,y,z] = heart;
bottomZ = min(z(:));
radius = abs(bottomZ);

axis vis3d
axis off
daspect([1.6, 1, 1.875]);
hold on;
markerColor = [0.5, 0.5, 0.5];
lineColor = [0.7, 0.7, 0.7];

figWidth = 800
figHeight = 600;
screenSize = get(0, 'ScreenSize');
X0 = (screenSize(3)-figWidth)/2;
Y0 = (screenSize(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 color
set(gcf, 'color', [255 105 180]/255);


startAZ = 30;
satrtEL = 20;
view(startAZ, satrtEL);

% draw points
for iLoop = 1:size(x, 1)
    plot3(x(iLoop, :), y(iLoop,:), z(iLoop, :), 'Marker', '.', 'MarkerEdgeColor', markerColor, 'LineStyle', 'none');
    pause(0.2);
end

% draw wire frames
for iLoop = 1:size(x, 1)
    plot3(x(iLoop, :), y(iLoop,:), z(iLoop, :), 'color', lineColor, 'LineStyle', '-');
    pause(0.2);   
end

for iLoop = 1:size(x, 2)
    plot3(x(:, iLoop), y(:, iLoop), z(:, iLoop), 'color', lineColor, 'LineStyle', '-');
    pause(0.2);  
end

% rotate wire frame
for i=1:36
 camorbit(10,0,'data');
 pause(0.1);   
end
% clean the curent axes
delete(get(gca, 'Children'));

camlight left;
newLineColor = [0.7, 0.4, 0.4];

% re-draw the whole heart with surf function
h = surf(x,y,z, 'EdgeColor', newLineColor, 'FaceColor', 'r');
for i=1:36
 camorbit(10,0,'data');
 pause(0.1);
end

mediumColor = [0.8, 0.3, 0.3];
set(h, 'EdgeColor', mediumColor,'FaceLighting','gouraud');
for i=1:36    
 camorbit(10,0,'data');
 drawnow;
end

set(h, 'EdgeColor', 'none');
drawnow;

% define the Z-path for heart re-shape
deltaZ = linspace(-.3, 0, 5);
deltaZ = [fliplr(deltaZ), deltaZ];
deltaZ = repmat(deltaZ, 1, 3);
zlim('manual');
for iLoop = 1:length(deltaZ)    
    % draw the bouncing heart
    curDeltaZ = 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', 'FaceColor', 'r','FaceLighting','gouraud');
    camorbit(-1, 0, 'data');
    drawnow;
end

% draw the bouncing heart
deltaZ = 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, it's hitting the ground
        ratio = (radius+curDeltaZ)*radius;
        newZ = z*ratio + curDeltaZ;
    else
        % when deltaZ is bigger than zero, it's a free object
        newZ = z + curDeltaZ;
    end 

    h = surf(x, y, newZ, 'EdgeColor', 'none', 'FaceColor', 'r','FaceLighting','gouraud');
    
    % zoom in and out for more vivid effect
    if iLoop <= length(deltaZ)/2
        camzoom(0.99);
    else
        camzoom(1.005);
    end
    
    camorbit(390/length(deltaZ), 0, 'data');
    drawnow;
end

作者:highspeedlogic 来源:highspeedlogic
  • 您是如何找到本站的?
  • 百度搜索
  • Google搜索
  • 查阅资料过程中
  • 论坛发现
  • 百度贴吧发现
  • 朋友介绍
本站最新成功开发工程项目案例
相关评论
发表我的评论
  • 大名:
  • 内容:
  • matlab代做|matlab专业代做|matlab淘宝代做|FPGA项目合作(www.hslogic.com) © 2023 版权所有 All Rights Reserved.
  • Email:highspeed_logic@163.com 站长QQ: 1224848052

    专业代做/代写/承接、MATLAB、SIMULINK、FPGA项目、博士/硕士/本科课题、Coursework、Eassy、Assignment