After short break I’m now following up on my previous post with the rest of the story. I was just going to post an edited version of an email I just sent (and still will) but that requires preface since that email was really a progress report on an idea I’d previously sent in earlier email (if all that sentence isn’t confusing enough).
Anyway where I left off in the previous post was that one hacking project had led to another and finally I ended up with the need to create a program that can create interesting outline shapes to step-transfer-place-and repeat for an adult coloring book of the style of highly geometric and repeating patterns. So how did that lead to what I’ll describe in this post.
To get an interesting shape: 1) could draw some, either on paper and scan, or in some electronic drawing problem – fine approach but my artistic skills are laughable; 2) I could find some images on the Net and use those but they won’t be exactly right and transforming pixel images (even high resolution, transforming, and the downsampling) produces poor results; 3) I could use some resolution-independent drawing program, e.g. Adobe Illustrator (if it’s still called that, been a while since I looked at), but that again takes more skill (and patience, to move all those handles on Beziers); 4) I could write my own program, just focused on shapes (got part way through the specs on that plus some POC in Photoshop); or, 5) I could do something easier for me and an interesting digression to boot to let math do the work.
So I chose #5 and here’s why
Way back in the dark ages of technology when I was a freshman at MIT an upperclassman EE was fiddling with some gadgets, in particular an oscilloscope and some signal generators. I have no memory whether he was just playing (common activity among us geeks to fiddle with gadgets just for fun) or some coursework or what. But I was blown away. The signal generators (just controllable wave generator, aka oscillators) were being fed into the independent inputs of the oscilloscope and wavering figures were dancing around on the screen. Turn a knob and the figures instantly changed (digital computers of the era would take a week to do the computations analog was doing instantly). Interactive graphics! Of course this had some useful value to an EE as instrumentation but those dancing electron beams hitting phosphors in the CRT absolutely grabbed me and I’ve been a graphics nut ever since. In that time it would have been impossible to even visualize digital graphics of any kind (much less interactive) and utterly inconceivable to imagine what we can do today, what I can do on my very PC and by my very own programming (now almost as fast as that analog stuff was 50 years ago).
Now the math of what was going on was actually fairly simple, high school level trig and analytical geometry, esp. understanding polar rather than rectangular coordinates. But despite having that math (kinda a prereq for getting into MIT) I had no connection with chunks of clunky (and hot, still a lot of tubes in those days) hardware. That a signal generator was doing fairly simple math was unknown to me. In fact, the idea that some physical thing could create fast-changing patterns of light I could see, for the EE a way to visualize signals, for me a way to visualize math, was astonishing. And having accidentally discovering that fire I wanted to learn how to control it, how to make patterns visible out of pure thought and electronics. We’re jaded to sensational graphics today so it’s hard to appreciate what it’s like to see electrons converted into light in those early days – the power of it. People list the printing press as most significant invention ever (in terms of its impact), but I’ll take graphics. Now years later, when I actually built an oscilloscope for myself (a Heathkit, despite not being an EE I’d begun to fiddle with hardware and needed one and a real one was pretty pricey) and then I understood a lot better what it did (could have figured it back at MIT but I was materials science major and EE was alien world to me). Then, of course I just happened to get my first real job at a little startup in Palo Alto that had gotten going by developing a very clever (VCO – Voltage Controlled Oscillator, i.e. simple tunable signal generator) and those two guys started a company that was great until Carly Fiorina wrecked (couldn’t resist a little politic rant), otherwise known as Hewlett-Packard (yes I knew Bill and Dave personally and to paraphrase Lloyd Bentsen from a politic debate – Carly, you’re no Bill and Dave).
Anyway it took a while (plus some time for any kind of interactive graphics to evolve) before I really understood what that EE was doing to make those wonderful dancing patterns of light.
Being a digital type, rather than analog, though I had to do it one better. I’ll give some examples in my next post (the email that was supposed to come now) but the basic idea is this: a) create some periodic (sine wave being the simplest) repeating pattern (voltage vs time), b) manipulate it a bit (like filters or modulating with another periodic function), and, c) feed it into the x and y inputs of the oscilloscope whose electron beam is independently move, in x and y, by the varying voltages of the signal. Now of course an oscilloscope is designed to handle varying signals at fairly high frequencies (kilohertz back then, gigahertz today) so actually it is drawing the same pattern over and over, thousands or millions of times per second (hence no new for video RAM and screen refresh, plus also incredibly instant response to changes in the signals).
But with a few for-loops, a few library math functions, and a simple plotting package now I can (or could even decades ago when I first did this) generate some interesting periodic functions to draw those ghostly images on my screen (even with fast multicore Ghz process still not as fast as the analog did 50 years ago).
btw: forgot to mention these figures on the oscilloscope are known as Lissajous and they have various characteristics based on frequency and phase of the input signals. They’re useful tools to EEs (as well as common props in old B&W scifi movies since they could be filmed in the background jiggling around and look scienc-y) but they’re not that interesting as graphical elements.
So my simplistic idea (now repeating and expanding) was that the normal parameters of waves (or combinations of waves), i.e. frequency, phase and amplitude could themselves be the output of some other signal generator which would make the dancing patterns on the oscilloscope even more interesting, maybe even “pretty”.
Now another thing I did learn about hardware, in my very limited hacking, was the old TI TTL handbook approach to digital design. To get rid of many of the messy real world problems TI engineered their parts so the output of one could easily be the input to another and vice-versa. Thus you could build a fairly complex circuit (before gate arrays became so easy to do this) with wiring together building blocks. A key element, of course, was a common clock.
So that’s what I set out to do in software. Build simple fundamental building blocks, with consistent inputs and outputs (plus a few math functions to do a little conversion, still need “glue” in any circuit to adjust something). So, for instance, a sine wave has frequency, phase, and amplitude – just numbers. Usually frequency is expressed as a multiple of some reference clock (thus allowing all the signal generators to sync, or in digital terms the increment of the for-loop can be fed to all components). But what if the frequency itself is the output of some other signal, for instance, a sawtooth wave (actually to be interesting has to be the inverse and also added to some other value). This means, that in multiple cycles of the sine wave its frequency decreases and thus its period (the more visual element) gets longer, i.e. other, over time the wave stretches out (there is a famous op-art piece based on this idea). Likewise amplitude can vary so a small higher frequency wave added to a DC bias (i.e. constant) amplitude would create, what one CalTech guy called, garbage can coordinates (i.e. those ripples in the circumference of an old-fashioned metal garbage can).
And so forth, outputs created from mathematical functions feeding inputs to other functions feeding input to other functions – complex dancing patterns of light appear on the oscilloscope, or in my case, more slowly on my flatscreen after a lot of digital number crunching.
So that’s the basic idea (and see the previous post for a couple of quick examples from my yet incomplete program),
Now I actually wrote this kind of program decades ago, when the only graphics device I could access was this awful photographic “printer” (i.e. basically a CRT generating light that got recorded in the light sensitive paper (since a RAM video buffer, back then, would have cost a small nation’s GDP). The machine wrote the “image” and then developed it (hence the stink of chemicals) and once a day I could get results (remember batch computing on mainframe, quaint, eh, but it forced you to be very careful not to make mistakes rather than debug through daily builds and test suites). Furthermore, I can probably admit this now without fear of prosecution – I wasn’t supposed to be doing this and it was expensive! I had a job where I was inventing a lot of different ways to present data to an administrative group at MIT. Fortunately that meant I had a fairly large budget for “real” work. But of course before I could make my 3D bar charts visualizing business data I had to learn how the technology worked – right, so try drawing a few goof-off pictures first.
So I actually managed to create some vaguely interesting images (if you were a low-grade op-art fan and technogeek) and that was the end of it.
So I’m revisiting an old idea, undoubtedly with a ton better execution (if nothing else a lot faster turnaround) but, of course, for an equally useless purpose, i.e. just playing around. Maybe I’ll figure out how to generate some interesting shapes to fit in a mandala or tessellation, but more likely I’ll just be playing. But that’s what retirement is for and at least this time it’s on my budget (more time and the equipment).
Now I’m not sure how much I’ll rewrite that email I’m going to post but I’ll present one more basic idea. To compose figures from wave functions means a lot of trial-and-error, guessing what combinations might be interesting. To do that in conventional C# programs, while actually fast for trial-and-error (thank you Microsoft, Visual Studio is amazing) is a bit difficult. So as one guy in my past life said “all projects end up inventing a language”. So instead of changing the C# program I want to feed in easy to change “parameters” and “programs” that are then interpreted by the C# program (i.e. drawn, with a few controls over general execution parameters). Fiddle a bit, get an answer (quickly), fiddle some more – no changes to the code itself just my little feeble input “language”.
Now I actually know how to write compilers and/or interpretors and that is boring as toejam to me (not going to mess with yacc, sorry Brad wherever you might be). I want to focus on graphics instead, so I invented the world’s stupidest language (borrowing somewhat from Dartmouth Basic, the same trivial language Gates got rich implementing on Altairs). Hey, I just want those same knobs the EEs had on signal generators and same kind of instant (or nearly instant as an Intel processor and C# code and .Net drawing code can produce).
So that’s the background and hopefully a vaguely interesting story. In any current “kiddies” (i.e. overpaid hackers in Silicon Valley startups figuring out more things to put ads on my phone) read this you’ll be lost as much of what I’m talking about was before you were born. But don’t just think I’m an old fart and out-of-date, I’ll go toe-to-toe with you any day. I actually hate the term ‘coding’ because it’s such a stupid mechanical task and such a tiny part of inventing software but it’s treated as almost magical in today’s world, even by those who do it for a living and should know there is a lot more to software than coding (of course, many of you think systems administration is computer “engineering”, so all you kiddies are the product of grade inflation and title inflation (hey I really did have title of ‘architect’ and was doing the same job I’d done for decades, but then I was NEVER a ‘coder’). Just another OOB rant, can’t restrain myself entirely.