Left point, Center point, Right point

chaoticset on 2003-06-15T18:47:41

Triangles triangles triangles. I am 100% sick of triangles now.

Lucky me, then, that I'm nearly to the end of the fuzzy module. (I still haven't the faintest what I should name it for CPAN, or anything like that, but I'll get that figured out later.) Right now, it's returning all the points it needs to, Cartesian-grid-style, and I just need to

  1. Calculate the area inside the points.
  2. Locate the "average" point in the "curve".
  3. Add the normalizing value so that it means something compared to the original data.
  4. Go stark raving mad.
  5. Refactor, refactor, refactor.

I am aware that any piece of code I write these days will be an embarrassment to me in six months, but this code is an embarrassment now. It's so, so awful. I was desperately trying to figure half my math model out while coding, so there's lots of things that are essentially code doodles, places where I figured something out step by tedious step to produce a value that should have been calculated in one line, and then discovered I didn't need the value. There's lots of that, plus lots of places where I got Dumper-happy trying to figure out why radically incorrect values were resulting from my flawed work. Next time, it's Acme::Handwave all the way.

So I've got to go through the whole thing (not much, maybe a hundred lines or so) and refactor the living crap out of it so that I can show it to other people and not want to hide.

That plus I'm doing the whole thing the stupid way. I'm not bright enough to come up with a general way of handling every case of overlap, so I've gone and written two special cases that should cover 80% of the situation and given up at that point. (Although it's worth noting that, should I be able to write a 3 and 4 triangle case in the future, I suspect highly that the system will be at 95% of cases.)

Eventually I'll figure some sort of general method out (probably separating the code for the calculation of points and averaging of the curve will do it) and will replace the current implementation. (Emphasis on the eventually.)

I'm pretty sick, and I won't detail the ucky details here. I'm feeling lots better than yesterday, and hopefully have weathered the worst.

More code to go...