1
votes

I am trying to plot a plane with scatterplot3d that is perpendicular to a direction vector described by two angles, say theta and phi. The points are described by the (xyz)-coordinates satisfying the following equation, where R is the distance from the origin.

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

I guess I should use plane3d, but I can't figure out how to get this plane right based on my description. Can anyone help?

In other words, I am trying to plot the plane perpendicular to the blue line at distance R from the origin in this figure.

enter image description here

I assume this should be straightforward, but cannot figure it out.

1

1 Answers

0
votes

Using plane3d and calculating the intercept and coefficients, this turned out to be quite straightforward:

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

The Intercept would just be R/sin(phi), and the x- and y-coefficients are the coefficients in front of X and Y: x.coeff = cos(theta)/tan(phi) and y.coeff = sin(theta)/tan(phi).

This gives the plane, as desired.

enter image description here