Archived

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

a circle in 3d?

This topic is 5337 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

Hi
Er... You want to draw a circle that is not flat ... Well its not a circle then. Is it a torus ? a kind of cylinder ? A disc (that is, a circle with inside filled, but it is still a flat geometry)
Maybe you just wanted to draw a flat circle that is rotated so it is not in the Z=0 plane ?
Tell us more !

Share this post


Link to post
Share on other sites
well, it''s a circle but in 3DSpace...
not a Sphere, but a circle that the radius direction can be toward the Z plane...

Share this post


Link to post
Share on other sites
To get a circle which is not at z=0 (that is, a circle in an arbitrary plane in 3-space), simply use a rotation matrix. Create a normal circle, in whatever plane is easiest for you, and then crank it through a rotation matrix to get the orientation you want. (Works for everything, by the way )

Is that what you''re asking for?

-Odd the Hermit

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
try using D3DXCreateCylinder or D3DXCreateTorus to create a really skinny mesh and then rotate it as Odd the Hermit suggests. you''ll have to clone it to another FVF if you want to use lighting as the mesh is only created with positions, no normals.

Share this post


Link to post
Share on other sites
A circle oriented to a specified axis:

P = C + r * (cos(a)*U + sin(a)*V)

a = angle of point around circle
r = radius of circle
C = origin/centre of circle in world space

N = the axis (normal) of the plane the circle is in
U = vector perpendicular to N and V
V = vector perpendicular to N and U

UVN form an orthonormal basis for the circle coordinate system

P = point of circle in plane defined by axis (normal)


You can munge the components of your N vector (the axis) to get a temporary "other" vector (i.e. some vector which isn''t the same as N), then do two cross products to construct U and V.

Then you perform the above (P = C + ...) to make each point around your circle (i.e. step=360_degrees/num_vertices_to_create)


--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites