用matlab构造三角形,如何使用MATLAB的“isosurface”功能创建三角形球体

如何创建一个三角形球体,每个球体的面积相同.

我想要这样的东西,

我搜索并看到我可以使用函数isosurfaceof MATLAB,但三角形没有相同的面积和形式,它们基本上是用方形对角线分成两半的正方形.

这是我的代码:

>> [X,Y,Z] = meshgrid(-10:10,-10:10,-10:10);

>> V = sqrt(X.^2+Y.^2+Z.^2);

>> fv = isosurface(X,Y,Z,V)

>> p = patch(fv);

>> set(p,'EdgeColor','g')

结果如下:

最佳答案 从文件交换中使用此功能

function [p, t] = TriSphere(N, R)

% TRISPHERE: Returns the triangulated model of a sphere using the

% icosaedron subdivision method.

%

% INPUT:

% N (integer number) indicates the number of subdivisions,

% it can assumes values between 0-inf. The greater N the better will look

% the surface but the more time will be spent in surface costruction and

% more triangles will be put in the output model.

%

% OUTPUT:

% In p (nx3) and t(mx3) we can find points and triangles indexes

% of the model. The sphere is supposed to be of unit radius and centered in

% (0,0,0). To obtain spheres centered in different location, or with

% different radius, is just necessary a traslation and a scaling

% trasformation. These operation are not perfomed by this code beacuse it is

% extrimely convinient, in order of time perfomances, to do this operation

% out of the function avoiding to call the costruction step each time.

%

% NOTE:

% This function is more efficient than the matlab command sphere in

% terms of dimension fo the model/ accuracy of recostruction. This due to

% well traingulated model that requires a minor number of patches for the

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值