Drawing Blanks

Premature Optimization is a Prerequisite for Success

Mapping the circle

leave a comment »

I had to solve two problems at work that were unrelated but had one similarity that made them a little more difficult than I had expected.
 
1. You have 2 time intervals defined as times of day (times without dates). Does one of them contain the other? Do they intersect?
Does [10pm, 8am] contain [12am, 7am]? If they start on the same day – no. But in general, if something is scheduled for [10pm, 8am] and was in progress [12am, 7am] then – yes, it was within the schedule.
I had to write quite a bit of code to handle this stuff (and I’m still writing unit tests which I normally never do!).
 
2. You have an area on the map. It has the West End and the East End. You would assume that the West End Longitude is always less than the East End Longitude. But it’s not true if the map crosses the 180 degrees longitude line.
 
All this pain in the head is caused by some stupid property of the circle which I cannot grasp. Usually I can always trace such things back to formal mathematical concepts. But this simple thing puzzles me. It’s not about continuous mapping. It’s rather related to ordering and orientation…
 
I asked Prof. Wittgenstein was this not profound philosophical stuff….
Advertisements

Written by bbzippo

11/06/2009 at 4:52 am

Posted in math, programming

Tagged with ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: