EPICS

Engineering Practices Introductory Course Sequence. Every student from the Colorado School of Mines has taken the two-course series, and talks about it with a slight distaste in his mouth. For some students it’s a much-needed first pass at writing reports, dressing up, speaking in front of others. (This is something I’ve actually come to appreciate about the system – its emphasis on presenting to peers.)

I remember when I took it, we were supposed to design a small device within certain (relatively arbitrary) constraints to collect a soil sample. The premise was unrelatable – that we might one day be responsible for a subsystem deployed to collect a soil sample on a distant planet, without thought about its return.

It’s become rather popular lately in certain communities to program and attach digital cameras to weather balloons and take pictures from as high up as 30km (about 20 miles) or so. The results speak for themselves:

What I found regrettable about my EPICS experience was that it was too far removed to really care about the project. It had its fun moments, and I was glad that for EPICS 2 I got to work on a project I really believed in with some friends (it was a considerable improvement). But this is an example of a project I contemplate and eye over longingly, even outside the context of a course. Similar projects can cost on the order of a couple hundred dollars and are relatively feasible, even for freshman engineers. To have something you built venture farther from the earth than any one of us likely ever will, bring back pictures and live to tell the tale would be extremely rewarding.

Had there been projects like this when I was in school, I know that my experience would have been that much more enriched.

Tagged with:
 

OpenGLot3D Video

I gave ScreenFlow a shot, and it was definitely the best screencasting tool I found. Thanks to it, I can now share a more dynamic sense of the capabilities of this plotting library.

OpenGLot3D from Dan Lecocq on Vimeo.

Tagged with:
 

I recently finished up school, and part of that was finishing up my ray tracing project. At the last minute, I implemented Gouraud shading which is a technique to try to smooth out a triangulated surface. What it really does is just linearly interpolate the normal vectors, where the normal of a vertex is calculated as a weighted average of the normals of the triangles using that vertex.

Long story short:

A render of the Stanford bunny with my raytracer without Gouraud shading.

A render of the Stanford bunny with my raytracer without Gouraud shading.

A render of the Stanford bunny with smooth Gouraud shading.

A render of the Stanford bunny with smooth Gouraud shading.

Also, thanks to an improvement in my parallelization of the problem and a speedup in octtree traversal, I was able to render the Stanford dragon model (~1 million triangles):

The Stanford dragon model.

The Stanford dragon model.

Tagged with:
 

It occurred to me today that I could render a scene several times with slight perturbations and then mesh them together into a movie. It took about 15 minutes to render on a cluster at Mines, and then about a minute to stitch together with Mencoder. At 18 frames per second, here is the result. Enjoy!

Tagged with:
 

This afternoon I was able to successfully parallelize the ray tracer I wrote for Graphics II to run on the Alamode cluster at Mines. Using 17 machines, I was able to render a 4,096 x 4,096 pixel image with 25 passes and up to 5 reflections. It took only 1 minute and 20 seconds.

Reflective spheres rendered at high resolution on a small cluster.

Reflective spheres rendered at high resolution on a small cluster.


Another image rendered on the same cluster

Another image rendered on the same cluster

For the benefit of those who are not computer scientists, this is what the input file looks like:

8192 8192
0 0 20
-1 -1 1
2 0 0
0 2 0
3 10 10 0.8
0.2
9
# These next few lines will define a triangle
T
# With one of the points at (1, 1, 1)
1 1 1
# and the next point here:
0.12321 0.12321 -1
# and the last point here:
-1 1 1
# and with this color setting
1 1 1 1 1 1 0 1 0.7
T
-1 1 1
-0.12321 0.12321 -1
0.12321 0.12321 -1
1 1 1 1 1 1 0 1 0
T
1 -1 1
0.12321 -0.12321 -1
-1 -1 1
1 1 1 1 1 1 0 1 0
T
-1 -1 1
-0.12321 -0.12321 -1
0.12321 -0.12321 -1
1 1 1 1 1 1 0 1 0
T
1 1 1
0.12321 0.12321 -1
1 -1 1
1 0 0 1 0 0 0 1 0
T
1 -1 1
0.12321 -0.12321 -1
0.12321 0.12321 -1
1 0 0 1 0 0 0 1 0
T
-1 1 1
-0.12321 0.12321 -1
-1 -1 1
1 1 0 1 1 0 0 1 0
T
-1 -1 1
-0.12321 -0.12321 -1
-0.12321 0.12321 -1
1 1 0 1 1 0 0 1 0
S
0 0 0 0.5
1 0 1 1 0 1 0 1 0.3

Tagged with:
 

Chess

For Artificial Intelligence, in order to satisfy the final project requirement, I wrote a small chess-playing agent. It’s not horrible, but it’s not going to win any awards. Still, despite its simplicity, I’ve noticed that in games against itself, it exhibits some seemingly second-order behaviors, like forks, pins, skewers and so on. I found that interesting.

