# Emulator for Magic Designer

Magic Designer is a precision instrument made out of metal with precise measurements. But more importantly, it is a toy which can produce a multitude of pretty designs on paper. At the age of 10 in 1966, I got it as a present. I have emulated this instrument on the computer in a MS Windows application. The purpose of this website is the following:

• Describe how to use the real Magic Designer.
• Describe how the real Magic Designer actually works.
• Describe how I emulated the drawing using a computer algorithm using high school level mathematics.
• Describe the tools I used to program the computer application.
• Describe how to use my computer application. This section serves as online help. I will include tips and extra stuff.
• Describe the differences between the real instrument and the computer application, with the emphasis on how the computer extends on what is possible.
• Show where one can download the computer program with or without source code. Invite people to contact me with bugs or suggestions.
• To add additional applications as I write them. I am planning to start the emulation of the famous toy Spirograph.

Using the real Magic Designer is about drawing designs on paper. The paper provided is circular paper, which is notched to be inserted securely in the notches in the center area. There is a pair of arms, with holes on each arm, connected at one end. It is similar to a pair of scissors. However, at the place of connection is a holder for a pen or pencil. To specify one design, the user places the arms onto pegs on two smaller gears. The holes are marked with letters from A to R. 'A' produces the longest arm, and 'R' the shortest. 'J' gives an arm length closest to the center of the paper. The left gear is placed according to a shift lever which can be set. This lever is in numbers from 10 to 70. So, the user will specify a design with two letters and a number. For example, 45BC means insert left arm at hole B onto the peg on the left gear, and insert right arm at hole C onto the peg on the right gear, and slide the shift lever to 45. The shift lever has a metal thing you push down to slide, and once a number is selected, one lets go and it locks into place. The number 70 gives the maximum distance between the two gears, and the number 10 gives the minimum distance. To do the actual drawing, the user places two fingers in finger depressions near the place that the arms are connected, and provides light pressure so that the pen or pencil point is in contact with the paper. Then with the other hand, the user turns a crank handle, which in turn moves the center containing the paper, which also moves the two gears. It takes a full rotation of the center to complete the design. One will typically draw several (3-5) designs on one paper and be satisfied with the result. But there is no real limit to the number of designs one can place on one piece of paper.

I had to refer to alot of the hardware of the real Magic Designer to describe how it is used. But from this point, I will describe the hardware of its internal mechanisms, and no longer mention the hardware related to the user (such as how to move the shift lever).

There are actually 3 gears which I will call center, left, and right. And the shift lever actually measures degrees (360 being a circle). A 4th gear of the crank handle is part of the user related hardware. The shift lever is connected underneath to the left gear. Being able to emulate magic designer drawing on the computer required a precise measurement of the hardware. So, I am now jumping ahead a bit by saying that I am treating this designer as polar coordinates. That means that the center of center is the point (0,0), and 0 radians (and degrees) is to the far right, and goes in the forward direction counter clockwise. I came up with the following measurements presented here as a list:

• Diameter of the center = 6 inches
• Diameter of the left and right gears = 1 inch
• The length of the arms = 5 3/4 inches from hole A to the place of joining of the arms. The measurement for hole R is 1 1/2 inches. [ By the way, R is slightly more than this, since the holes in the arm go straight down the arm and are not angled to the meeting point. I have not calculated this distortion. ] What is very important, is that the letter J is designed to be at the precise center of the center. At 3 1/2 inches, that is the distance from the center of the center to the center of the gear (s). Of course, the distance from letter to letter is 1/4 inch.
• The distortion mentioned above has been accounted for in the 2009 version. Measure the distance between the center of the holes on the arms when the arms are closed together (not being used). It comes to 5/8 inch.
• The polar angle in degrees of the right gear is fixed at 315.
• The polar angle of the left gear is 225 when the shift lever is 70 and 285 when the shift lever is 10.
• The distance from the center of the left and right gears to their pegs is 3/8 of an inch.
• Another important measurement is the relative angles of the pegs. What I mean, is that when the center rotates so does the gears and the pegs move around in a circle. So what I did, was say that if the right peg is at 0 degrees and the shift lever is at 70, I found that the angle that the left peg makes on the left gear came to exactly 270 degrees (the down or towards me direction).

Finally, in addition to this hardware are two fixed pegs known as circle studs. If the user places the left and right arms onto the left and right circle studs, a circle is drawn on the paper. If the user places one of the arms on a gear peg and the other on a circle stud, other designs are possible. I have mentioned this in the user section. But the existence of these circle studs helped alot in the mathematical understanding of the parameters of the instrument. For the purpose of this section of this document, the measurements are:

• The right circle stud is at 0 degrees and the left circle stud is at 180 degrees. These are analogous to the angles of the gears mentioned above and not the angles of the pegs. Since circle studs are not on gears, one has to imagine them to be. One considers the peg angles to be 0, as well as the measurement from peg to the center of imaginary gear to be 0.
• The distance from the circle studs to the center of imaginary gears is 1/4 inch. This means that the imaginary gears diameter is 1/2 inch.

It is important to recognize, that the ratio of sizes between the gears and the center determines the symmetry of the designs. In the case of the Magic Designer, there is 6 sided symmetry, which is the same as the Star of David or a snowflake.

