Determine Intersection between a Plane and a Line Rotated about an Axis of Rotation

85 Views Asked by At

Given:

  • A line segment in 3D space which can be represented as:
    $\begin{pmatrix}x_0 \\y_0 \\z_0 \end{pmatrix} + t\begin{pmatrix}d_{x} \\d_{y} \\d_{z} \end{pmatrix}$, where $0\le t\le1$

  • A point in 3D space about which the line segment above is to be rotated (center of rotation):
    $\begin{pmatrix}x_c \\y_c \\z_c \end{pmatrix}$

  • A unit vector representing the axis of rotation:
    $\begin{pmatrix}k_{x} \\k_{y} \\k_{z} \end{pmatrix}$

  • A finite plane in 3D space:
    $\begin{pmatrix}x_1 \\y_1 \\z_0 \end{pmatrix} + u\begin{pmatrix}d_{x1} \\d_{y1} \\d_{z1}\end{pmatrix}+v\begin{pmatrix}d_{x2} \\d_{y2} \\d_{z2} \end{pmatrix}$, where $0\le u\le1$ and $0\le v\le1$

[This image shows the general setup][1]

Problem:
When the line segment is rotated about the center of rotation and rotation axis, I would like to determine the minimum amount of rotation required in order for the line segment to intersect the finite plane. Is it possible to solve this problem analytically?

What I know:
The Rodrigues rotational formula tells us the equation of rotated line segment:
$R(\theta)\cdot\left(\begin{pmatrix}x_0-x_c \\y_0-y_c \\z_0-z_c \end{pmatrix} + t\begin{pmatrix}d_{x} \\d_{y} \\d_{z} \end{pmatrix}\right)+\begin{pmatrix}x_c \\y_c \\z_c \end{pmatrix}$

where $R(\theta)$ in the equation above is the Rodrigues rotational matrix computed based on the axis of rotation unit vector.

When the rotated line segment intersects the plane, there must be a point that satisfies the following equation:
$R(\theta)\cdot\left(\begin{pmatrix}x_0-x_c \\y_0-y_c \\z_0-z_c \end{pmatrix} + t\begin{pmatrix}d_{x} \\d_{y} \\d_{z} \end{pmatrix}\right)+\begin{pmatrix}x_c \\y_c \\z_c \end{pmatrix} = \begin{pmatrix}x_1 \\y_1 \\z_0 \end{pmatrix} + u\begin{pmatrix}d_{x1} \\d_{y1} \\d_{z1}\end{pmatrix}+v\begin{pmatrix}d_{x2} \\d_{y2} \\d_{z2} \end{pmatrix}$

  • The equation above is not easy to solve analytically as it is non-linear (the rotational matrix contains $sin$ and $cos$ terms) and a function of 4 different variables: $\theta, t, u, v$. I can solve this by trial and error, but I was wondering if there is a way to solve this analytically.

  • The point of intersection between the rotated line segment and the plane may be in the middle of the line segment or in the middle of the plane as well (so I cannot make assumption of the values of $t,u,v$). [See this image where I manually rotate the line segment until it hits the plane][2]

  • Utilizing the end points of the line segment, I can determine where the two circular traces intersect the plane. But this is not enough to solve the problem since there are still infinite points between the two end points.

    1 2

2

There are 2 best solutions below

1
On

Too long for a comment.

Here can be used an approach involving optimization procedures, but a simpler approach to the problem is to obtain a graphical checking.

Calling

$R(\theta)\cdot\left(\begin{pmatrix}x_0-x_c \\y_0-y_c \\z_0-z_c \end{pmatrix} + t\begin{pmatrix}d_{x} \\d_{y} \\d_{z} \end{pmatrix}\right)+\begin{pmatrix}x_c \\y_c \\z_c \end{pmatrix} - \begin{pmatrix}x_1 \\y_1 \\z_0 \end{pmatrix} - u\begin{pmatrix}d_{x1} \\d_{y1} \\d_{z1}\end{pmatrix}-v\begin{pmatrix}d_{x2} \\d_{y2} \\d_{z2} \end{pmatrix}=0$ and solving for $(t,u,v)$ we will obtain

$$ \cases{ t = g_1(\theta)\\ u = g_2(\theta)\\ v = g_3(\theta) } $$

after that, plotting simultaneously $(g_1(\theta),g_2(\theta),g_3(\theta))$ and comparing to the needed range, $(0,1)$ we can easily choose the most convenient value for $\theta$ if it exists.

NOTE

