Poly line tessellation for big smooth lines

Before I get on with some frankencode of my own, is there an existing solution for drawing big thick lines in oF, with nice fillets and chamfers at the corners and caps so you don’t end up with what looks like a bunch of rectangles?

I posted some Mac-specific code that does this a while ago:
http://forum.openframeworks.cc/t/how-to-smooth-joints-when-calling-ofsetlinewidth/7278/9
It uses Apple’s Quartz 2D library to convert a path to a stroked path, with line joins.
If you find another solution, I would be interested to hear about it, too. :slight_smile:

Yeah, I saw that, thanks for posting it. Can’t use it for this project though.

I wanted something I could start playing with as quickly as possible without porting a bunch of code or requiring a large framework, so I’m making use of the Vase rendering code as detailed in this article:

http://artgrammer.blogspot.com/2011/07/drawing-polylines-by-tessellation.html

After mentioning this on Twitter, I was given this article, which I think should serve as a good base for anyone looking to start work on a more general solution:

http://www.merowing.info/2012/04/drawing-smooth-lines-with-cocos2d-ios-inspired-by-paper/

It doesn’t actually address the corner issue though, but if you’re looking to draw mainly curves this shouldn’t be a problem.

FYI I’ve ported Krzysztof’s smooth line drawing class (the second link above) to openFrameworks. If I get the okay from him I’ll post it as an ofxAddon - seems to work really well for my needs, at least.

Reviving this thread; @Siw did you ever manage to release that?

1 Like

I’ve also ported this code over, let me dig it up…

also, I’ve ported this http://mattdesl.svbtle.com/drawing-lines-is-hard and was planning to release an addon shortly – it’s pretty useful, but not a bulletproof solution for thick 3d lines. I used it for https://www.androidexperiments.com/experiment/ink-space

2 Likes

ps: the Krzysztof code as I recall is really more about input then drawing, it just does smoothed input ala paper – it helps make fast input lines look less jagged.