码迷,mamicode.com
首页 > 其他好文 > 详细

散点生成三角网

时间:2018-03-21 15:37:53      阅读:1036      评论:0      收藏:0      [点我收藏+]

标签:rgb   计算   blog   sqrt   off   方法   规则   plot   技术   

%例一:二维三角网TIN模型的生成
X=rand(10,2)*5;
dt=DelaunayTri(X(:,1),X(:,2));       %生成三角网
triplot(dt);hold on;                 %绘图
scatter(X(:,1),X(:,2),‘o‘),hold off  %将结点展示出来(散点)
技术分享图片
 
%例二:三维TIN的生成(由规则点生成)
[x,y]=meshgrid(1:15,1:15);z=peaks(15);
tri=delaunay(x,y);   %以X,Y为准生成Delaunay triangulation(三角网)
trisurf(tri,x,y,z);  %将该三角网显示出来
colormap autumn;     %方法一
%If the surface is in the form of a TriRep 
%triangulation representation, plot it as follows:
%tr=TriRep(tri,x(:),y(:),z(:));trisurf(tr);  %方法二
%plot3(x(:)‘, y(:)‘, z(:)‘)
技术分享图片
%例三:离散点生成TIN三角网模型
A=rand(300,2)*20-10;X=A(:,1);Y=A(:,2);%X,Y的区间为[10,10]
R=sqrt(X.^2 + Y.^2);Z=sin(R)./R;      %函数,计算对应点坐标的函数值
tri=delaunay(X,Y);trisurf(tri,X,Y,Z); %以X,Y为准生成Delaunay triangulation(三角网)
colormap jet;hold on
scatter3(X(:),Y(:),Z(:),‘r‘);hold off %将散点展示出来

技术分享图片

散点生成三角网

标签:rgb   计算   blog   sqrt   off   方法   规则   plot   技术   

原文地址:https://www.cnblogs.com/stxs/p/8617234.html

(0)
(1)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!