Even more on ellipses and splines

Honestly, they’re incredibly interesting. Anyway, I’ll skip straight to the pièce de résistance:

Ellipse Modulation VI

This is a 4-curve cubic Bézier spline modulated onto an ellipse. The ellipse [a=4, b=3] is at an angle of π/4. C1 continuity of the complete curve is preserved. The flickr set tells the story of how I got here.

This is around 450 lines of my naive lisp, including class definitions and test code. So Gary, this is your g-code challenge!

The lisp code is object oriented (oh, and so much nicer than C++’s so-called object orientation). I rewrote the earlier code now that I knew what I was doing, and I added lines and polylines to the mix too (see the flickr set) so I can easily modulate whatever edge I want. You’ll notice if you look closely at the earlier attempts that they had a bit of a problem with c1 continuity, which is now fixed with the new code.

In closing, thanks, Zach!

4 comments

  1. I’ll see what I can do. Actually, I’ll probably be posting the whole code soon. Do you mean you’d like to see lambdas modulated onto things, or things modulated onto lambdas? Or both? I suppose either would be possible. At first glance it looks like I’ll want vecto:string-paths exposed.

    May I suggest adding an optional orientation to centered-ellipse-path? I wrote my own ellipse drawing function to get around the problem of wanting to stroke or fill outside the context of with-graphics-state that is currently required to draw a rotated ellipse. Without this functionality, ellipses are not very composable into other data structures.

    Also, do you have any plans for functional fills? I could really use xor, at least.

    Finally, in the spirit of being a fledgling member of the lisp community, I should shed my cloak of anonymity so I’m no longer “some guy”. I’ve updated my about page accordingly.

    Ben

  2. Re the lambda glyph, whatever looks coolest.

    I need to figure out how best to export the string path generation stuff. I had to use it a lot for Screedbot and it involved a lot of ::s.

    I was thinking of exporting the transformation matrix functions so things that need to transform outside of the normal transformation system (like when you want to get squashed paths but not squashed strokes, for example).

    The ellipse rotation thing probably wouldn’t be too tricky to add…

    I didn’t really think about functional fills, sorry. What would that be like?

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.