# Parametric Equation of a Circle in 3D Space?

So, my dilemma here is... I have an axis. This axis is given to me in the format of the slope of the axis in the x,y and z axes.

I need to come up with a parametric equation of a circle. This circle needs to have an axis of rotation at the given axis with a variable radius.

I've worked on this problem for days, and still haven't come up with a solution.

I'm using this circle to map the path of a satellite, programmed in C.

And help would be greatly appreciated.

Thanks!

-
If you're mapping the path of a satellite, they generally move in an ellipsoidal path. –  NovaDenizen Sep 9 '14 at 14:33

Let $(a_1,a_2,a_3)$ and $(b_1,b_2,b_3)$ be two unit vectors perpendicular to the direction of the axis and each other, and let $(c_1,c_2,c_3)$ be any point on the axis. (If ${\bf v} = (v_1,v_2,v_3)$ is a unit vector in the direction of the axis, you can choose ${\bf a} = (a_1,a_2,a_3)$ by solving ${\bf a} \cdot {\bf v} = 0$, scaling ${\bf a}$ to make $||{\bf a}|| = 1$, then letting ${\bf b} = {\bf a} \times {\bf v}$.)

Then for any $r$ and $\theta$, the point $(c_1,c_2,c_3) + r\cos(\theta)(a_1,a_2,a_3) + r\sin(\theta)(b_1,b_2,b_3)$ will be at distance $r$ from $(c_1,c_2,c_3)$, and as $\theta$ goes from $0$ to $2\pi$, the points of distance $r$ from $(c_1,c_2,c_3)$ on the plane containing $(c_1,c_2,c_3)$ perpendicular to the axis will be traced out.

So the parameterization of the circle of radius $r$ around the axis, centered at $(c_1,c_2,c_3)$, is given by $$x(\theta) = c_1 + r\cos(\theta)a_1 + r\sin(\theta)b_1$$ $$y(\theta) = c_2 + r\cos(\theta)a_2 + r\sin(\theta)b_2$$ $$z(\theta) = c_3 + r\cos(\theta)a_3 + r\sin(\theta)b_3$$

-
Simple and intuitive. Just set up vectors a and b like you would a 2-dimensional x and y axis, then do the normal circle equations. –  Christian Oudard Mar 1 '13 at 9:12
any clues on how to write similar equation for ellipse? –  mkuse Apr 29 '14 at 17:40
If you replace the $r\cos \theta$ by ${r \over c} \cos \theta$ and replace the $r\sin\theta$ by ${r \over d} \sin \theta$ and you get a corresponding ellipse with axes of length $c$ in the $(a_1,a_2,a_3)$ direction and length $d$ in the $(b_1,b_2,b_3)$ direction. –  Zarrax Apr 30 '14 at 23:37

I think an easy way to visualize this is to see it as a bunch of transformation matrices.

A circle is just:

$x = \left[\matrix{1\\0\\0}\right]$

after applying a scale matrix $S = rI$ and a rotation matrix

$R = \left[\matrix{\cos\theta & \sin\theta & 0 \\ \sin\theta & -\cos\theta & 0 \\ 0 & 0 & 0}\right]$.

(i.e., its $SRx$)

Now, you want rotate that whole circle to some arbitrary direction in three dimensions. Given a three-dimensional rotation matrix $T$, you can write that as

$TSRx.$

-

Is your "slope of the axis in the x,y and z axes" the direction cosines? You need a center $c$ as well, presumably a point on the axis. Given the unit vector $\vec{v}$ along the axis one way is to find two perpendicular unit vectors. As long as $\vec{v}$ is not along the $x$ axis, you can normalize $\vec{v} \times (1,0,0)$ for one and call it $\vec{a}$, then let $\vec{b}=\vec{v} \times \vec{a}$. Then your satellite location is $c+R\cos\omega t\vec{a}+R\sin \omega t\vec{b}$

-

For this answer, I make a few (not too drastic) assumptions:

1. The circle you are interested in is centered at the origin (thus, the plane your circle lies in has to pass through the origin).

2. The plane your circle lies in is already in Hessian normal form, $\mathbf{\hat n}\cdot\langle x\;y\;z\rangle=0$, where $\mathbf{\hat n}$ is a unit normal vector to your plane.

3. The plane is not any one of the coordinate planes (and in those cases, you wouldn't need to go through this route).

What you can use to derive the parametric equations for your circle is the Rodrigues rotation formula, which is a rotation matrix used for rotating by an angle $\varphi$ about an arbitrary axis $\mathbf{\hat n}=\langle n_x\;n_y\;n_z\rangle$. Letting

$$\mathbf W=\begin{pmatrix}0&-n_z&n_y\\n_z&0&-n_x\\-n_y&n_x&0\end{pmatrix}$$

the Rodrigues rotation matrix is

$$\mathbf R(\varphi)=\mathbf I+\sin\,\varphi\mathbf W+2\sin^2\frac{\varphi}{2}\mathbf W^2$$

Thus, to assemble the parametric equations for your circle: pick any point in your plane whose distance from the origin is equal to the radius of your circle, and then apply the Rodrigues rotation formula to that point. The axis to use is the unit normal vector in the Hessian normal form of your plane, and the rotation angle is the varying parameter in your parametric equations. That is, if $\mathbf p$ is a point at a distance $r$ from the origin, and satisfies $\mathbf{\hat n}\cdot\mathbf p=0$, then $\mathbf r(t)=\mathbf R(t)\cdot\mathbf p$ is the vector equation for your circle.

-

If your circle has a unit normal vector < cos(a), cos(b), cos(c)> then depending on c, you have:

< cos(t-arcsin(cos(b)/sin(c)))/sqrt(sin(t)^2 +cos(t)^2*sec(c)^2), sin(t-arcsin(cos(b)/sin(c)))/sqrt(sin(t)^2 +cos(t)^2*sec(c)^2), cos(t)*sin(c)/sqrt(cos(t)^2+sin(t)^2*cos(c)^2> 0

< sin(t)*sin(a), -sin(t)*cos(a), cos(t)> cos(c)=0

and of course, < cos(t), sin(t), 0> sin(c)=0

The first two will have t=0 be the maximum point

-
Welcome to math.SE! Please note that you can use LaTeX to render equations more readable –  Tobias Kienzler Jul 3 '13 at 6:36