ScriptSpot

Forum topic · General Scripting

Word Cloud ... seriously

By diggerjohn · 2012-02-06

Description

I am trying to generate a Word Cloud.

I am reading an external file and getting the words and their
frequency of use successfully.
I am generating the words in Max and scaling them relative to their
frequency successfully.
But they are all piled on top of each other.

The problem I am having is figuring out how to place them in a plane
randomly, like a cloud, so they do not overlap but are close
together.

Any suggestions would be helpful.
Thanks.

Comments (2)

br0t · 2012-02-07

this is an interesting topic! but its more an algorithm problem than a maxscript problem. you can use the boundingbox of your text objects

nodeGetBoundingBox <node> <matrix3>

and their pivot to get their position and scale in the 3d space. you'll have to check their intersection

intersects <node> <node>

and place them accordingly, which is the tricky part, especially to do it efficiently. theres a lot of discussion and even some papers on the web, maybe it can help, Id didn't get it from a rough first look^^

http://stackoverflow.com/questions/342687/algorithm-to-implement-a-word-…

http://static.mrfeinberg.com/bv_ch03.pdf

http://www2007.org/workshops/paper_12.pdf

Yes it is an interesting problem

diggerjohn · 2012-02-08

Thank you so much for pointing me in the right direction.
I have been scripting off and on for years, more off than on.
So I always feel like a beginner.
Thanks again.