Minimum angle between arc of two points on a sphere and $xy$-plane

120 Views Asked by At

I am writing a script to generate a 3D model of a spherical lamp to be 3d printed, it looks like this:

spherical lamp

I do it by generating a bunch of random spherical coordinates and connect them randomly. To save support materials, I want to make sure that the minimum angle any arc make with the build surface($xy$-plane) is more than a specific angle(40 degrees in my case).

In the image, you can see that the blue arc is fine, but the red arc is not.

I need to know this angle for each arc, so the script knows which arc to keep in the model and which arc to reject.

(I tried to abstract the problem and asked it here Angle between arc of two points on a unit sphere and $xy$-plane, but it was not very clear so I try to go more practical here)

1

There are 1 best solutions below

2
On BEST ANSWER

Let $M_1(x_1,y_1,z_1)$ and $M_2(x_2,y_2,z_2)$ be the endpoints of the arc. Let $O$ be the origin.

Consider cross product

$$\vec{V}:=\vec{OM_1} \times \vec{OM_2}$$

$\vec{V}$ is clearly a normal vector to plane $OM_1M_2$.

Your constraint is equivalent to the fact that $\vec{V}$ makes an angle less than $ 40^{o}$ with the horizontal plane.

Here is, practicaly speaking, the way it can be implemented:

$$\text{Compute} \ \ \ \vec{V}=\begin{cases}x_3&=&y_1 * z_2 - y_2*z_1\\y_3&=& x_2*z_1 - x_1*z_2\\z_3&=&x_1*y_2 - x_2*y_1 \end{cases}$$

With these values, check the constraint "angle should be between $-40^{o}$ and $40^{o}$, or more precisely the equivalent constraint "tangent of the angle should be between $-tan(40^{o})$ and $tan(40^{o})$", i.e.,

$$\dfrac{\left|z_3\right|}{\sqrt{x_3^2+y_3^2}}<0.8391.$$

(note the absolute value around $z_3$).