Generate a Circle on a Vector
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
J.A.N.K.E.Y.: Journeying Artificial Nocturnal Killing and Exploration Youth
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement