Skip to content
Why is a raven like a writing desk?

Thoughts both confusing and enlightening.

Why is a raven like a writing desk?

Thoughts both confusing and enlightening.

Even more on ellipses and splines

elbeno, 15 March, 200815 March, 2008

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!

Lisp Maths Programming

Post navigation

Previous post
Next post

Related Posts

RotateAVI

11 September, 200629 July, 2007

Your new digital camera takes great videos, right? And you have a nice 2GB flash/SD/whatever card in there so you can take plenty. But there’s one problem: you have lots of movies in portrait format, where you were holding the camera on its side, because after all that is how…

Read More

ELI5: monoids

29 February, 2016

(Resulting from my claim that “a child of 8 can understand monoids…”) Wikipedia says: “In abstract algebra, a branch of mathematics, a monoid is an algebraic structure with a single associative binary operation and an identity element.” Wolfram says: A monoid is a set that is closed under an associative…

Read More

10 Non-C++ Book Recommendations for C++ Programmers

19 January, 2018

So you’ve learned enough C++ to function. You’ve read a bunch of the usual recommendations: Meyers, Stroustrup, maybe even Alexandrescu and Stepanov. You know enough to recommend Lippman et al. to newbies rather than the other “C++ Primer.” The internet has lots of C++-related book recommendations to make — for…

Read More

Comments (4)

  1. Zach Beane says:
    16 March, 2008 at 12:33 pm

    That is pretty awesome. You’re welcome!

  2. Zach Beane says:
    17 March, 2008 at 10:34 am

    I’d love to see this applied to glyphs, like perhaps (code-char #x3bb)

  3. elbeno says:
    17 March, 2008 at 9:06 pm

    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

  4. Zach Beane says:
    20 March, 2008 at 5:11 am

    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 Reply

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.

©2026 Why is a raven like a writing desk? | WordPress Theme by SuperbThemes