[jit.gl] 3D arcs
Hi everybody !
I'm looking for a way to draw arcs (ie portions of rings) in a jit.gl.render environment.
I thought of jit.gl.sketch but "circle" give a portion of disk (ie filled to the center) and "framecircle" allows only line (with thickness but no real control over the width of the arc).
I also thought of doing this directly with gl commands as glvertex but then, I need to define manually the number of vertices I want to draw for each portion of circle which enclose my arc. And this may depend on the distance to the object etc. So I would need to redraw everytime I move the camera.
Is there a nice/simple I haven't noticed to draw this kind of arcs ? (the easiest would be something like the function gluPartialDisk of glu lib but it seems that jit.gl.sketch doesn't understand glu, does it ?)
Cheers
Have you tried using jit.gl.mesh and jit.expr? You could express the arc as a range of an angle (say from 0 to PI/4) and use cos/sin functions in expr to generate an arc.
wes
BenCello wrote on Thu, 02 April 2009 07:46Hi everybody !
I'm looking for a way to draw arcs (ie portions of rings) in a jit.gl.render environment.
I thought of jit.gl.sketch but "circle" give a portion of disk (ie filled to the center) and "framecircle" allows only line (with thickness but no real control over the width of the arc).
As a workaround, you could draw two circles, one smaller and the same color as the erase_color of the scene, and with the same arc degree parameters. Not at all elegant but it would let you control the width of the arc easily. Of course if there are other shapes which might intersect or be behind the "invisible" circle, the workaround would be obvious. Maybe there's a way to blend the two so that it makes a mask of some sort that's transparent...?
Hi !
Thanks for your answers.
I thought of 2 circles, one masking the other.
But actually, just for the try, I've done what I wanted (ie visualize some properties of graphs) with triangles instead of arcs and it showed me some stuff I couldn't visualize with arcs...
So I'm going to stick with triangles for now.
And If I finally need some arcs, I think I'll program it by adding some points in my triangles (1 for squares, 2 for pentagons etc and cos and sin function to get the right positioning).
Thanks anyway, I'll keep you posted if I do it
Cheers
BenCello