How to Draw a Circle Perpendicular to a Vector in 3D Space?

  • Context: Undergrad 
  • Thread starter Thread starter DivergentSpectrum
  • Start date Start date
  • Tags Tags
    Circle Normal Vector
Click For Summary

Discussion Overview

The discussion revolves around the problem of drawing a circle perpendicular to a specified vector in 3D space, with a focus on the mathematical and programming approaches to achieve this. Participants explore various methods, including parametric equations and vector calculations, while addressing the complexities involved in defining the circle's position and orientation.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant suggests using the equation of a sphere centered at a point but seeks the relationship between parameters u and v to form a circle normal to a specified vector.
  • Another participant proposes finding two orthogonal vectors to the specified vector using the cross-product, and then combining them with sine and cosine functions as in 2D.
  • A different participant mentions the need for a plane normal to the vector and expresses uncertainty about how to find the constant D in the plane equation.
  • One participant shares a link to a resource on parametric equations of a circle in 3D but expresses frustration with their implementation in code.
  • Another participant provides a code snippet related to calculating circle points based on angles and a normal vector, indicating the complexity of their programming task.
  • One participant discusses the use of the cross product to find a vector normal to the circle's surface, but does not clarify how this relates to the overall problem.
  • Another participant references a Wolfram site that discusses the parameters needed for a circle in 3D, noting a potential error in the definitions of angles.

Areas of Agreement / Disagreement

Participants express varying approaches and methods to solve the problem, with no clear consensus on the best method or solution. Some participants agree on the necessity of finding orthogonal vectors and defining a plane, while others challenge the effectiveness of certain approaches, indicating ongoing debate.

Contextual Notes

Participants highlight the complexity of defining a circle in 3D, noting the need for multiple parameters and the challenges in programming implementations. There is also mention of potential errors in existing resources, which may affect understanding.

Who May Find This Useful

This discussion may be useful for computer programmers, mathematicians, and physics enthusiasts interested in 3D geometry, vector mathematics, and parametric equations.

DivergentSpectrum
Messages
149
Reaction score
15
i have a 3d vector, and i want to draw a circle with a specified radius around the vector (for computer programming)
so i have the location of the center of the circle(first point of the vector)
but i also want the circle to be at a right angle to the vector

my approach:
gif.gif

the equation of a sphere centered at x,y,z.
but i need to find the relation between u and v so that it forms a circle normal to some specified vector

please help thanks
 
Mathematics news on Phys.org
That might be possible, but it looks complicated.

I would find two vectors u,v orthogonal to the specified vector (let's call it "n") and orthogonal to each other. This can be done with the cross-product. Afterwards you can combine them with sin and cos as in the 2-dimensional case.
 
if a plane normal to a vector xn,yn,zn is given by
gif.gif

then i think i could replace the parametric sphere coordinates with the coordinates to the plane and solve
gif.gif

what i want out of this is the relation between u and v, but i can't figure out how to solve it
then once i have u and v in terms of a single t parameter i can center it at the correct point.

do you mean the u,v vectors as in the parameters? or something else?
 
DivergentSpectrum said:
do you mean the u,v vectors as in the parameters?
Probably a bad choice of variable names in my post. I mean two vectors.
I don't like the sphere approach. It might be possible, but I don't see the solution there while I am sure the other method works.
 
To "draw a circle normal to a vector" the first thing you need to do is find a plane normal to the vector. That's easy- if the plane is given by A\vec{i}+ B\vec{j}+ C\vec{k} then any plane normal to it is of the form Ax+ By+ Cz= D for some constant D. Finding D is another matter. A vector does not have a specified position in space.
 
The center of the circle seems to be given as (x,y,z).
 
We don't know either because you did not show what you did.
 
Code:
            double theta = Math.Atan2(curly[i, j, k], curlx[i, j, k]);
            double phi = Math.Acos(curlz[i, j, k] / Math.Sqrt(curlx[i, j, k] * curlx[i, j, k] + curly[i, j, k] * curly[i, j, k] + curlz[i, j, k] * curlz[i, j, k]));
            double costheta = Math.Cos(theta);
            double sintheta = Math.Sin(theta);
            double cosphi = Math.Cos(phi);
            double sinphi = Math.Sin(phi);

            int l = 0;
            double t ;
            int nitert = 20;
            double dt = 2 * Math.PI / nitert;
            double[] xcircle = new double[nitert+1];
            double[] ycircle = new double[nitert+1];
            double[] zcircle = new double[nitert+1];
            circlepoints.Add(new Point3D(-size * sinphi / 25 + xcurrent, size * cosphi / 25+ ycurrent, zcurrent));
        
  while (l <= nitert)
            {
                t = l * dt;
                xcircle[l] = -size * Math.Cos(t) * sinphi / 25 + size * Math.Sin(t) * costheta * cosphi / 25 + xcurrent;
                ycircle[l] = size * Math.Cos(t) * cosphi / 25 + size * Math.Sin(t) * costheta * sinphi / 25 + ycurrent;
                zcircle[l] = -size * Math.Sin(t) * sintheta / 25+ zcurrent;
                circlepoints.Add(new Point3D(xcircle[l], ycircle[l], zcircle[l]));
                circlepoints.Add(new Point3D(xcircle[l], ycircle[l], zcircle[l]));

                l++;
            }

I always feel bad asking people to look over my code lol.

anyway curlx,curly,curlz is the normal vector(yes I am doing a stokes theorem program :D)
and xcurrent,ycurrent,zcurrent is the position vector.

size/25 is the radius of the circle.
 
  • #10
Hey, don't know if I understand completely but here is what I think (btw I am still getting used to using the latex math symbols here so I won't use them in this response)

Use the cross product (copied&pasted this one):
eq0006MP.gif


Here the vector is normal to the circle's surface in the positive Z direction. That is the crossproduct of r's x component and y component.
Vector = rx cross ry
 
  • #11
Continuation of my last post:

syms u v
>>R = [u 0 0; 0 u*cos(v) 0; 0 0 u*sin(v)]

R =

[ u, 0, 0]
[ 0, u*cos(v), 0]
[ 0, 0, u*sin(v)]

>> vector = cross(R(1,: ),R(2,: ) )

vector =

[ 0, 0, u^2*cos(v)]

*had to edit away the simily faces
 
Last edited:
  • #12
the wolfram site says:
While a 2D circle is parameterized by only three numbers (two for the center and one for the radius), in 3D six are needed. One set of parametric equations for the circle in 2D is given by
2.gif

for a circle of radius
3.gif
and center
4.gif
.
In 3D, a parametric equation is
5.gif
,
for a circle of radius
6.gif
, center
7.gif
, and normal vector
8.gif
(
9.gif
is the cross product). Here,
10.gif
is any unit vector perpendicular to
11.gif
. Since there are an infinite number of vectors perpendicular to
12.gif
, using a parametrized
13.gif
is helpful. If the orientation is specified by a zenith angle
14.gif
and azimuth
15.gif
, then
16.gif
,
17.gif
, and
18.gif
can have simple forms:
19.gif
,
20.gif
,
21.gif
.

but actually they made a mistake. here phi is the azimuth and theta is the zenith.
someone should probably tell them :rolleyes:
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 59 ·
2
Replies
59
Views
184K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
8
Views
1K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K