To obtain an explicit formula for $(t,u,v) = (g_1(\theta),g_2(\theta),g_3(\theta))$ we can proceed as follows: Submitting the segment $s(t) = p_0 + t \vec d$ to a rotation around axis $(p_c, \vec k)$, using Rodrigues formula we have

$$ s_{\theta}(t) = p_c+(p_0+t\vec d - p_c)\cos\theta+\vec k\times(p_0+t\vec d - p_c)\sin\theta + \vec k(\vec k\cdot(p_0+t\vec d - p_c))(1-\cos\theta)=p_c+(p_0 - p_c)\cos\theta+\vec k\times(p_0 - p_c)\sin\theta + \vec k(\vec k\cdot(p_0 - p_c))(1-\cos\theta)+\left(\vec d\cos\theta+\vec k\times\vec d\sin\theta+\vec k(\vec k\cdot\vec d)(1-\cos\theta)\right)t $$

now we need

$$ s_{\theta}(t) = a_{\theta}+\vec b_{\theta}t = p_1+u\vec d_1+v\vec d_2 $$

or

$$ \vec b_{\theta}t - u\vec d_1-v\vec d_2 = p_1-a_{\theta} $$

multiplying by $\vec d_1\times\vec d_2$ we obtain $t=g_1(\theta)$ as follows

$$ \vec b_{\theta}\cdot(\vec d_1\times\vec d_2)t=(p_1-a_{\theta})\cdot(\vec d_1\times\vec d_2) $$

hence

$$ t = \frac{(p_1-a_{\theta})\cdot(\vec d_1\times\vec d_2)}{\vec b_{\theta}\cdot(\vec d_1\times\vec d_2)} $$

and to obtain $u=g_2(\theta),v = g_3(\theta)$ we solve for $(u,v)$

$$ \cases{ g_1(\theta)\vec d_{\theta}\cdot \vec d_1 - \|\vec d_1\|^2 u - \vec d_1\cdot\vec d_2 v = (p_1-a_{\theta})\cdot\vec d_1\\ g_1(\theta)\vec d_{\theta}\cdot \vec d_2 - \vec d_1\cdot\vec d_2 u - \|\vec d_2\|^2 v = (p_1-a_{\theta})\cdot\vec d_2 } $$

or

$$ \left(\matrix{\|\vec d_1\|^2&\vec d_1\cdot\vec d_2\\ \vec d_1\cdot\vec d_2&\|\vec d_2\|^2 }\right)\left(\matrix{u\\ v}\right) = \left(\matrix{g_1(\theta)\vec b_{\theta}\cdot \vec d_1-(p_1-a_{\theta})\cdot\vec d_1\\ g_1(\theta)\vec b_{\theta}\cdot \vec d_2-(p_1-a_{\theta})\cdot\vec d_2} \right) $$

Included a MATHEMATICA script which actuates as a symbolic processor, solves the algebraic problems, and represent graphically the results.

parms = {x0 -> 1, y0 -> 1, z0 -> 1, vx0 -> 1, vy0 -> 1, vz0 -> 1, 
         xc -> 1/2, yc -> 1, zc -> 1/3, kx -> 1/Sqrt[6], ky -> Sqrt[2/3], kz -> 1/Sqrt[6], 
         x1 -> 3/2, y1 -> 2, z1 -> 1, vx1 -> 1, vy1 -> 1/2, vz1 -> -1/2, 
         vx2 -> 2, vy2 -> -1/2, vz2 -> 1};
