Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Generate a Circle on a Vector

This topic is 5979 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

my idea is to Generate a Circle around any Axis.. normaly it looks like this: Rotate Around the Z Axis: x = Radius * sin( phi ); y = Radius * cos( phi ); z = 0; Rotate Around the X Axis: x = 0; y = Radius * cos( phi ); z = Radius * sin( phi ); Rotate Around the Y Axis: x = Radius * sin( phi ); y = 0; z = Radius * sin( phi ); But how can i Generate a Circle around my own Axis Vector ... ? im not the best at Vector Maths so could somebody please explain? thx J@n

Share this post

Link to post
Share on other sites
The easiest way I know is to use quaternions.
Just setup a quaternion using the axis angle method, and draw lines between the points you rotate using that quaternion.

So in peudo code you would do something like this:

vector3 axis(1,0,0)

vector3 start = quat(axis, 0.0) * vector3(1,0,0)

for(angle=0.0; angle<=TWOPI; angle+= TWOPI/Subdivisions){
end = q(axis, angle) * vector3(1,0,0);
line (start, end);
start = end;

Or something similar. So you put your arbitrary axis in the ''axis'' vector 3, and your set!

Oh if you want info on quaternions, just do a google search for quaternions, and you''ll find tons of info..


Share this post

Link to post
Share on other sites
You could apply a rotation matrix to your coordinates calculated by any of the 3 vector equations.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!