I did write a text-based interface for playing against it, but it’s tedious to actually use, and so, having done well in graphics, I decided to write a simple GUI in OpenGL. You can click-and-drag your pieces to where you want them, and then wait for the computer to play. Here’s a screenshot of a game’s conclusion:

A game's conclusion

A game's conclusion

I’d like to give the piece icons transparency on the border so that you can see the underlying square, but that will be a job for tomorrow. Even as it is, I’m pleased with it.

Tagged with:
 

Memory Leak

Memory management is a notoriously difficult aspect of coding in C++. Generally, the problems one runs into with pointers is that you get rid of the data you’re pointing to while you still need it. Gdb has become a good friend for finding segmentation faults.

For those of you who aren’t computer scientists, here’s a quick explanation – we need space to store variables and information. So, one way to do this is ask the system for some space, and then the system gives back an address. Imagine mailboxes at the post office – you don’t have the stuff stored in your mailbox with you at all times, but rather the way (the key) to access it. One problem that arises when you tell the post office you don’t need the mailbox anymore, but you don’t give back the key. Someone else is assigned this mailbox, and his mail starts arriving in there, and when you go looking for yours, it’s not what you expect (this often causes a segmentation fault). The other problem is when one patron keeps requesting mailboxes, and you’re only allowed to hold one key at a time, so you discard the old ones. If you request too many, no mailboxes are left (this is a memory leak)!

At any rate, I don’t have much experience tracking down memory leaks, and so when I came across this problem, I asked an open question to everyone in the lab of the best way to do this. Someone suggested I put soapy water on my program and look for bubbles.

I ended up looking through my code for places where this might be happening, and I happened to find it pretty quickly. That’s pretty lucky.

A memory leak gets out of control

A memory leak gets out of control

We get our memory back when the program is terminated.

We get our memory back when the program is terminated.

I got gdb to seg fault!

I got gdb to seg fault!

Tagged with:
 

Halloween

I don’t think I’m alone in not having “done” Halloween since the 6th grade, but I find myself wondering if I’m too old to get candy from strangers.

Either way, I’ve decided to party up this October 31st nerdy-style. Gonna find / make myself some steampunk goggles and pick up a lab coat. I’ve been carving up LEGO mans and ordered a couple of bags of LEDs for them. If I feel particularly festive, I might try to carve a Dalek.

Tagged with:
 

Walmart Avoidance

I set out on Sunday to fix a speaker in my car that had been buzzing. I expected that I would find a wire that wasn’t well-attached or that I’d have to solder a weak point, but first I had to get to it.

When I installed a 3.5mm jack in my stereo, I was angered to find that to get to it, I had to remove most of the dash. While I’m sure they didn’t have end-user customization in mind when they designed the 1992 Toyota Corolla, it would be nice to have these things accessible. When we did the same on my friend’s car, we were able to pop a piece off and access the stereo there and then. The same with the truck we used to have. Why does it have to be so buried?

The speaker was a similar, if worse, story. Bolts that were almost impossible to access, large pieces that must be removed in unison. Parts to unscrew that, in order to access them, you’d have to remove the piece they attach. Who makes a car like that?

I appreciate the durability, though. This particular car has just under 240,000 miles on it, and if you need further evidence, check out the Top Gear episode where they try to destroy an old Toyota truck.

Two hours and countless f-bombs after starting to try to get to this speaker, I find it and bring in half my dashboard into the house. Break out the speaker to find that it’s completely eviscerated. Four inches, and all of 15 Watts RMS. Nice.

Browsed around online, but found mostly expensive and powerful speakers, so I head to Checker. Nothing. Target – nope, and Sears doesn’t do car audio anymore. They suggest RadioShack. Nada.

Someone at Checker said he got his (essentially the same speaker) at Walmart. I had been avoiding this, but lacking any other alternative… They’ve got only one pair of speakers that will work, and I’m going to have to do some time with the tin-snips. I get back, get it installed, and I have to admit, they sound a lot better than the old ones.

On a last note, it turns out that parts that are hard to get out are even harder to put back in.

Tagged with:
 

Like MacGy-ay-ay-ay-ver.

Scenario: you need to boil some water to incapacitate a guard (a hot cup of tea puts him right to sleep. Also, he’s very trusting when it comes to strangers offering him tea), and you’ve got sandpaper, two soda cans, a razor, a tuft of fiberglass insulation, a tack and a bottle of Heet at your disposal. Also, the internet to watch this metacafe video.

MacGyver StoveI had seen this before and in various design complexities, but I really like the compactness and ease of this one. I decided to scrounge up some Heet ($2.10 at a local gas station), a couple of cans, sandpaper and a razor blade (both on hand), and pull a little piece of insulation off of some that happened to be sitting in our basement.

It got surprisingly hot – I tried setting an oven rack over it with a kettle (to knock out that tea-loving guard), and it started to melt one of the bars of the rack. I expected it to be hot, but not hot enough to melt parts of an oven rack. Who knew?

Success: certainly.

Tagged with: