Finally, some terrain

I finally got some terrain rendering. Pictured above is the 7.5 minute data for hills just north of Corvallis.

The complete 7.5 minute quad is about 1.3M vertices ~= 2.7M faces. I know this is a lot, but I didn’t think that it would be too much for my graphics card to handle (Ti 4600). Apparently it is, because at full-resolution this scene only gets about 1.5fps. If I bump things down by sub-sampling the elevation data at every-other point I get about 8fps, and at every third sample (what you see above) I get about 30fps.

The data comes from USGS SDTS files. I finally bit the bullet and went with SDTS because a) it’s the new format (new as in after 1996) and b) it’s the only format you can get 7.5 minute data in for free. The USGS doesn’t have it on their site, but if you fight hard enough and create a fake registration account you can get it for free from mapmart.com.

I’m parsing the SDTS files using sdts++, an open source package from the USGS. Earlier I complained about sdts++, but after using it some more it ain’t so bad. Its one major downfall is its heavy reliance on RTTI and C++ exceptions. For debugging I just compiled it right into my program and ate the performance hit so that I could catch the exceptions. I need to figure out how to segment it into a library so I don’t need to have RTTI going in the main app.

Todo: I really want to get some orthoimagery and try and do an overlay. I think that would be badass. Real-time weather data and cloud rendering would be neat too.

On building sea ferries

“It’s exactly the same thing as the Internet, but we’re moving butts and boxes instead of bits.”

Timothy Dick, chairman of Hawaii Superferry Inc

USGS Mapping Software: DLGV32

A few years ago, after I bought my GPS, I got into map making and map software. There’s a lot of data available for free from the USGS. They don’t make it easy to find, but it’s out there if you look hard enough.

One of the free viewers of USGS data that was available when I was doing this years ago was DLGV32. DLGV32 was originally written by a USGS employee in the mid-90s. This employee then left the USGS and started selling DLGV32 “Pro” himself. You can find his commercial version of the program online for $219 at GlobalMapper.com.

Since I was last making maps, something must have happened with DLGV32. The “Pro” version is now available from the USGS (link above), along with the source code. I’ve since become interested in mapping again so I thought I’d try out the source code.

Impressions of the source code:

  • The DLGV32Pro source is dated March 2005 but is built using MSVC++ 6. ???
  • Here’s something I’ve never seen before: debug symbols were explicitly turned off on key files. It took me a while to figure this out.
  • The shipping source available on their website won’t compile, it contains trivial typos that prevent it from compiling.

It’s as if they want to discourage you from compiling and exploring the source code. Hmm.. could that be because there’s a former USGS employee trying to sell a commercial version of the same program??

Footnotes:

There are libraries available to parse USGS map data, like data in the STDS format. One of these is the stds++ library but it’s built to compile on the MSVC++ 6 version of STL, which is a mess. I don’t feel like bringing it up to VS.NET2003.

The USGS Seamless Data Distribution website is a good place to get vector data, like roads, railroads in DLG and SDTS formats.

MapMart.com has 7.5 minute super high resolution elevation maps available in SDTS format.

The EROS Data Center keeps on their ftp site 1:250,000 scale digital elevation map (DEM) files. 7.5 Minute data is also available, but I can’t find a user-friendly index so you have to guess from the file names. DEM is by far the easiest file format to deal with. I’ve managed to figure out the format myself, but I’m still looking for a good tutorial on how you’re officially supposed to deal with the file format. The official specification is amazing verbose while still lacking the essentials necessary to get started parsing the format. A grammar would be a nice start.

Dance Dance Diet

I think this is the second time I’ve blogged about this, but it’s back in the news again: Dance Dance Revolution as a weight loss program for kids.

I used to be all about DDR, but I can’t play it anymore. DDR and snowboarding were major contributors to the downfall of my knees. I’m not sure it’s wise to recommend repetitive impact activities like this as part of any exercise program, let alone for weight loss.

Maybe on the lower levels where you’re just walking around the pad DDR is OK, but when you get better DDR becomes a double-time, high impact step aerobics routine nightmare. It’s a lot of fun, but it’s also a lot of jumping and landing at odd angles. If you’re already overweight the impact would just become worse I would think.

I’ve met two other people that also blame DDR for screwing up their knees, especially the arcade version, where you play on a hard surface with shoes on. It’s even worse for your knees than the home version.

Long live Stepmania.

Macros with variable length arguments in C

I want to do a simple logging hack, so that I can turn on and off debug information in this app I’m working on by just adjusting the log level. log4c does this, but they don’t claim Windows support and I’m too lazy to untar their source.

A simple solution for logging in C would be to just create my own printf basically that takes a log level as an argument and then passes the arguments onto printf based on the log level passed. I’m too lazy to implement anything tho..

An even simpler solution would be to just set up some #define’d macros that map debug calls to printf’s based on the log level set at compile time. OK, this I can handle.

In order to call printf and retain printf’s variable number of arguments stuff however, you need to be able to write macros that support a variable number of arguments. According to this page “variadic macros” weren’t standardized until ISO ’99 C. Since VS.NET uses some strange unknown variant of C, I would need to find a workaround that worked in VS.NET. (Truth: VS.NET might very well support ISO ’99 C, but I’m too lazy to figure out how to enable it).

So here’s how you do variable number of argument macros in VS.NET, taken from this post:

#define myprintf ::printf

This simply aliases the printf() function to myprintf(). To do log level debugging, I did something like this:

#ifdef LDEBUG_FINE
#define debug_fine ::printf
#else
#define debug_fine 1 ? (void)0 : ::printf
#endif

This maps debugf to printf when LDEBUG_FINE is true, otherwise it removes calls to debug_fine.

I think. Anyways, it works, and, well, I’m too lazy to figure out why. I have real code to be writing. ๐Ÿ™‚

