I suspect the world would be better if that percentage were even greater.
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.
[sourcecode lang=”C”]
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() ;
}
}
[/sourcecode]
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 Vincent
Time 6/25/2013 at 5:45 pm
Hey Mark, did you ever release this code? I’d be very, very keen to have a play with it!
Comment from Mark VandeWettering
Time 6/26/2013 at 11:25 am
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.
Comment from Vincent
Time 7/12/2013 at 5:18 pm
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!
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?