Draw or McClim May 7th, 2022
Patrick Stein

Someone helpfully pointed out that the functionality that I was looking for when I made my Draw Library already exists in McClim. I feel like someone else reminded me of this a year or two ago. I forgot to look into it then. But, I will definitely look into it now.

I had a block thinking of McClim as windowing/GUI and overlooking its screenshot and print functionality.

Making Sudoku Diagrams in Lisp May 1st, 2022
Patrick Stein

A few weeks ago, I was analyzing a Sudoku variant if the board were a flat torus instead of a square. I wrote a little paper about this analysis.

For that paper, I created the diagrams by taking screenshots of the f-puzzles Sudoku editor, pulling them into the GIMP image editor, cropping them all to the same dimensions, and pulling them into my document. I discovered a mistake that I had made throughout all of the images after I had already collected all of the screenshots. Rather than fixing the mistake by doing a new screenshot, I fixed things in the image editor instead of in the Sudoku editor.

It was painful.

So, I decided to make a way to declare a diagram and then render it so that it can be modified/corrected rather painlessly.

My initial cut at this was in CL-PDF. I realized, when I had finished, that I had only used a small subset of CL-PDF and that almost all of that functionality was available in Vecto (with a tiny bit of help from ZPB-TTF which Vecto uses already).

This was all the motivation that I needed to finally start on a project that I’ve been hoping to do for years now. I wrote a compatibility library that takes something very, very close to the subset of CL-PDF that I used in the diagram and renders it either using CL-PDF or Vecto so that I can have the output as either a vector image or a raster image.

Sudoku diagram rendered showing different marking, highlighting, and labelling options of the SUDOKU-DIAGRAMS library

I’d like to extend this sometime to also output to CL-SVG, but the way that fonts are handled in SVGs might make that impossible for most things one would want to do with text in a diagram.

You can find the library here: https://github.com/nklein/sudoku-diagrams

DRAW v0.2.20220430 May 1st, 2022
Patrick Stein

I have released a new Lisp library. This library provides compatibility between CL-PDF and Vecto so that I can render the same drawing either as a vector drawing or a raster drawing.

This library forms an almost drop-in replacement for a small subset of CL-PDF and implements that subset with both CL-PDF and Vecto.

The functionality at the moment is somewhat limited. But, it is enough to make the Sudoku diagrams that I was working on. I had originally created the diagrams using CL-PDF. Then, I went through and wrapped them in one line of code and changed all of the PDF: package delimiters to DRAW: and ta-da. Diagrams.

Diagram showing various triangles, rectangles, and text to demonstrate the functions DRAW supports.

This is the current test image. It demonstrates all of the capabilities available at the moment.

You can find the library here: https://github.com/nklein/draw

Anamorphic Fun January 2nd, 2020
Patrick Stein

I want to make some bookshelf dioramas like these ones by Monde. I also want to make some that take more liberties with the limited space available. So, I am thinking about using forced perspective to create extra depth. I’m also thinking of some designs that could use right-angled mirrors to snake height into depth.

I also want to create extra width (and height) though. Not just depth. How can I do that? I can use anamorphic illusions to make things appear to stretch beyond the edges of the box. And, I can force the viewer to only view it from the illusory angle and enhance the illusion of space if I make the diorama viewable through a peephole.

So, I started experimenting yesterday with anamorphic projection onto the inside of a narrow box for viewing through a peephole.

I used the cl-svg to create grids like this that look flat when viewed (from the correct distance) through the peephole linked above.

Then, I used cl-jpeg to create images that when printed and folded into the interior of a diorama look as if the image extends beyond the sides of the diorama.

If you print this as 72dpi and then fold on the white lines, it will look like a flat, square image with the letters AB on it when you look down into it.

Then, I combined the two.

If you print this as 72dpi and then fold on the white lines, it will look like a flat, square image with the letters AB on it when you look down into it through a 200-degree peephole.

Here is the full source code (peephole.lisp) used to generate the grid and the anamorphic images.

DIY Camera Obscura for the Eclipse July 9th, 2017
Patrick Stein

