1
$\begingroup$

Finding the $(x,y)$ coordinates of points along the circumference of a circle in 2D space is fairly easy.

x = r * cos(𝜃) + Xc

y = r * sin(𝜃) + Yc

r = radius of circle
(Xc, Yc) = coordinates of circle center
𝜃 = current angle

I am looking for similar equations for a circle in 3D space. Keep in mind I haven't had geometry in 20 years and we didn't cover 3D geometry. So please go easy on me and explain any notation you use.

$\endgroup$
1
  • $\begingroup$ Reworked the answer based on correct understanding $\endgroup$
    – Quanto
    Sep 28 '19 at 0:04
3
$\begingroup$

You could write the equations of the circle as

$$x = r \cos 𝜃$$ $$y = r \sin 𝜃$$ $$z=0$$

So, it is a special 3D circle with its z-coordinate always at zero. A true 3D circle can be produced from rotating the coordinates around any line $y=kx$.

For convenience, we rotate the coordinates around $y$-axis by an angle $\alpha$. From the standard coordinate transformation, we have

$$ x’ = x\cos\alpha - z\sin\alpha$$ $$ y’ = y$$ $$ z’= x\sin\alpha + z \cos\alpha $$

Plug the original coordinates of the circle above into the transformed coordinates, we get

$$ x’ = r\cos\theta \cos\alpha$$ $$ y’ = r\sin\theta$$ $$ z’= r\cos\theta\sin\alpha $$

which are the 3D coordinates of the original circle after the coordinates are rotated about the $y$-axis by an angle $\alpha$.

$\endgroup$
7
  • 1
    $\begingroup$ I assume I would also have to add the coordinates of the circle's center to those equations? $\endgroup$
    – iHorse
    Sep 27 '19 at 21:33
  • $\begingroup$ Also, how would I find 𝜙? Assuming the circle isn't moving dose 𝜙 change at all? $\endgroup$
    – iHorse
    Sep 27 '19 at 21:39
  • 1
    $\begingroup$ @iHorse - correct, you need to add the center coordinates as you do in 2D $\endgroup$
    – Quanto
    Sep 27 '19 at 21:53
  • $\begingroup$ @Quanto On your diagram, the angles $\theta$ and $\phi$ are interchanged. $\endgroup$
    – A.Γ.
    Sep 27 '19 at 22:01
  • $\begingroup$ @Quanto I think you might have misunderstood what I was asking. If a plane where to intersect that sphere the result would be a 2D circle. The points on the circumference of that circle are what I am looking for. $\endgroup$
    – iHorse
    Sep 27 '19 at 22:17
1
$\begingroup$

Think on the intersection between an sphere $x^2+y^2+z^2= r^2$ and a plane $a x + b y + c z = 0$

Solving for $x,y$ we get

$$ x = \frac{-a c z\mp\sqrt{b^2 \left(r^2 \left(a^2+b^2\right)-z^2 \left(a^2+b^2+c^2\right)\right)}}{a^2+b^2}\\ y = \frac{-b^2 c z\pm a \sqrt{b^2 \left(r^2 \left(a^2+b^2\right)-z^2 \left(a^2+b^2+c^2\right)\right)}}{b \left(a^2+b^2\right)} $$

now $z$ is such that $r^2 \left(a^2+b^2\right)-z^2 \left(a^2+b^2+c^2\right) \ge 0$ or

$$ -\frac{r\sqrt{a^2+b^2}}{\sqrt{a^2+b^2+c^2}}\le z \le \frac{r\sqrt{a^2+b^2}}{\sqrt{a^2+b^2+c^2}} $$

so finally we have a parametric representation

$$ x = x(z)\\ y = y(z)\\ $$

for

$$ -\frac{r\sqrt{a^2+b^2}}{\sqrt{a^2+b^2+c^2}}\le z \le \frac{r\sqrt{a^2+b^2}}{\sqrt{a^2+b^2+c^2}} $$

NOTE

we assumed $a,b,c$ all non null. The cases in which with one of them, or two are null, are trivial because the plane equation is simpler.

Attached the solution for $a=1,b=1,c=1,r=1$ and $-\sqrt{\frac 23}\le z\le \sqrt{\frac 23}$

