#### Archived

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.

## 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 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..

Cheers!
Nick

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

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 13
• ### Forum Statistics

• Total Topics
632960
• Total Posts
3009475
• ### Who's Online (See full list)

There are no registered users currently online

×