Spherical coordinates distance to the plane

reference Information

Consider a spherical coordinate system similar to that shown here:

Coordinate system
(source: shokhirev.com )

For a specific point, we indicate its location using (r, theta, phi).

A plane can be described in this coordinate system as the set of all points (r, theta, phi) such that phi = phi '.

Problem

Suppose we have a single plane defined by a fixed phi = phi '. For an arbitrary point (r, theta, phi), what are the quickest and easiest ways to calculate the distance from (r, theta, phi) to a plane defined as phi = phi '?

In fact, I'm trying to find a simple formula for the distance from a point to a plane in spherical coordinates.

What i tried

I think that it would be simple enough to convert spherical to Cartesian coordinates to generate a point (x, y, z) = (r, theta, phi), and then create a plane also in Cartesian coordinates. Then I could use standard formulas for the distance from a point to a plane in Cartesian coordinates. This approach is not optimal, since I need to do this calculation billions of times in the inner loop of my code.

An ideal answer would tell me how to calculate this distance without converting to Cartesian coordinates. However, it would also be helpful if someone could verify that my idea of β€‹β€‹β€œWhat I tried” is reasonable.

Thanks in advance!

+4
source share
4 answers

Your approach is "correct", but it is too important for this problem. In your problem, you are dealing with a certain kind of plane: a plane passing through the z axis.

Given this fact, we can try a short cut. Suppose we rotate the coordinate system around the z axis to get another system (X, Y, z) such that the plane you gave earlier is now the Xz plane.

In this new system, the coordinates of the point (r, theta, phi - phi '). Thus, the projection onto the Xz plane is r * sin (theta) * sin (phi-phi ') . This is the final answer, since the length of the projection of a point on our plane is the same in both coordinate systems.

If we were dealing with a common plane, your approach would be better.

+1
source

If you are looking for the opposite side of r (not in the phi plane), this should be given:

d = |r|sin(90 - theta) 

Since we have a right triangle.

0
source

Another approach to get @Parakram Majumdar's answer.

A plane can be parameterized by a unit vector perpendicular to the n plane and the distance of the plane from the origin, b (see http://mathworld.wolfram.com/Point-PlaneDistance.html ). Since your plane passes through the origin, we have b = 0 , and the unit vector normal to the plane is the unit vector in the phi direction, which phi = [- sin (phi '), cos (phi'), 0] . The distance a of the point r is a plane - it is only a point product, n * r :
 n*r = [-sin(phi'), cos(phi'), 0] * [r*sin(theta)*cos(phi), r*sin(theta)*sin(phi), r cos(theta)] = r*sin(theta)*sin(phi-phi') 
0
source

Isn't that r * tan (phi)?

Get into the xz plane (provided that the y axis is the polar axis), and the angle phi is the angle between the "new plane" and the current value of phi.

In the diagram below, phi is actually equal to (new phi-current phi).

enter image description here

0
source

Source: https://habr.com/ru/post/1397732/


All Articles