In a certain hope of geniousity I kind of hoped that the new text engine would provide me with outline shapes for fonts I gave it a first try using them: Unfortunatly that didn’t work at all. So I had to step back to the good old collision detection to see whether or not two texts overlap.
I think i optimized the collision detection to its max. Yet the tricky part of the tag cloud is: How to actually arrange the tags. Well: I have to admit: The guys from wordle are way ahead of me by now. I have no idea what they do that it works so fast, perhaps their math skills are just way above mine.
Anyway: I choose to implement two kinds of algorithms: In the first one the words are checked in circles, every circle check consists of a few angle checks. The second algorithm consists of a random based angle. So I choose a angle for a object at the beginning and then move them along this angle until they have enough space.
On a reasonable machine and without any overhead, I was able to position 40 objects in 3 seconds, acceptable but not good.
To try out the various parameters of the algorithms, I created a kind of sandbox which allowed me easier tweaking, until I finished some furbishing of the code I can give you this as example for try-out, have fun!
It lacks some features, but I think its a good start. If you have any suggestions for different algorithms: please let me know. I will open source this as soon as the documentation is on a acceptable level.
PS.: I use the Random Number Generator from Polygonal that allows me to positionate the text always in the same way.