To emulate the drawing on the computer, I thought of it as sampling points and connecting the dots [later on I decided not to connect the dots, and in 2009 the dots are connected by bezier curves]. The main intermediate goal for finding a point is to figure out where on the paper the arms intersect. A standard design takes one full rotation to complete, so that is 360 degrees. So, samples are taken which correspond to a fixed fraction of that. For example, on a very slow computer in my first emulation on the Atari computer, circa 1981, I took 360 samples. And in my computer application, I have decided to sample 18000 times (or every 1/50 of a degree). In 2009, only 120 samples are needed (360 in Fine mode). But between each sample is a bezier curve which has its own internal algorithm to draw, and roughly corresponds to 150, so one can still stay 18000 samples. Obviously, the place on the paper is changing in a very dynamic way. In fact, it is based on trigonometry (sines and cosines).

The first step to determining the design in the algorithm, is to know the starting parameters, which are a combination of the hardware measurements and the user's particular design. The shift lever controls both the starting left gear angle and the left peg angle. The letters of the arms specifies the arm lengths. It is the movement of the pegs relative to one another that produces the design itself. That is why circle studs only make circles.

Set up the relative coordinate system. There is a center circle, so I will assign 0,0 to the center of that circle. And according to the rules of polar coordinates, one can assign 0 degrees or 0 radians to the right direction, and angle increases going counter clockwise.

The rule of this device is that there are 2 circles, which I will call gears, which rotate when the center circle rotates. One of these gears is fixed always, since there are 2 gears and one can say that the other is always relative to the first one. And there is a place on the rim of the center circle, called angle gearR, at which it is placed. The other gearL has a starting point for any particular design, and this is called angle gearL. The shift lever, which is connected underneath to gearL, which is calibrated in degrees and labeled from 10 to 70, gives the starting point of any design.

Angle gearR is 315. The shift lever of 10 is at 135 degrees. The shift lever at 70 is at 75 degrees. It just so happens that a shift lever of 10 is directly opposite to the angle gearR. The angle of gearL is 150 degrees more than angle of the shift lever, due to that underneath thing.

On both gears is a peg. The distance of the peg from the center of the gear determines the amount of movement in the design.

Since gearR is fixed, and the gear rotates, one can decide to stop it when the peg on gearR, which we will call pegR, is at an angle of 0. On the mechanical device, the gears cannot be physically in the same place. However, on the computer they can be. As we will see, this makes for some interesting ideas. The point of this, is to determine a starting angle for pegL.

This is a hard way to do it. So, from observation, I have found that when the shift lever is at 57, angles of pegL and pegR match. The interesting thing about gears, is that it takes around 52 degrees for the pegs angles to go back in alignment. One can see that by looking at the pegs at shift lever 70. Angle of pegL is 270 when the angle of pegR is 0. This seems correct, since the designers of this toy seemed to have done things with sensible numbers. In 2009, this was changed so that Angle of pegL is 45 when angle of PegR is 135. This change has the effect of simply holding and rotating the circular paper. So physically it does not matter, but on a computer screen it does matter.

To summarize, we have these values for the precise measurement of the hardware:
Radius of center = 3
Radius of gearR = 0.5
Radius of gearL = 0.5
Angle of gearR = 315
Distance of pegR from center of gearR = 0.375
Distance of pegL from center of gearL = 0.375
Angle of gearL = 315 (gearR) - 180 (seen on other side of gearR) + 10 (an arbitrary number they use) + 150 = 295 - shift lever value.
Angle of pegR is assigned 0. This indicates an arbitrary start of the drawing of the design with the crank handle.
And finally, Angle of pegL = 270 (when shift lever is 70), or more accurately 270 more than the angle of pegR.

As one turns the center circle with the turn crank handle, it rotates, so we need to decide where in space we are located. The goal is to find the point where the arms intersect. We have not yet discussed the arms.

There is a set of 2 arms with holes down the lengths which are placed over the pegs for each design. This in effect allows one to make arms of any length (within reason). The length of the arm when hole A is in a peg is measured as 5 3/4 inches, and for B it is 5 1/2 inches, and so on. The last letter is R, which is 1 1/2 inches. When one gets to R, there is a mathematical distortion because these arms do not get thinner as they go from A to R. The formula to calculate this is from Larry:

`True arm length = sqrt(5/16"^2 + (5 3/4" - (X - "A")*1/4")2)`

A pen is placed in a holder at the intersection of the arms, and it writes on the paper. As the crank is turned, this causes the entire coordinate system to rotate. The rotation direction is very important. Basically, if the rotation angle is increasing, the angles of the pegs on the gears are decreasing!

This discussion is continued with the math which can be found: Programming the Magic Designer

The Magic Designer is one instance of a complex curved shape generator. A CCSG. There are different classes of CCSGs. To define the class in which the Magic Designer belongs, look at the parameters which were measured, and vary them. But an underlying structure remains, called degrees of freedom. The following are degrees of freedom for this class of CCSG, with comments for the actual physical device added:

• The ratio of Center to GearL. Fixed at 6x1.
• The ratio of Center to GearR. Fixed at 6x1.
• The relative angles between GearL and GearR. Some. Degree increments in a 60 degree window.
• The ratio of the size of GearL to the distance of the peg on GearL to its center. Fixed. Note one can imagine a hardware where these pegs extend outwards on planks beyond the size of the gears.
• Same for PegR and GearR.
• The relative angles (for arbitrary starting point) between the two pegs. Fixed.
• Length of left Arm. Some. Sub increments over a range.
• Length of right Arm. Some. " "
• Actual size of the Center. Fixed. This only is relevant when combining several designs on the same visual space.
• Placement of the Center. Fixed. " "
• Thickness and Color of the Pen. User. There are other user parameters one can think of as well such as background color.