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

Approximating elliptical arcs with Bézier curves

29 March, 2008

In doing my modulation work with curves and ellipses, I extended the vecto function for drawing an ellipse to enable an oriented ellipse. Lately it occurred to me that this didn’t go far enough in terms of functionality, and I began wondering about how to draw part of an elliptical…

Read More

RotateAVI v0.91beta

8 January, 200729 July, 2007

It’s up on elbeno.com. If you got a digital camera for Xmas (or otherwise), check it out. An easy way to rotate avi movies.

Read More

How to print anything in C++ (part 1)

1 February, 201530 June, 2015

Part 1 Part 2 Part 3 Part 4 Part 5 Postscript I thought I’d have a go at writing some code that could print things. A pretty-printer, if you like. What I want to be able to do is this: // Print x correctly, where x is ANY type. cout

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