Monitor switching PC laptops

After using a Mac laptop for so long as my primary laptop, I have to complain about how my new PC laptop does monitor switching.

On a Mac laptop, monitor switching is extremely simple. You just plug in the new monitor, the Mac detects it automatically and does the right thing. If it’s a VGA or DVI monitor it automatically extends your desktop to the new monitor. If it’s a TV it automatically does video mirroring. If you don’t like the defaults, you can easily change them using the monitor drop down in the menu bar.

What the Mac does even better here is it *remembers* your desktop configuration the next time you plug in the same monitor. If you plug in an HP LCD for example and set up video mirroring, it does video mirroring whenever you plug in that LCD. If you plug in a Sony CRT and set up an extended desktop, it rememebers that and goes back to that configuration whenever you plug in that monitor.

My PC laptop is completely braindead in this department. I’ve got two different environments I my PC laptop in: standalone, and docked to an LCD. Standalone I obviously want the built-in display to be the default and the external display disabled. Docked however I want the internal display turned off and the LCD to be the primary, and I want the resolution to change to match the LCD.

My Mac does this fine, but on the PC I have to go into the “Display -> Advanced” everytime I dock the thing. I finally figured out that the ATI driver allows you to set hotkeys to switch between monitor configurations, but I’ve found it doesn’t always work. Some times it will switch the desktop configuration correctly, but then we I bounce into 3D mode the 3D graphics appear on the old monitor. Ooops. Plus, I shouldn’t have to do the hotkeys. The PC knows when it gets docked, so why can’t it do it for me.. like a Mac? ๐Ÿ™‚

Answer: It’s not a Mac. ๐Ÿ™‚ Sigh.

EverQuest 2 Trial

Sony and FilePlanet are running a deal right now where you can try out EverQuest 2 for free. Unlike other trials, there’s no time limit–you’re merely constrained to one location in the game and you can’t take your character past level 6.

I downloaded the trial, and I have to laugh.

The code to run the trial was a 1.4GB download which took me about 3-4 hours from FilePlanet’s junk servers. Extracting the zip file and installing the game took 15-20 minutes. Getting the game up to the latest version with all of the updates took another 15-20 minutes. Upgrading to DirectX 9.0c (I had 9.0b) took yet another 15-20 minutes. At the end of everything it took me about 5 hours to get the game running.

And then it took me about an hour to run through and play the entire trial before they wanted me to buy the full version.

I have to laugh. Ha. Jokes on me I suppose.

United Healthcare turned down my wife’s annual exam?

Shouldn’t health insurance cover a woman’s annual exam? This is nuts. Here’s what I wrote them:

I would like to request a review of claim ____ for my wife. The claim was denied with the reason given as, โ€œyour annual maximum benefit for preventative services and associated expenses has been paid,โ€ however that was the first and only preventative services my wife received in 2004. After reviewing our insurance coverage in 2004 more carefully it appears to me that the claim should have been approved.

If it is your desire that my wife contract a serious preventative feminine illness, thatโ€™s fine… but it will cost your insurance company a lot more in the long run!

Spring graphs on GenieLab

I took the TouchGraph code and modified it so it would display artist associativity graphs for GenieLab artists. It’s an open source license, I’m surprised more people don’t use it.

Here’s the graph for They Might Be Giants.

The hardest part of getting this working was actually figuring out how to display applets correctly across Navigator, IE, Firefox and Safari. I had no idea this was so complex. I still can’t get it right in Firefox on MacOS. I finally gave up on “universal html” and just did some browser detection. eck.

University Venture Development Funds

Oregon Senator Frank Morse has proposed a bill in the state legislature that would allow Oregon’s universities to create a venture development fund. This fund would be used to privatize technologies that are developed at our universities. The bill also includes hooks that give tax incentives to “taxpayers” (read: individuals and corporations) that contribue to the venture development fund.

On it’s face, this sounds like a great idea to me. There’s a lot of great technology that’s developed at OSU that goes no where because it would be unethical/illegal for the faculty and students involved to do anything with it on their own. They could market the technology through the university, but there’s no incentive (read: money) involved for them to do so.

However, that’s the way universities are supposed to work. Universities and their faculty are supposed to be unselfish producers of a) research and b) new graduates, for purpose of bettering the state, the country, and mankind. Putting an extra burdon on universities to start spin-off companies I believe would severely damper those goals. Faculty would have to weigh not only the scientific value of their research, but also the financial value.

The strange part about this proposed bill is the tax incentives for individuals and coporations that contribute to this venture development fund. Imagine this scenario: A research lab at OSU is working on a patent for growing trees better. Warehouser finds out, and contacts the professor in charge of the project, telling him he could make millions if he spun the work from OSU and started his own company that manages the patent. The professor agrees, and starts applying for OSU venture dollars to privatize the research. Warehouser then contributes $2M to the venture fund, and gets to write-off half that from their taxes, saving Warehouser $400k that year. The $2M is then given by the OSU venture fund to the professor to spin the work off. Warehouser then buys out a large stake in the now private company. Warehouser now owns the patent and refuses to license it to anyone else until the patent expires in 20 years.

In this scenario Warehouser was able to obtain complete ownership of the patent, circumventing the university process. But not only that, they were able to write it off of their taxes. I can understand the arguement that they should be able to buy the company out… but being able to write it off their taxes for doing so? That seems… strange.

Another concern I have for this bill is the socialism factor. I’m all for socialism when it comes to health care and managing services that benefit all people in the state equally. This bill would create a system where the state owns large shares of private companies that only benefit small segments of the population. That doesn’t seem right. The state should only get involved in businesses that benefit everyone equally, i.e., electricity, water, sewage, garbage, communications, health care, etc.