# 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!

• Your specs will still give you at least two solutions, one concave and one convex relative to the xy plane. Is that acceptable? – John Moeller Feb 28 '13 at 7:36
• Any give arc can have an infinite number of parametric equations. Do you have any further conditions that would help us to pick the right one? – bubba Feb 28 '13 at 8:09

First you can assume $(x_2,y_2,z_2) = (0,0,0)$. If it isn't, you can just add $(x_2,y_2,z_2)$ back into all the parametric equations at the end. So we'll work with $(x_1',y_1',z_1') = (x_1-x_2,y_1-y_2,z_1-z_2)$.

Next let $(x_1',y_1',z_1') = (r_1\cos\phi_1,r_1\sin\phi_1,z_1')$. This simplifies things because now your $(r,z')$ plane is perpendicular to the $(x,y)$ plane and we can just work with two coordinates for now.

Now we need to find the center $(\overline r,\overline z')$. This will be one of two points on either side of the midpoint $(r_1/2,z_1'/2)$, perpendicular to the line that goes through the origin and $(r_1,z_1')$. We can just find a constant $c$ such that $(\overline r,\overline z') = (r_1/2,z_1'/2) + c(-z_1',r_1)$. We just need to be sure that the angle is right. We can do that by computing the dot product between the segments from the center to each point, or:

\begin{align*} \langle(r_1/2 - c z_1',z_1'/2 + cr_1),(-r_1/2 - c z_1',-z_1'/2 + cr_1)\rangle &= \cos\theta \ell_1 \ell_2 = \cos\theta \ell_1^2 \\c^2(z_1')^2 - r_1^2/4 + c^2r_1^2 - (z_1')^2/4 &= \cos\theta (r_1^2/4 + (z_1')^2/4 + c^2(z_1')^2 + c^2r_1^2) \\(c^2 - 1/4)(r_1^2 + (z_1')^2) &= \cos\theta (c^2 + 1/4)(r_1^2 + (z_1')^2) \\(c^2 - 1/4) &= \cos\theta (c^2 + 1/4) \\c^2(1-\cos\theta) &= (\cos\theta + 1)/4 \\4c^2 &=\cot^2(\theta/2) \\c &=\pm\cot(\theta/2)/2 \end{align*}

Once you have the center, one possible parametric equation for the arc is an easy matter of letting $\gamma_0$ be the angle in the $(r,z')$ plane where you find $(\overline r,\overline z')$ (i.e., $\gamma_0 = \arctan(\overline z'/\overline r)$). Then you can use a parametric form like this:

$$(r,z') = (\overline r,\overline z') - \ell_1(\cos(\gamma_0 \mp \gamma),\sin(\gamma_0 \mp \gamma))$$

The $\gamma$ parameter will trace out your arc in the range $[0,\theta]$.

So to sum up: $$(r,z') = (r_1/2,z_1'/2) \pm\cot(\theta/2)(-z_1'/2,r_1/2) - \ell_1(\cos(\gamma_0 \mp \gamma),\sin(\gamma_0 \mp \gamma))$$ Where $\ell_1^2 = (r_1^2 + (z_1')^2)/(4\sin^2(\theta/2))$, $r_1^2 = (x_1')^2+(y_1')^2$, and $(x_1',y_1',z_1') = (x_1-x_2,y_1-y_2,z_1-z_2)$.

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.