用scatterplot3d绘制一个2d平面

时间:2017-02-02 12:44:57

标签: r plot 3d

我试图用一个scatterplot3d绘制一个平面,该平面垂直于两个角度描述的方向向量,比如theta和phi。这些点由满足以下等式的(xyz)坐标描述,其中R是距离原点的距离。

x cos(theta)cos(phi)+ y sin(theta)cos(phi)+ z sin(phi)= R

我想我应该使用plane3d,但我无法弄清楚如何根据我的描述得到这架飞机。有人可以帮忙吗?

换句话说,我试图在距离原点的距离为R的地方绘制垂直于蓝线的平面。

enter image description here

我认为这应该是直截了当的,但无法弄清楚。

1 个答案:

答案 0 :(得分:0)

使用plane3d并计算截距和系数,结果非常简单:

spl$plane3d(Intercept, x.coeff, y.coeff, col=5, draw_polygon=T, lty=NULL)

截距只是R / sin(phi),x和y系数是X和Y前面的系数:x.coeff = cos(theta)/ tan(phi)和y.coeff = sin(theta)/ tan(phi)。

根据需要给出飞机。

enter image description here