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.
void
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.) ;
else
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.
Comments
Comment from Mark
Time 2/28/2011 at 4:45 pm
Actually Alan, both of those have been done.
http://www.youtube.com/watch?v=w03dO0Hd660 (admittedly not vector)
Comment from Isaac
Time 7/5/2012 at 5:22 pm
Sorry I am a beginner what language is this code?
Comment from Lee
Time 7/6/2012 at 8:54 pm
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.
Comment from Henk
Time 3/21/2013 at 4:27 pm
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?


Comment from Alan Yates
Time 2/28/2011 at 2:17 pm
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?