Archive for June, 2006


Wednesday, June 21st, 2006

30th July will be the last episode, reports the BBC. Well I can't pretend that I've seen it recently or even that when I last saw it, the top 20 was really anything special, but a little part of me is sad.


Tuesday, June 20th, 2006

Got myself a pair of Shure E2c earphones, after wondering for a while about noise-cancelling headphones. I'd heard good things on the grapevine and from a coworker about the Shure ones. They seem to be working out well. They were a little strange at first, but they come with small, medium and large inserts in plastic, foam and rubber, so I was able to find a set for my comfort (medium rubber). Now I have my volume set to about 15%, and I live in my own little world of quiet sound while coding. Can't wait to see what difference they make on a plane trip.

Brain Age

Thursday, June 15th, 2006

The Brain Age tests are fun. I do well at the sudoku. However, the Stroop test (say the colour of the word, not the word) has problems with voice recognition on “blue”. It’s a bit frustrating! But every day my brain is getting better. Today I unlocked the Head Count game… count the number of people in a house, keeping track while people are going in and coming out.

a maths day

Thursday, June 15th, 2006

Since is always posting about his antics bending Maya to his will, I felt like sharing my working day. Without going into detail about what I’m working on (which is still hush-hush until it’s announced), I can say that today I did more maths than I’ve done in a long time. I wrote some code to do adaptive subdivision of a Catmull-Rom spline.

First a bit of background. Wikipedia defines a Catmull-Rom spline as “a cardinal spline with a tension of 0.5”. In slightly easier terms, a Catmull-Rom spline is basically a parametric curve given by a cubic polynomial and as many waypoints as you like. It has the nice property that the curve passes through each waypoint. Four waypoints are required to specify the curve: between any two waypoints P1 and P2 you also need P0 and P3 (the waypoints immediately before and after the segment you are considering) to calculate the curve. This also means that if you want a curve n waypoints long, you need n+2 waypoints (one extra at each end). There is also a DirectX function to calculate a point on the curve given the four waypoints and the parameter t, where t=0 at P1 and t=1 at P2.

First, I had to figure out the functionality I was after. Regular subdivision is where you step between waypoints with a regular step size. I.e. if you wanted 4 subdivision segments, your values of t would be 0.25, 0.5, and 0.75 (dividing the curve into quarters). Adaptive subdivision works differently: it takes advantage of the fact that the curve might be a straight line between t=0 and t=0.5, say, so there wouldn’t be much point adding subdivision points there – they are better used where the curvature of the spline is higher. If you want 3 subdivision points, they might end up at t=0.7, t=0.8, and t=0.9.

That’s the functionality in English. In more mathematical terms, the curvature of the line is another way of saying “how large is the second derivative?” Calculus! I had to calculate d2y/dx2. But for a parametric curve, it’s a little more tricky than usual. Most equations you meet every day on the street are of the form:

y = (something to do with x)

But a parametric equation is of the form:

y = (something to do with t)
x = (something else to do with t)

(In the case of the Catmull-Rom spline, the “something” and “something else” are in fact basically the same thing, but that doesn’t immediately make it any easier.)

Since the equations are in the form of t, we can’t immediately compute dy/dx (the first derivative – a step along the way). Instead, we can compute dy/dt and dx/dt. Then use the chain rule:

dy/dx = (dy/dt) / (dx/dt)

Fair enough – a plain cubic polynomial is easy enough to differentiate and I obtained dy/dt and dx/dt in short order. But it doesn’t stop there. What I’m really after is the second derivative, d2y/dx2, which is another way of saying I want to differentiate dy/dx. But I have dy/dx in the form of a fraction with a nasty polynomial on the bottom. I turned to the quotient rule:

let f = dy/dx = u/v
then df/dt = (v.du/dt – u.dv/dt) / v2

Again, the quadratic (at this stage) polynomials u and v are easy to differentiate. So far so good.
Finally another application of the chain rule:

df/dx = (df/dt) / (dx/dt)

And I have finally obtained df/dx, i.e. (d/dx)(dy/dx), i.e. d2y/dx2, the second derivative of the curve! All that remained was to write a loop to insert subdivision points as necessary based on a threshold value of the second derivative, do a bit of debugging, and Bob’s your uncle. I now have a nicely adaptively-subdivided Catmull-Rom spline.

