Math is hard

I spent the whole weekend trying to get some DAFIF boundary and special use airspace data into my waypoint generators. It’s something I promised Kevin from Flight Master a while back.

Well, it turns out not to be all that easy. Part of the problem is simplifying the data from the formats that DAFIF provides it into something that I can put into a relational database and then spit out in a format that Flight Master can use. But the problems I spent most of the weekend on are doing spherical trig. The DAFIF data defines arcs two ways – either as the center point, radius, direction and the start and end bearings, or as the center point, radius, direction, and the start and end points. Flight Master wants just the former, so I have to detect the second case, and use one of the formulas in Ed Williams’ Aviation Formulary to find the bearings, with a little help from "use Math::Trig;". A couple of places, the DAFIF data gives both definitions, which is useful to test my implementation. So that problem was solved.

Now comes the other problem – the one that I spent most of Sunday on and still haven’t solved: How to find the actual geographic extents of circles and arcs. For circles I can go back to the Aviation Formulary and project from the center the radius at 0, 90, 180 and 270 degrees. I’m sure there are wierd cases near the poles where that doesn’t give the actual extremes, but to hell with it, this is as close as I’m going to get. BTW: This is where the intrepid hero discovers that perl’s “%” operator only works on integers, and after kicking himself over the wierd results for a while writes his own “mod” function.

But discovering the geographic extents of an arc is harder. I still haven’t licked it – I think I’m going to have to look at the arc’s start and end bearings and directions to determine if it does through any of the 0, 90, 180 or 270 degree bearings and project them as I did for the circle, otherwise use the end points. Doesn’t sound so hard, does it? And it probably isn’t.

The next challenge will come when I try and produce a geographic index, either using grid buckets (Kevin’s choice) or quadtrees (my choice). To do either of those is going to require proper data structures, and nested data structures, and doing this sort of thing in perl is … sub-optimal. I’d much rather use a language that has proper data structures – even a “struct” declaration in C would suffice. But my web host doesn’t have Java, and I don’t know python yet, and I don’t particularly want to delve into the mysteries of doing ODBC in C or C++, so I’m probably stuck with perl.

Wish me luck.

Send me money!

This guy is either really really clueless, or has… nah, he’s just really really clueless:

Rent A Coder – Build me money making website please


Description:
I would like someone to build me a good website that will make me around $1000 a week or more. The website should be useful and not have any popups. I would like you to design the whole entire website. The content as well. Would like the website to have a lot of traffic as well.

Thanks to Baz for the link.

Best feature ever

My new 17″ PowerBook arrived today. Vicki knew I couldn’t wait, so she phoned me while the FedEx guy was still there and I rushed home to get it. It’s the most beautiful piece of computing hardware I’ve ever seen in my life.

Apple has put the coolest feature ever in it, because the beauty of their OS. After I’d decided to order it, I was making mental notes of what to do to transfer everything I need off the old one onto this one. But a friend clued me in: I didn’t need to bother. Instead, when I booted it up, it asked me if I was upgrading from a previous computer. I clicked “Yes”, and it said to connect a firewire cable betwen the two computers. I did, and then it said to boot the old computer with the “T” key held down. It took me three tries, because the first two times I did a “Restart” from the menu – when I took Rob’s advice and powered it down and then booted with the “T” key, I got the Firewire logo on the screen on the old Powerbook, and the new Powerbook recognized it. It showed me all the user accounts and gave me the choice to transfer any and all of them, settings, applications, and “other files”. I chose them all, and went to lunch. When I came back, the transfer was done, and it’s amazing – even the files are arranged the same way on my desktop.

I’ve tried a few of the most important applications and they work fine – Quickbooks has all my account information, Photoshop Elements works, Firefox complains that it can’t reach my home pages (no network connection here at work). A couple of problems – PostgresSQL seems to be installed but not started up (and I can’t remember the PostgresSQL password), jikes isn’t installed at all (although fink is, amazingly enough), the kernel module that maps the caps lock to control doesn’t load, and X11 doesn’t start. Shouldn’t take long to fix those things up.

All I can say is SWEEEEEET. I’ll probably put some pictures of it up on my picture gallery soon.