Tuesday, June 19, 2012

I wasn't bored so I haven't been blogging

This blog is still a thing, and I still want to produce content for it, but I haven't been blogging lately because I've been busy (and my code is dumb).

Right now I'm taking 8 credit hours over 4 weeks. These classes are Linear Algebra and Physics. The things I'm learning in these classes make my code look really stupid. The code I've writen was created for simple 2d side scroller simulation, but I was solving collision equations using Geometry. Made sense to a guy with a High School level education, but now I'm learning things that makes that look really dumb because you can do the same thing with half as many calculations.

For example, the last thing I was working on was a way to detect if a point was left or right of a line. I was going to use a look a geometry based collision algorithm combines with a look up table, but now I know that if you have a line that is AB and you want to see if point C is left of that line, then you could just use this code:

 int Q = (Bx-Ax)(Cy-Ay) - (By-Ay)(Cx-Cy)  

Then the sign of Q is related to the leftness or rightness of the point to the line (can't remember which, and 0 is on the line). A lot of my code could be simplified using things I've learned in Linear Algebra and I was in the process of rewriting the whole thing anyway (I knew it was flawed and overly complicated, but I couldn't figure out how).

Anyway, I miss blogging and writing code for fun, but I'm really busy learning why the code I've already written is dumb and inefficient. Once I finish, I'll start up again!

No comments:

Post a Comment