But what, you ask, was the ultimate point? Well, with any subdivision, the curve is approximated with a series of straight lines. Because an adaptively-subdivided curve is more intelligent about where it places subdivision points, it can typically achieve accurate approximation of the curve with fewer points than required by a regular subdivision method. The practical upshot of which in my case is fewer polygons, fewer calculations, and therefore faster code. Every microsecond counts!

Bread news

Wednesday, June 14th, 2006

The latest bread experience in the Elbeno household is Pane Mediterraneo from Ralph’s International Classics line. I’m always partial to a crusty crust and a soft crumb.

Pane Mediterraneo 1

A peek at the inside: appropriately holey.

Pane Mediterraneo 2

New stuff

Tuesday, June 13th, 2006

There is quite a lot of new stuff in the Elbeno household this week.

On Saturday we braved the outside world for lunch once more, and perused the shelves at Borders for a while afterwards. I picked up a couple of books that I thought looked interesting.

On Sunday, our new TV arrived, so the old one (28″ Toshiba CRT) has been put to use upstairs in the “retro-console lounge”. i.e. Put into a cupboard (big fitted wardrobe) on the old TV stand with the N64 and Saturn hooked up. Yes, they count as retro consoles now… plus, they are the only older consoles I have that are 120V NTSC. Anyway, the N64 is very Henry-friendly for when he's a little older.

Second, I went to the local Target at 8am (opening time) on Sunday and along with about 10 other frothers picked up a Nintendo DS Lite. Also Super Mario Bros, Brain Age, and Big Brain Academy. And of course I already had Animal Crossing: Wild World from my birthday a couple of weeks back, in anticipation of this day.

Mrs. Elbeno also got a new office chair which will also do duty as the retro-console lounge chair. And finally I got a new pair of shoes. Brooks. A snip at $40 from Shoe Pavilion. Mrs. Elbeno's new pair will probably cost three times as much.

Windows broke my setup

Wednesday, June 7th, 2006

Well, I reverted my Windows XP x64 to Windows XP Home. Unfortunately, in the process, something in the Windows installer decided to wipe out my existing FAT32 partition (the one where I keep all my data files, mp3s, etc). I’m not sure what happened; I didn’t see any reformatting going on or anything. All I know is that after installing WinXP onto the existing NTFS partition, the FAT32 partition was no more. Both WinXP and Ubuntu reported no partition there. I wondered whether it was just the partition table info that had been wiped, so I reinstated it as before, but the disk is blank. So I will have to restore from backups – what a pain.

And I thought it was bad enough that Windows overwrote the MBR forcing me to rerun grub-install. The partition shenanigans now means that my /etc/fstab is out of date too – some partitions got renumbered. But that shouldn’t be too hard to fix – I think just /dev/sda5 and /dev/sda6 got swapped around. My partition table looks like:

1. 40GB NTFS
2. 2GB ext2 (/boot)
3. 2GB swap
4. Extended partition, containing…
5. 40GB ext3 (/)
6. 200GB FAT32 (shared data)

Quick update

Tuesday, June 6th, 2006

Apologies for the lack of blogitude lately. Let's see… this has been a fairly normal week in the life of an Elbeno. Actually, much better financially than most weeks.

  • Went to a book sale. It was very sunny so I caught the sun on the back of my neck, even though we were only there 40 minutes. Since we turned up near the end, all the books were FREEEEE! No, really. We loaded up the car boot!
  • Actually got a bonus this year! So, bought a new TV.
  • I am also going to get some money from another unexpected source.
  • Sold my WoW account online. Got $131 for it! How l33t was I?
  • Installed Ubuntu 6.06 “Dapper Drake” (x64). It rocks. The first Linux install I've had where everything just works. Regular readers of this LJ will know I've tried many distros over the years. This is the best yet, and my new recommendation to Linux newbies.
  • Installed Windows XP Professional (also x64). It does not rock even slightly. Driver support is horrible. Webcam doesn't work, VPN doesn't work. Even had to fiddle to install the WHQL-certified x64 nVidia drivers. Who knows what else doesn't work? Guess I'll have to revert – I managed to find a hacked up webcam driver (annoyingly for my other webcam without a mic), but the lack of VPN is a deal breaker.