Find the maximum radius for given theta and phi (spherical coordinates) that will fall within a cuboidal boundary

445 Views Asked by At

I have a cuboid with measurements (width, depth, height) which is my boundary. The origin is the center of the cuboid. Given a theta(Azimuth) and phi(elevation), how do I find the highest radius that will result in a point that lies within the cuboid(boundary)?

2

There are 2 best solutions below

0
On

The highest radius will be in one of the corners.

Finding $\theta$ you have to work with the triangle $\frac{1}{2} d$ and $\frac{1}{2} w$ with $d$ for depth and $w$ for width. Using $arctan$ you should be able to find the angle.

Now finding $\phi$ you have to work with the triangle $\frac{1}{2} w$ and $\frac{1}{2} h$ with $h$ for the height of the box. Again, using $arctan$ you have your angle.

I just used the width of the box as $x$-axis, the depth of the box as $y$-axis and finally the height of the box as $z$-axis.

3
On

The problem solution is quite simple : starting from the origin, and in a given direction, what you basically want to know is, "how far can I go before I escape this box". That's essentially what we're going to do : first, construct a straight line, and the planes, and find where they intersect.

  1. Identifiy a unit vector along the $(\phi, \theta)$ direction. This is usually $u = (\sin \phi \cos \theta, \sin \phi \sin \theta, \cos \phi)$.

  2. Once you have that, write out the parametric equations for the straight line : $x = u_x t$, $y = u_y t$, $z = u_z t$.

  3. $t$ corresponds to exactly the distance along the line - so the radius you are looking for. Write out the equations for the delimiting planes. If your box is $2a \times 2b \times 2c$, respectively in the $x$, $y$, and $z$ directions, then these are $x = \pm a$, $y = \pm b$, and $z = \pm c$. Simple.

  4. An arbitrary straight line will most probably hit the three planes - but once it's hit one of them, it's already outside of the box. So find all the solutions you can for $t$, for all the planes, then take the smallest one. That's how far you can go along this direction before escaping the box. Look only at positive values for $t$; because of the $\pm$ on the equations for the planes, if $t$ is a solution, so is $-t$.

Recap : if your box is $2a \times 2b \times 2c$, then the answer is $\min \{t > 0 | \pm a = u_x t \mbox{ OR } b = u_y t \mbox{ OR } c = u_z t \}$