Moved factors to give weighting to force components to some constants, making tweaking of weights easier.
Still n^2 in run time, but is quite a lot faster by removing several loops. I have a branch going where I'm implementing what I can with a sweep line algorithm, reducing this complexity to linear time.