2016-04-09 Choosing the unit turning angle

I think this is one of these tiny details which make the UX better or worse, so let us look a bit into this issue: what should be the “unit” turning angle for the turtle?

(Formally, the issue is moot, because I want to make it configurable anyway. But I wanted to explore the possibilities, if only to decide which one to make the default.)

First of all, recall that in classical Logo, you just supplied the angle (in degrees). That’s fine, because it was keyboard-based anyway, so the overhead of writing RIGHT 45 instead of just RIGHT was really tiny. Plus, you could write RT anyway, or define your own procedure for turning, say, 45 degrees. (Also, Logo had a slight problem with variable-arity functions: since it was basically a parentheses-less Lisp – however strange it sounds! – each function should get the exact number of arguments it expected. On the otherhand, you could get around that by actually putting the function name and its arguments in parentheses, like [PLUS 1 2 3] as opposed to plain PLUS 1 2. AFAIR, there was no way to define a function behaving like that, though.)

But here we have a touch screen, and entering any kind of data other than positional ones (including choosing one of a few possibilities) is a PITA. So I decided rather quickly that both going forward and turning should have some basic “unit” value, and only its multiples should be allowed (in the simplest possible way – by means of repeatedly executing the same order for the turtle).

For going forward, this doesn’t really matter too much, at least unless I implement a spherical-geometry turtle. (This is not as far-fetched as you might think. Just remember your topology classes, where they told you how to obtain the classical two-dimensional manifolds, like the sphere, the cylinder, the torus, the Klein bottle, the projective plane or the Möbius strip by just taking a square and identifying its sides in various ways. What, you didn’t attend any topology class? Seriously? How could you miss out on so much fun?)

Turning is an entirely different kind of beast. Unlike distances, angles have a “natural” unit (the radian). (For the sake of simplicity, I’m going to use degrees from now on, but the point is still the same: you can change one centimeter into two centimeters by just scaling – homothety if you like fancy terms – but no such simple transformation changes 30° into 60° consistently.)

There are quite a few natural candidates for the unit turning angle. First of all, it seems only natural that it should be a divisor of 360 (so that I can actually make a full turn) or even a divisor of 180 (so that I can make a U-turn). Also, while 180/7 is perfectly natural judging by this criterion alone, somehow we feel that it would be a bit strange – we’d rather expect “typical” angles, for instance ones present in an equilateral triangle or a right-angled isosceles triangle and their multiples. (OTOH, just think about it: you could use such a turtle to construct a regular heptagon. Take that, Gauss! Note to myself: make weird settings of the unit angle possible for advanced users!)

This leaves us with just a handful of candidates: 30°, 45°, 60°, 90° and 180°. Which one should we choose?

First of all, 180° yields only rather boring drawings, so this can be excluded immediately. My next choice was 45° (and that is what I implemented at first), but it turned out to be a very bad choice. Why? Because in the context of drawing, you really want to be able to make closed curves, and – as Pythagoras noticed long ago – having 45° as the turning angle makes it very frustrating at times. So: 45° is good only for “advanced users”. (OTOH, what about using 45°, but making the distance traveled dependent on the current direction? Possibly interesting, but might not work well if a function is invoked with different directions. Food for thought.)

OTOH, 90° is best from this standpoint – but having only horizontal and vertical lines feels kind of limiting. Good as the easiest choice, but not enough for nicer pictures.

This leaves us with a very interesting choice: 30° vs. 60°. Here’s the thing: 60° is probably the best for making closed curves, but you can’t make right angles with it. OTOH, 30° makes right angles possible, but you could again find it a bit frustrating to make a closed curve if you lock yourself closer to the starting point than the unit distance. What should I choose?

My gut feeling is that 60° should be the default. Maybe it’s because I’m a boardgamer, and so many boardgames are played on a hexagonal grid…

So, today I’m changing the default unit angle to 60°. Good-bye, horizontal lines! See you back when I implement choosing various units;-).

CategoryEnglish, CategoryBlog, CategoryMakeYourselfKnown