<s>[INST] Find parametric expression of an arc given its start point, end point and central angle in 3D cartesian coordinate system In a 3D cartesian coordinate system, the coordinates of start point and end point have been given as $(x_1, y_1, z_1)$ and $(x_2, y_2, z_2)$. If the central angle of the two points (the one smaller than 180 degrees) is known as $\theta$, and the plane on which the arc lies is perpendicular to $XY$ plane, how to find the parametric expression $(x, y, z)$ of the arc?
I mean, each coordinate of $(x, y, z)$ needs to be represented by variables given above. Can anyone help? Thanks!
 [/INST] The expression for the locus of points of the circle containing the arc is
$$ {\rm RZ}(\psi) \begin{pmatrix} 
  x_c + r \cos \varphi \\ 
  y_c \\ 
  z_c + r \sin \varphi  
\end{pmatrix} = \begin{pmatrix} 
  r \cos\varphi \cos\psi + x_c \cos\psi - y_c \sin\psi \\
  r \cos\varphi \sin\psi + y_c \cos\psi + x_c \sin\psi \\
  r \sin\varphi + z_c
\end{pmatrix} $$
where $(x_c,y_c,z_c)$ is the center of the circle, $r$ is the radius and $\varphi$ is the azimuthal position along the circle. Also $\psi$ is the orientation of the plane of the arc relative to the XZ plane, as rotated by the z axis. For the end points of the arc, one can use an unknown center azimum $\varphi_c$ and the range $$\varphi = \varphi_c - \frac{\theta}{2} \ldots \varphi_c + \frac{\theta}{2}$$
Now we have the equations
$$ \begin{pmatrix} x_1 \\ y_1 \\ z_1 \end{pmatrix} = \begin{pmatrix} 
  r \cos(\varphi-\frac{\theta}{2}) \cos\psi + x_c \cos\psi - y_c \sin\psi \\
  r \cos(\varphi-\frac{\theta}{2}) \sin\psi + y_c \cos\psi + x_c \sin\psi \\
  r \sin(\varphi-\frac{\theta}{2}) + z_c
\end{pmatrix} $$
$$ \begin{pmatrix} x_2 \\ y_2 \\ z_2 \end{pmatrix} = \begin{pmatrix} 
  r \cos(\varphi+\frac{\theta}{2}) \cos\psi + x_c \cos\psi - y_c \sin\psi \\
  r \cos(\varphi+\frac{\theta}{2}) \sin\psi + y_c \cos\psi + x_c \sin\psi \\
  r \sin(\varphi+\frac{\theta}{2}) + z_c
\end{pmatrix} $$
By subtracting the 2nd point from the first point and dividing the y coordinate with the x coordinate the orientation of the plane $\psi$ is found
$$ \tan \psi = \frac{y_2-y_1}{x_2-x_1} $$
Further manipulation of the subtraction of the two points yields the center angle
$$ \tan \varphi_c = \frac{\sqrt{2} (\sin \frac{\theta}{2}) \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}}{(z_2-z_1)\sqrt{1-\cos\theta}} $$
and the radius of the circle
$$ r = \frac{\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}}{\sqrt{2}\sqrt{1-\cos\theta}} $$
Now by adding the end points, one finds the center of the circle
$$ \begin{pmatrix} x_c \\ y_c \\ z_c \end{pmatrix} = \begin{pmatrix}
  \frac{x_1+x_2}{2} \cos\psi + \frac{y_1+y_2}{2} \sin\psi - r \cos\varphi_c \cos \frac{\theta}{2} \\
  -\frac{x_1+x_2}{2} \sin\psi + \frac{y_1+y_2}{2} \cos\psi  \\
  \frac{z_1+z_2}{2} - r \sin\varphi_c \cos \frac{\theta}{2} 
\end{pmatrix} $$
The arc is now fully defined.
</s>