p0 = {x0, y0, z0};
d0 = {vx0, vy0, vz0};
pc = {xc, yc, zc};
k = {kx, ky, kz};
p1 = {x1, y1, z1};
d1 = {vx1, vy1, vz1};
d2 = {vx2, vy2, vz2};
pl[u_, v_] := p1 + u d1 + v d2
seg[t_] := p0 + t d0
vrot[v_, k_, theta_] := v Cos[theta] + Cross[k, v] Sin[theta] + k (k . v) (1 - Cos[theta])
segrot[t_, theta_] := pc + vrot[seg[t] - pc, k/Norm[k], theta]
gra = ParametricPlot3D[pl[u, v] /. parms, {u, 0, 1}, {v, 0, 1}, 
PlotStyle -> Directive[Orange, Opacity[0.5], Specularity[White, 30]], Mesh -> {{0}}];
grb = ParametricPlot3D[seg[t] /. parms, {t, 0, 1}, PlotStyle -> {Black}];
grc = ParametricPlot3D[(pc + w k) /. parms, {w, -1, 1}, PlotStyle -> {Red, Dashed}];
grd = ParametricPlot3D[segrot[t, theta] /. parms, {t, 0, 1}, {theta, 0, 2 Pi}, PlotStyle -> Directive[Orange, Opacity[0.3], Specularity[White, 30]], Mesh -> {{0}}];
Show[gra, grb, grc, grd, PlotRange -> All]
Clear[t, u, v]
equs = pl[u, v] - segrot[t, theta];
sol = Solve[(equs /. parms) == 0, {t, u, v}][[1]];
tuv = {t, u, v} /. sol;
gr0 = Plot[{0, 1}, {theta, -Pi, Pi}, PlotStyle -> {{Red, Dashed}, {Red, Dashed}}];
gr1 = Plot[tuv, {theta, -Pi, Pi}];
gr4 = Show[gr0, gr1, PlotRange -> All]
Show[gr0, gr1, PlotRange -> {{0.5, 1.4}, {-0.1, 1.1}}]

The given segment (black) rotates around the axis $p_c+\lambda\vec k$ (red dashed)

enter image description here

Here $(g_1,g_2,g_3)$

enter image description here

And here a detail.

enter image description here

Definition of $(g_1,g_2,g_3)$.

atheta = pc + (p0 - pc) Cos[theta] + Cross[k, p0 - pc] Sin[theta] + k (k . (p0 - pc)) (1 - Cos[theta]);
btheta = d0 Cos[theta] + Cross[k, d0] Sin[theta] + k (k . d0) (1 - Cos[theta]);
g1[theta_] := (p1 - atheta) . Cross[d1, d2]/(btheta . Cross[d1, d2]) /. parms
M = {{d1 . d1, d1 . d2}, {d1 . d2, d2 . d2}} /. parms;
B = {g1[theta] btheta . d1 - (p1 - atheta) . d1, g1[theta] btheta . d2 - (p1 - atheta) . d2} /. parms;
{u, v} = Inverse[M] . B;
Show[Plot[{0, 1}, {theta, -Pi, Pi}, PlotStyle -> {{Red, Dashed}, {Red, Dashed}}], 
     Plot[{g1[theta], u, v}, {theta, -Pi, Pi}], PlotRange -> All]
0
On

The line segment is given as

$ \ell(t) = P_0 + t \ d , 0 \le t \le 1 $

Then you have an axis of rotation specified by the unit vector $k$, which passes through the point $C$.

And finally you have the plane which is given in the question in parametric vector form as $ p(u, v) = Q_0 + u \ d_1 + v \ d_2 $.

Using the Rodrigues' rotation matrix formula, and the given $C$ and $k$ , the image of a point $p$ under this rotation by angle $\phi$ is given by

$p' = C + R(\phi) (p - C) $

where (this is the Rodrigues' rotation matrix formula)

$ R(\phi) = {k k}^T + (I - {k k}^T ) \cos \phi + S_k \sin \phi $

where $S_k$ is the following skew-symmetric matrix,

$S_k = \begin{bmatrix} 0 && - k_z && k_y \\ k_z && 0 && - k_x \\ -k_y && k_x && 0 \end{bmatrix} $

For convenience, we can write this as

$ R = R_1 + R_2 \cos \phi + R_3 \sin \phi $

where $R_1 = {k k}^T , R_2 = (I - {k k}^T) , R_3 = S_k $

Therefore, the image of a point on the line $\ell(t)$ is the point

$ \ell'(t) = C + R(\phi) (P_0 + t d - C) $

Equating this to the plane vector expression, gives us,

$ C + R(\phi)(P_0 + t d - C ) = Q_0 + u \ d_1 + v \ d_2$

This equation has tentative solutions for every $\phi$. Setting $\phi$ to a specific value, such that

$ R = R(\phi) $

results in

$ C + R (P_0 + t d - C ) = Q_0 + u \ d_1 + v \ d_2$

So that

$P_0 + t d - C = R^T (Q_0 - C) + u \ R^T d_1 + v \ R^T d_2 $

And this becomes

$ \begin{bmatrix} d && - R^T d_1 && - R^T d_2 \end{bmatrix} \begin{bmatrix} t \\ u \\ v \end{bmatrix} = C - P_0 + R^T (Q_0 - C) $

The matrix on the left hand side can be assumed to be invertible, therefore $t, u, v$ can be found by matrix inversion. Then they be checked to each lie in the interval $[0, 1]$.