0

I am making word cloud in VB.NET and I have problems with performance. I tried quadtrees, but my implementation is slow.

I have followed this tutorial: http://gamedevelopment.tutsplus.com/tutorials/quick-tip-use-quadtrees-to-detect-likely-collisions-in-2d-space--gamedev-374

But my main problem is that when I am placing word on the "canvas" I am doing the checking too often, because I have the radius step example 0.01 for best tight packing to the center, same thing applies to angle step 0.5

1 take word
2 place it to center of canvas
3 while it collides with other(I am testing all other objects)
     move it by little bit on the spiral
4 set radius to 0, so I start at center again, angle is not changed
5 step 1

So my question is, what do you recommend for less often checking or other performance tweaks? Thanks in advance

Here is screenshot of how the result looks:

Varun Nath
  • 5,570
  • 3
  • 23
  • 39
c0ntrol
  • 908
  • 2
  • 9
  • 14
  • Maybe this can help: http://stackoverflow.com/a/1478314/130611 – the_lotus Jul 28 '14 at 19:58
  • Not sure how this works exactly, but could you check the distance between objects before doing collision checks and exclude words that are too far to possibly generate a collision? Or maybe stop your collision checking earlier rather than going through all objects. Past a certain distance, there won't be any more collisions, so there is no point in even checking. You could possibly determine that from the radius of your spiral and the size of the bounding box of the word. – yu_ominae Jul 29 '14 at 02:35
  • The problem is I do the checking too often, because I need very tight packing. – c0ntrol Jul 30 '14 at 19:30

0 Answers0