zoukankan      html  css  js  c++  java
  • 灯光设置(light)

    clc;
    clear all;
    close all;

    %% 台灯的设置
    figure('color','k')
    % 底座
    fill3([0 1 1 0],[0 0 1 1],[0 0 0 0],'b',...
    [1 1 1 1],[0 0 1 1],[0 0.5 0.5 0],'b',...
    [1 1 0 0],[0 1 1 0],[0.5 0.5 0.5 0.5],'g',...
    [0 1 1 0],[1 1 1 1],[0 0 0.5 0.5],'b');
    grid on
    hold on
    % x = '.1*cos(t) + 0.2';
    % y = '.1*sin(t) + 0.5';
    % z = 's';
    % ezmesh(x ,y,z,[0,2*pi,0.5,1]);
    %后侧面
    fill3([0 0.1 0.1 0],[0.2 0.2 0.8 0.8],[0.5 0.5 0.5 0.5],'m',...
    [0.1 0.1 0.1 0.1],[0.2 0.2 0.8 0.8],[0.5 4.1 4.1 0.5],'m',...
    [0.1 0.1 0 0],[0.2 0.8 0.8 0.2],[4.1 4.1 4.1 4.1],'m',...
    [0 0.1 0.1 0],[0.8 0.8 0.8 0.8],[0.5 0.5 4.1 4.1],'m');
    %顶面
    fill3([0 0.7 0.7 0],[0 0 1 1],[4.1 4.1 4.1 4.1],'b',...
    [0.7 0.7 0 0],[0 0 1 1],[4.1 4.2 4.2 4.1],'b',...
    [0.7 0.7 0 0],[0 1 1 0],[4.2 4.2 4.2 4.2],'b',...
    [0 0.7 0.7 0],[1 1 1 1],[4.1 4.1 4.2 4.2],'b');
    view([135 38])
    axis([-1,2,-1,2,0,5])
    % 绘制球体
    x='.2*sin(s)*sin(t) + 0.4';
    y='.2*sin(s)*cos(t) + 0.4';
    z='.2*cos(s) + 3.3';
    ezmesh(x,y,z,[0 pi*2 0 pi*2])
    axis off
    %% light
    plotbutton=uicontrol('style','pushbutton',...
    'string','On', ...
    'fontsize',12, ...
    'position',[100,400,50,20], ...
    'callback', 'On=1;'); %define the stop button
    erasebutton=uicontrol('style','pushbutton',...
    'string','Of', ...
    'fontsize',12, ...
    'position',[200,400,50,20], ...
    'callback','Of=1;');
    quitbutton=uicontrol('style','pushbutton',...
    'string','Color', ...
    'fontsize',12, ...
    'position',[300,400,50,20], ...
    'callback','Color=1;');
    On = 0;
    Of = 0;
    Color = 0;
    % cc = [1,0,0];
    while (On == 1)

    if Color == 1
    cc = round(rand(1,3));
    else
    cc = [1,0,0];
    end
    light('color',cc,'style','local','position',[3.1,3.1,3.1])
    % light phong
    % set(gca,'CameraViewAngle',12)
    if Of ==1
    On = 0;
    end
    r = rand
    drawnow
    end

  • 相关阅读:
    标准部件工具箱概述
    从数据库和文件夹中读取图片并且resize
    控件的Lookup
    分隔字符串并以List返回(strSplit函数)
    窗体中的选中数据传递给报表
    对筛选之后的grid进行求和统计
    动态添加图片控件例子
    利用CSV文件导入数据的例子
    调用打开文件的对话框
    ax设置数据源的操作
  • 原文地址:https://www.cnblogs.com/Kermit-Li/p/4055416.html
Copyright © 2011-2022 走看看