enter image description here

$\endgroup$
4
  • $\begingroup$ How would I use those equations to find all the points along the circumference of the resulting circle? $\endgroup$
    – iHorse
    Sep 27 '19 at 21:54
  • $\begingroup$ Attached the case $a=1,b=1,c=1,r=1$ with $-\sqrt{\frac 23}\le z\le \sqrt{\frac 23}$. Choosing $z$'s into this range we can draw the two foils for $(x(z),y(z),z)$ $\endgroup$
    – Cesareo
    Sep 28 '19 at 10:46
  • $\begingroup$ ok. If I understand correctly I would just increment z from the low end of that range to the upper end and plug the values into the first two equations along with the other relevant variables to get the points along the circumference of the circle. $\endgroup$
    – iHorse
    Sep 30 '19 at 15:50
  • $\begingroup$ @iHorse Yes. Choosing $z$ values in the range, we can compute the corresponding $x(z),y(z)$. The vector $(a,b,c)$ represents the normal to the plane containing the circle with radius $r$ centered at $(0,0,0)$. $\endgroup$
    – Cesareo
    Sep 30 '19 at 17:41
0
$\begingroup$

Let’s rewrite your original parameterization a bit: $\vec c + (r\cos\theta) \vec e_1 + (r\sin\theta) \vec e_2$. Here $\vec e_1$ and $\vec e_2$ are the standard unit basis vectors. We can absorb $r$ into these vectors by setting $\vec u=r\vec e_1$ and $\vec v=\vec e_2$. Observe now that we can start anywhere on the circumference by making the substitution $\theta=\phi+\delta$ for some fixed angle $\delta$. This amounts to rotating $\vec u$ and $\vec v$ clockwise about the center $\vec c$ through an angle of $\delta$. We can also apply a reflection, which amounts to traversing the circle clockwise instead of counterclockwise. The upshot of all this is that we can choose any pair of perpendicular radii $\vec u$ and $\vec v$ for the parameterization $\vec c+\vec u\cos\theta+\vec v\sin\theta$. This works regardless of the dimension of the ambient space—you can always start with an appropriately-sized circle in the $x$-$y$ plane and map it to the desired circle with a rigid motion.

This generalizes to ellipses, but now the vectors $\vec u$ and $\vec v$ are conjugate half-diameters. You should be able to convince yourself of this by examining the effect of an affine transformation on the unit circle. A similar parameterization exists for hyperbolas, but it uses (unsurprisingly) the hyperbolic since and cosine.

$\endgroup$
3
  • $\begingroup$ I was able to follow most of that. I don't quite see where you are getting the vectors e1 and e2. I know what a unit vector is I just don't know what you mean by "standard unit basis vectors". I assume that 𝛿 would be the angle of the vector from the center of the sphere to the center of the circle relative to the x-y plane and by incrementing 𝜙 I am effectively walking around the circumference of the circle. $\endgroup$
    – iHorse
    Sep 30 '19 at 15:38
  • $\begingroup$ @iHorse These are just the standard basis vectors $(1,0)$ and $(0,1)$. I.e., $(r\cos\theta+x_c,r\sin\theta+y_c)=(x_c,y_c)+r(\cos\theta,\sin\theta)=(x_c,y_c)+r\cos\theta(1,0)+r\sin\theta(0,1)=\vec c+(r\cos\theta)\vec e_1+(r\sin\theta)\vec e_2$. $\endgroup$
    – amd
    Sep 30 '19 at 18:23
  • $\begingroup$ @iHorse What sphere? I’m working entirely in $\mathbb R^2$ in that first paragraph. The point of the substitution is that any point on the circle can be the “zero point” of the parameterization: use that radius as one of the two vectors. In this case the offset $\delta$ does directly represent an angle (the angle from the positive $x$-axis), but that’s only because the parameters $\theta$ also directly corresponds to an angle. Don’t get locked into that, though. We could just as well parameterize the unit circle as, say, $(\cos3t,\sin3t)$, where $t$ doesn’t represent an angle. $\endgroup$
    – amd
    Sep 30 '19 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.