如何绘制矢量作为一个球体的名单? [英] How to plot a list of vectors as a sphere?
问题描述
予有归一化的向量(其中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屋!