Monday, February 21, 2011

DPHP 7 - Reinventing the Wheel... Well, Really, the Line



While I did lie before, this time it's true, I had actually moved to the Arduino Mega at this point.  And then things got really complicated.

This was a the age when I was fighting an uphill battle with my experience and the lack of 'assistance' and 'direction' I was getting from others.  For instance, that first animation, took maybe an hour to code and debug.  After probably 6 hours of failing to write my own line drawing routine.

The problem was, I had never heard of Breshenham's line algorythm.  Why should I have, I'm an aerospace major and had only taken basic coding and numerical methods.  I hadn't taken a graphics class, heck, I hadn't even taken a autonomous systems class (though I was interested but my course load and schedule never allowed it).  I never had need to draw a line from A to B.  The truely sad part was how hard it was for me to finally combine the right search terms to get a hint at Breshenham.  It wasn't pretty.

After finally being able to draw a line from one point to another, I could accomplish much of the above animations.  The bouncing line is pretty simple, track a few points and connect them with points.  The pinwheel is just some lines from the center and some fading code thrown in.  So this must be what it's like when you code with reuse and functionality in mind.  It's wonderful.

I was starting to realize that with enough processing space and code space, you could accomplish a lot more.  Processing power/time isn't so much a problem more often than not, since you can often trade memory usage for speed.  And it is amazing what you can accomplish even when your processor does one thing and only one thing at a time.  And it's most amazing what you can cobble together when you have no idea what you're doing.

No comments:

Post a Comment