Daily Archives: 2/22/2007

Structure and Interpretation of Classical Mechanics

Over twenty years ago, I first read Structure and Interpretation of Computer Programs, which I still consider to be the most amazing computer science textbook ever written. I’ve known for a while that one of the author’s, Gerald Sussman has written a book on classical mechanics called (appropriately enough) Structure and Interpretation of Classical Mechanics. What’s cool is that the entire text is online. I got reminded of this while watching this lecture by Sussman on the occasion of Dan Friedman’s 60th Birthday.

I must admit that most of the physics (and a great deal of the math) is over my head, but basically he’s talking about the systematic representation of knowledge (in this case, physics knowledge) as programs, and how math becomes more tractable and interesting when programming is made part of the process.

It’s very thought provoking.

[tags]Mathematics,Programming,Physics,Sussman[/tags]

Addendum: Sussman mentioned this article by Minsky which I found a link to, and will have to read later.

Addendum2: I got the link to the video from this article on Lambda the Ultimate. Lots of other linked videos look interesting to me, I’ll be watching some of them later.

OpenGL Pitfalls, or how I wasted most of an evening…

I’ve worked on computer graphics for over twenty years now. Through some quirk of fate, I have spent nearly all of my time programming batch rendering algorithms that take minutes or even hours (days?) to render pictures. The last time I really did interactive work was before OpenGL even had the “Open” prefix, back when I was working in the Princeton Applied Math department back in 1990. So, I’m not exactly the most experienced OpenGL programmer. I haven’t written anything more complicated than simple 2D plotting in years.

So, I was working on my program that reads the accelerometers from the Wii Remote tonight, and tried to set it up to draw an airplane that I could tip and tilt using the Wii remote. Unfortunately, I couldn’t get the lighting to look right. I tried all sorts of different things, but finally decided to do a bit of research and found this page:

Avoiding 16 Common OpenGL Pitfalls

What bit me? Why, the very first thing: glEnable(GL_NORMALIZE);. It never dawned on me that OpenGL might fail to compensate for scaling before computing lighting. Oh well. Live and learn.

I’ll have some example code and video of this little hack this weekend. I want to clean it up a bit more, and I still need to shoot some video of it.

One of my first raytraced pictures

An interesting aside bit of personal trivia: the model that I am using is a model of the NASA’s X29 experimental aircraft. It’s the same polygonal model that I first rendered with my old raytracer over twenty years ago. I feel like I’ve come full circle.

[tags]Computer Graphics,Wii Hacking,Wii Remote[/tags]

Addendum: Here’s a brief blurb about the X29 from NASA.

Addendum2: Here’s a screen dump of the same shaded in OpenGL:

X29 in OpenGL