I am excited about the solar eclipse this August that will be visible across the continental U.S. I am also keen in still having retinas when it’s over. So, I ordered some solar-rated sunglasses and decided to build a solar projector.

I brushed off my familiarity with the relevant lens equations, ordered some big-aperature lenses, and put the TC Maker laser cutter to good use.

Photo of the whole solar projector

The solar projector on a railing, propped up by books, catching the sun.

Materials

Determining the Lens Focal Lengths

I bought Fresnel lenses sold as page magnifiers and glass lenses that were sold to match particular TV models. I had no real information about their focal lengths. So, I took two different steps to come up with approximate focal lengths. The first thing that I did was set up a small lamp in my bedroom at night. I then positioned the light and a white backdrop at the distance that I needed them to be so that when the image of the light was in focus, the lens was half way between the light and the backdrop.

Then, I used the equation: 1/D_o + 1/D_i = 1/f to calculate the focal length. Here D_o is the distance from the lens to the object and D_i is the distance from the lens to the image. Since I made those both equal here, then the focal length is half the distance from the lens to the backdrop.

I determined that the focal length of my Fresnel lens was about 300mm and that the focal length of my glass lens was about 90mm.

Later, I verified these numbers by taking taking the lenses outside. I placed them to focus the sun on the sidewalk. Be very careful in this step. Concentrating the sun with a lens is a great way to start a fire. That’s why I did this on the sidewalk. I verified that when the lens was at the calculated focal length, the sidewalk started to smoke.

Preparing the Telescope

So, my brushing up on my lens equations and some common sense made me think that to project the sun, I wanted there to be about 390mm between my two lenses. I still wanted to verify this before really committing. So, I cut up a cardboard box so that I could put a Fresnel lens in one end and a glass lens in the other.

Cardboard prototype of telescope

This worked out well enough and I had experimental verification of how far I wanted from the Fresnel lens and the glass lens.

Blurry photo of sunset projected on my dishwasher

So, then I started sketching out plans for the actual projector.

Photo of sketchbook drawings of rough plans

I decided that I wanted a 90-degree bend in the light path. With the bend, I can point the objective lens up toward the sun and have the projection screen set up any distance off to the side rather than having to set it up between the projector and the ground.

Once that was done, I put together plans to cut out a real box using a laser cutter.

In my first attempt, I had apparently gotten one of the pieces of my drawing misaligned. It was together enough though to do some initial experimentation. In the initial experimentation, it was really obvious that I needed to add a viewfinder.

The Viewfinder

After manually attempting to point the camera at the moon and other dim objects, I decided that I needed a viewfinder of some sort. I decided that I needed a viewfinder where you could either look through it at a dim object or line things up based on shadows from the sun. I was about to just go with a cross-hairs type pattern when I thought, now would be a very nice time to pretty it up. I searched around a bit for sun icons and stumbled upon this gorgeous eclipse icon.

solar eclipse icon

I made the front viewfinder with both the sun and the moon cut out. I made the rear viewfinder with the moon cut out and the sun just engraved. This is supposed to be a reminder that you shouldn’t be trying to line up the sun by looking through the viewfinder. You can use the viewfinder to line up the moon and you can use the shadow of the front viewfinder on the rear viewfinder to line up the sun.

Photo of the sun shining through the viewfinder, almost aligned

Final Plans

Here are the sun-projector sun-projector plans. The red lines are to be cut through. The blue lines are to be cut through if you want to build a straight-through projector. The green lines are to be cut through if you want to build the projector with a bend as I did. The yellow lines are only to be etched. Note: the entire dimensions depend on your lenses having a light path in the neighborhood of mine….. something between 300mm and 400mm. If you don’t have lenses in that range, you probably have to design your own.

Photo of projector on my railing, propped up on books

Here is an image of the sun. The projected image of the sun is 100mm in diameter. You can’t tell too much in the picture, but in real life you can see two shadow images of the sun because I am using a $5 rear-reflecting mirror instead of $85 front-reflecting mirror. Meh.

Photo of sun projected onto foam-core board

Next Steps

Next, I am planning to try to make a base in which to sit the projector to make it easier to point it at the desired spot in the sky.

l