a circle in 3d?
i want to draw a circle in 3d, but not a flat one with z=0...
and i don''t know how to do it...
any ideas?
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 !
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 !
well, it''s a circle but in 3DSpace...
not a Sphere, but a circle that the radius direction can be toward the Z plane...
not a Sphere, but a circle that the radius direction can be toward the Z plane...
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
Is that what you''re asking for?
-Odd the Hermit
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.
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement