I have a list of points (3D) and want to draw a line connecting all points with a specified width. The line should be rendered in OpenGL (using OSG) as triangles. The real challenge of this task is to make the line look "pleasant" for the user; meaning the joints should be round.

It should be similar to this:

enter image description here

Is there any library which brings this functionality?

  • \$\begingroup\$ So you want a smooth curve through those points? Look into bezier curves. \$\endgroup\$ – doppelgreener May 10 '12 at 10:03
  • \$\begingroup\$ No, i don't want a smooth curve though the points. I just want a 'think' line connecting the points with good locking joints (especially without spikes) \$\endgroup\$ – Andreas Roth May 10 '12 at 10:14
  • \$\begingroup\$ Could you post an example of what you want? \$\endgroup\$ – doppelgreener May 10 '12 at 10:22
  • \$\begingroup\$ added a link to similar code for 2d lines \$\endgroup\$ – Andreas Roth May 10 '12 at 12:32
  • \$\begingroup\$ There's lots of things in this link. My unserstanding is that you're only interested in rounded joints, like this: vaserenderer.sourceforge.net/blog/vaserendererdraft12/…. Am I right? \$\endgroup\$ – Laurent Couvidou May 11 '12 at 14:02

I'm not sure you should go through the burden of using a library just for rounded joints. You could draw thick lines with discs at the intersections, i.e.:


| improve this answer | |
  • \$\begingroup\$ +1 - this is the most straightforward approach. Note that since the user is talking about line drawing in 3d, the 'thick lines' should actually be cylinders and the discs should be spheres since they could be being looked at from any angle; if users will be inspecting the lines up close then you'll have to be a little bit careful about polygonalizing your shapes (especially your sphere) to avoid cracks where the cylinders merge into the sphere. \$\endgroup\$ – Steven Stadnicki May 15 '12 at 20:25

In the CAD world a rounded corner like you describe is called a Fillet while a hard angled transition is called a Chamfer. Since you are dealing with lines, which is a CAD specialty, see if anything here: Discussion on CAD libraries has something you can use.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.