
Ao is a tool for programmatic computer-aided design using Scheme - amirouche
http://www.mattkeeter.com/projects/ao/
======
qwertyuiop924
This is a CAD tool truly worthy of the association with scheme. And I'm not
just saying that: It provides minimal primitives for maximum power and
flexibility. That's scheme in a nutshell.

It's also, not by coincedence, really, really cool.

------
mkeeter
Ao's author here – I'd be glad to answer questions.

~~~
pault
Your projects are really impressive! Can you tell us a little bit about your
background, and how you developed a proficiency with graphics programming?

~~~
mkeeter
I started this kind of tool-building in grad school, where I implemented a
bunch of algorithms from the research literature and combined them together in
interesting ways.

Implementing interesting algorithms is a good way to get a feel for the
problem space, and it drags a bunch of the UI/UX considerations along with it
– once you've created the crux of a particular tool, how do you expose it to a
user (or just yourself while testing) in a way that makes sense?

------
davexunit
Add in a REPL server so that I can make cool designs from Emacs and I'm sold.
I'm a big Guile fan so this is a very exciting project for me.

~~~
blanka-herono
This was on guile-user and no one seemed interested.

[http://lists.gnu.org/archive/html/guile-
user/2016-06/msg0004...](http://lists.gnu.org/archive/html/guile-
user/2016-06/msg00040.html)

------
brudgers
Github repository:
[https://github.com/mkeeter/ao](https://github.com/mkeeter/ao)

~~~
tempodox
I was just about to ask where the download button is :)

------
amirouche
Does Ao compute a mesh from scheme instructionz? or it is a trick? Basically
can you dump the code that generates the things in a format that is efficient
for a real time application?

Oh! And thanks for using GNU Guile Scheme :)

~~~
mkeeter
The Scheme functions go through a JIT-ish pass into a representation that's
efficient for rendering.

Details are at
[http://www.mattkeeter.com/projects/ao/jit.html](http://www.mattkeeter.com/projects/ao/jit.html)

Rendering is done with pixel-perfect rasterization of the function. Models are
only gets converted into a mesh when you're exporting.

This may change in the future, as it's much easier to spin around a mesh – the
right strategy is probably a low-res mesh for interactivity, which gets
replaced with a pixel-perfect rendering (running in the background until
complete).

~~~
davexunit
I wonder if using a generic procedure would work better than redefining +
outright. If you opened up Ao and typed (+ 1 1) at the REPL, would you see 2
as the result or a token object?

~~~
mkeeter
The redefined + only behaves differently when one or more of its arguments is
a token object, so normal math works fine.

Generic procedures may be a cleaner way to do this, but I only discovered
GOOPS after this implementation was already working.

~~~
davexunit
>The redefined + only behaves differently when one or more of its arguments is
a token object, so normal math works fine.

Ah yes, I'm just blind and missed the implementation in your article. Thanks
for explaining!

------
blanka-herono
Nobody ever listens to me:

[https://news.ycombinator.com/item?id=12033059](https://news.ycombinator.com/item?id=12033059)

I don't get it, has he given up on Guile or not:

[http://lists.gnu.org/archive/html/guile-
user/2016-06/msg0002...](http://lists.gnu.org/archive/html/guile-
user/2016-06/msg00022.html)

[http://lists.gnu.org/archive/html/guile-
user/2016-06/msg0002...](http://lists.gnu.org/archive/html/guile-
user/2016-06/msg00027.html)

~~~
mkeeter
I got Ao to a working state a few months before that exchange on the guile-
users mailing list.

Guile works fine for Ao – it's clean and simple, plays nice with C FFI, and
has a good REPL.

Racket was lower-impedance for the project discussed in that thread (and
certainly has better documentation), but seems a bit heavy-weight for embedded
use.

~~~
qwertyuiop924
Racket always seemed a bit heavyweight to me in general. I'm more of a CHICKEN
fan myself, though. You clearly are on the other side of that particular fight
(r6rs vs. r4/5/7rs) though. Which is fine.

------
j-pb
Finally something that looks like it could replace the horribleness that is
openscad.

~~~
qwertyuiop924
What's so bad about openscad? I haven't really worked with it, so I'm kind of
curious.

~~~
hobo_mark
As far as I remember, the language was severely limited, and it's yet-another-
syntax to learn for no discernible benefit.

~~~
qwertyuiop924
Ah. Yeah, I can identify. This is exactly the reason I prefer Guix to Nix.

------
gravypod
If you are interested in this kind of thing you might want to check out
OpenSCAD [0].

It's a similar idea: scripting behind cad.

[0] - [http://www.openscad.org/](http://www.openscad.org/)

------
fsloth
The references section in the github repository is short but very good:
[https://github.com/mkeeter/ao/blob/master/doc/references.md](https://github.com/mkeeter/ao/blob/master/doc/references.md)

------
mcguire
Apropos of nothing, whenever I see blue and red fonts close together, as in
the first image or my recent Spacemacs configuration, my brain tries to
interpret it as a 3-D image.

It's been years since I've seen a blue/red 3-D image, but the effect is still
there. Is it just me?

------
amirouche
Are you using a quadtree-like algorithm or filling curve? to create the mesh
or you can compute edges from the math tree of operations? or it some of both?
Otherwise said how does it approximate the final 3D.

------
ruste
This is really cool! Next time I need CAD software I know where to look. Maybe
I'll actually buy a 3d printer and start playing around now that there's a
good modeling software option.

