Animated Vector Graphics on an Oscilloscope

I lost the original edit to this post. Recreated.

So, while watching the Oscars, I decided to hack together a simple little graphics program that would allow me to generate more sophisticated graphics for the oscilloscope. I ended up with 263 lines of code that implemented a simple matrix-based set of graphics commands. Eventually, I’ll add some line clipping and some other graphics primitives, but for now, it seems to be working just fine.

YouTube – Animated Vector Graphics on an Oscilloscope

To give you a taste of what the library lets you do, here is the set of commands that I used to generate the animated dial you see in the film.

Dial(double seconds)
    int i ;
    TransformPush() ;
        fprintf(stderr, "... angle %lf\n", seconds*6.) ;
        Rotate(seconds*6.) ;
        Line(0.0, 1., -0.05, -0.05) ;
        Line(-0.05, -0.05, 0.05, -0.05) ;
        Line(0.05, -0.05, 0., 1.0) ;
    TransformPop() ;

    for (i=0; i<360; i+= 6) {
        TransformPush() ;
        Rotate((double) i) ;
        if ((i % 30) == 0)
            Line(1.0, 0., 0.90, 0.) ;
            Line(1.0, 0., 0.95, 0.) ;
        TransformPop() ;

Addendum: Congrats to Lee and all the Toy Story 3 crew, and to Randy for winning his second Oscar (with twenty nominations, incredible). He definitely has had the best speech of the night so far.

8 thoughts on “Animated Vector Graphics on an Oscilloscope”

  1. Very cool Mark!

    Looks like your drawing commands are vaguely PostScript like, should be easy to use this for lots of fun thing! Asteroids on a atmega? Scope tetris?

  2. This reminds me of a trick I saw on Letterman in the mid 80’s. As the show went to commercial the shot was in the control room on a vector scope that was spinning unlocked. A hand reaches in and pushes the sync button. The scope locks revealing the written phrase on the screen “Late Night with David Letterman”. I was impressed. I was also probabbly on my 3rd margarita.

  3. Wow! Very clean vector animation. I thought that smooth CRT vector animation wasn’t possible using a sound car. I grew up playing on Vectrex consoles. CRT vector graphics are special.
    I’m very interested in the code! Is that something you would share?

  4. Hey Mark, did you ever release this code? I’d be very, very keen to have a play with it!

  5. Sorry Vincent, it was sadly on a laptop that was stolen in a robbery at my house last year. I haven’t located a proper backup, but still have a couple of old drives that might contain it, but my confidence is fading.

  6. Ah, that’s such a shame. I’m working on a project that requires exactly this right now. I’m pulling my hair out trying to figure out how to do something like this. I’m not a coder or anything…

    If you manage to locate it in the next couple of weeks please let me know. I’d try to recompense in any way I can and give you credit when the project goes out!

Comments are closed.