如何绘制矢量作为一个球体的名单? [英] How to plot a list of vectors as a sphere?

查看:335
本文介绍了如何绘制矢量作为一个球体的名单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

予有归一化的向量(其中1538)形成的球体的阵列。此外,我有1538我要绘制这样的事情同样大小的数字数组:

I have an array of normalized vectors (1538 of them) forming a sphere. Also I has an array of numbers of the same size 1538. I want to plot something like this:

我试过冲浪的功能,但我不能找到一种方法,用我的载体。我想应该有一些方法来做到这一点。

I tried the sphere and surf functions but I can't find a way to use my vectors. I figured there should be some way to do this.

多谢了。

推荐答案

我想你可以使用德劳创建一个三角测量和绘制,使用 trimesh 或的trisurf

I think you can use delaunay to create a triangulation and plot that using trimesh or trisurf.

这两个trimesh作为trisurf接受第四个参数指定每个顶点的颜色,添加选项facecolor,口译来插值之间的每个面的颜色顶点。

Both trimesh as trisurf accepts a fourth argument to specify the color of each vertex, add the option 'facecolor','interp' to interpolate the color of each face between vertices.

编辑:我还尝试了一下就可以了,因为它是一个球,我觉得 convhull 更适合。

edit: I experimented a bit further on it, and since it's a sphere, I think convhull is better suited.

例如:

[x,y,z]=sphere(25);
x=x(:);y=y(:);z=z(:);

tri = convhull([x y z]);
C = cos(y);
trisurf(tri,x,y,z,C,'facecolor','interp');

而不是 C 在这个例子中,你可以用自己的价值观的载体指定颜色

instead of C in the example you can use your own vector of values to specify the color

这篇关于如何绘制矢量作为一个球体的名单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