博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
my plot mesh
阅读量:4042 次
发布时间:2019-05-24

本文共 3279 字,大约阅读时间需要 10 分钟。

function options = my_plot_mesh(vertex,face,options)    % plot_mesh - plot a 3D mesh.  %  %   my_plot_mesh(vertex,face, options);  %  %   'options' is a structure that may contains:  %       - 'normal' : a (nvertx x 3) array specifying the normals at each vertex.  %       - 'edge_color' : a float specifying the color of the edges.  %       - 'face_color' : a float specifying the color of the faces.  %       - 'face_vertex_color' : a color per vertex or face.  %       - 'vertex'  %  %   See also: mesh_previewer.  %  %   Copyright (c) 2004 Gabriel Peyr?  %   fixed by seamanj  12/2/2017    if nargin<2      error('Not enough arguments.');  end  if nargin<3      options.null = 0;  end      % can flip to accept data in correct ordering  if (size(vertex,1)==3 || size(vertex,1)==2) && size(vertex,2)~=3      vertex = vertex';  end  if size(face,1)==3 && size(face,2)~=3      face = face';  end    if size(face,2)~=3 || (size(vertex,2)~=3 && size(vertex,2)~=2)      error('face or vertex does not have correct format.');  end      if ~isfield(options, 'normal')      options.normal = [];  end  normal = options.normal;    if ~isfield(options, 'face_color')      options.face_color = 0.7;  end  face_color = options.face_color;    if ~isfield(options, 'edge_color')      options.edge_color = 0;  end  edge_color = options.edge_color;    if ~isfield(options, 'face_vertex_color')       options.face_vertex_color = zeros(size(vertex,1),1);  else if isempty(options.face_vertex_color)           options.face_vertex_color = zeros(size(vertex,1),1);      end  end  face_vertex_color = options.face_vertex_color;      if isempty(face_vertex_color)      hpatch = patch('vertices',vertex,'faces',face,'facecolor',[face_color face_color face_color],'edgecolor',[edge_color edge_color edge_color]);  else      nverts = size(vertex,1);      % vertex_color = rand(nverts,1);  %     if size(face_vertex_color,1)==size(vertex,1)  %         shading_type = 'interp';  %     else  %         shading_type = 'flat';  %     end  if ~isfield(options, 'shading_type')       shading_type = 'flat';  else      shading_type = options.shading_type;  end      if ~isfield(options, 'hpatch')          hpatch = patch('vertices',vertex,'faces',face,'FaceVertexCData',face_vertex_color, 'FaceColor',shading_type);          options.hpatch = hpatch;      else          if isfield(options, 'delete_patch') & strcmp(options.delete_patch, 'true')              delete(options.hpatch);          end          hpatch = patch('vertices',vertex,'faces',face,'FaceVertexCData',face_vertex_color, 'FaceColor',shading_type);          options.hpatch = hpatch;      end  end  colormap gray(256);  lighting phong;    if ~isfield(options, 'hcamera')      hcamera  = camlight('left');      camlight(hcamera,'left');      options.hcamera = hcamera;  end    camproj('perspective');  axis square;   axis off;      if isfield(options, 'show_normal')     show_normal = options.show_normal;  else      show_normal = 1:size(vertex,1);  end    if ~isempty(normal)      % plot the normals      hold on;      options.h_normal = quiver3(vertex(show_normal,1),vertex(show_normal,2),vertex(show_normal,3),normal(show_normal,1),normal(show_normal,2),normal(show_normal,3),0.1,'b');      hold off;  end    axis tight;  axis equal;  cameramenu;

转载地址:http://kvxdi.baihongyu.com/

你可能感兴趣的文章
图的俩种遍历方式(DFS,BFS)C++代码实现
查看>>
Hibernate设置主键自增,执行HQL语句
查看>>
设置MYSQL最大连接数与WAIT_TIMEOUT
查看>>
java根据ip地址获取详细地域信息
查看>>
解决s:iterator嵌套s:radio的传值问题
查看>>
位运算-不用加减乘除做加法。
查看>>
C++继承的三种方式(公有,私有,保护)
查看>>
待修改:C++多线程编程学习笔记
查看>>
冒泡、选择、插入、归并
查看>>
QTextEdit显示超链接
查看>>
使用socket下载文件(C++)
查看>>
cent os6.5静默安装oracle
查看>>
cent os6.5搭建oracle-dataguard
查看>>
使easyui-tree显示到指定层次
查看>>
给easyui-input元素添加js原生方法
查看>>
动态规划-最长公共子序列LCS
查看>>
动态规划-矩阵最小路径和
查看>>
动态规划-最长递增子序列
查看>>
spdlog输出格式设置
查看>>
ffmpeg-设置推流,拉流使用的协议类型(TCP/UDP)
查看>>