View Full Version : Drawing a cirle around a vector

eldonantonio

01-31-2004, 07:29 PM

I have a (normal) vector and a position point. I'd like to draw a circle of radius R around the position point, and in the plane described by the normal vector.

I feel it's a simple problem, but my mind is getting numb. Any ideas?

Draw a circle around the origin in the x-y plane, then translate it to your position point and rotate it to your normal vector. This makes the translation trivial and the rotation a matter of finding the angle and axis of rotation between two vectors (your normal and the initial +z unit vector, the circle's original normal). Ask again if you need more details about any of these steps.

chowe6685

02-04-2004, 05:45 AM

Alternately consider that the circle in the x-y plane is just a trivial case in general you can draw a circle by generating points of the form

P = A*sin(Theta)+B*cos(Theta) where A and B are vectors representing the axis of your circle, the x-y plane is the case where A = <0,1,0} and B = <1,0,0>. Given a normal you can generate two perpendicular vectors and use them as your axis. This is more complex, but more useful for some situations

Originally posted by eldonantonio:

I have a (normal) vector and a position point. I'd like to draw a circle of radius R around the position point, and in the plane described by the normal vector.

I feel it's a simple problem, but my mind is getting numb. Any ideas?

Let the position point be O, the normal N. Any point X on the desired circle satisfies the following equations:

{ dot(OX,N)=0, |OX|=R }

From them we obtain a one-parametric set of points X, lying on the plane circle.

eldonantonio

02-05-2004, 10:30 PM

Thanks a lot guys, all your suggestions are really good and that should do the trick. I'll come back and bother you if for some reason it doesn't work http://www.opengl.org/discussion_boards/ubb/smile.gif

Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.