# Can we have more general drawing functions, please?

(I guess I should also file an “issue” for this … I hope that cross-posting is okay.)

I’d love to have some more general drawing functions than just line, ellipse, and rectangle. Drawing more complicated shapes and filling them would be fantastic.

What I’d really like to be able to do is essentially take an SVG picture and translate it to something suitable for inputting into Codea. So I’d like all the SVG drawing commands, pretty please!

I’d really like to see polyline (ie. line(x1, y1, x2, y2, x3, y3, …) ) and bezier curves.

polyline would be easy, perhaps trivial to implement as a user library.

I don’t have the math for bezier curves. would have to swipe and use someone else’s routines. My spine, educated in the 8 bit days, says this should all happen natively; but my recent experience suggests that implementing this in lua should be plenty fast.

Except for filling, cubic bezier splines could easily be implemented in Lua using straight lines. The math is straightforward. I’ve got a Java implementation that I could port, which does calculates both the spline equation and it’s derivative. The latter is useful for “steering” a sprite along the spline.

We’ll definitely be including filled and stroked polygons when the Physics update is released, because we’ll be able to use the convex decomposition to generate the triangles.

Splines sound cool, and fairly straight-forward. If you look at the processing reference – http://processing.org/reference – does that API for splines seem okay?

The bezier stuff from processing would be fantastic for me as I tend to think in beziers these days (from SVG and TikZ). I don’t know all the technical words so don’t know if “spline” refers to something specific or just generic curve-making stuff. Sticking path segments together is definitely something I’d like (so the bezierVertex stuff).

(I’m never sure which of the options to pick when “filing” an issue, I presume you lot can sort that out if I get it wrong.)

Thanks for posting it – yeah we’ll sort them out. It’s a good resource to have on hand when working on the app.

I’m guessing that double posting is quite useful. Posting here is useful for us and posting on the tracker is useful for you. So I try to do both, when I remember.