Reputation: 11
so I'm new to processing and am trying to create a generative art piece which displays the word usage of a book (in my case the Great Gatsby) and display it in a unique format. As of right now I've gotten to the part of extraction of the data with the help of an old piece tinkered with by D. Shiffman, which can be found below. As of right now though I'm deciding on the display method and not so sure how to go about it.
I decided on this format by the "Space is Vast" guy. I figured I'd format it where each unique word is it's own line and, like the lines in the piece the value in usage would determine the lines length around the sphere orbit. both of which are generated values in the code below.
If anyone has any ideas to start is process (reference, advice or actual code) it would be deeply appreciated. Thanks again and have a great day.
Img can be found here: http://spaceisvast.com/post/102743224728/iterations-on-a-concept-something-very
String[] gatsby;
String delimiters = " .,?!:;[]- ";
IntDict words;
int usage;
int textAmount = 8754;
int myScale;
//int count = words.get(theword);
void setup(){
size(600,600);
background(255);
smooth();
// loading gatsby into the string
String[] rawtext = loadStrings("TXT.rtf");
//create big ass string
String everything = join(rawtext, "");
//create single words array
gatsby = splitTokens(everything, delimiters);
//create my a shinny dictionary of text
words = new IntDict();
for (int i = 0; i < gatsby.length; i++){
String usage = gatsby[i].toLowerCase();
words.increment(usage);
}
//sort by value
//words.sortValuesReverse();
println(words);
}
void draw(){
}
Upvotes: 0
Views: 41
Reputation: 41
If you want to create something like Space is Vast then you can use arcs. Arc is same as ellipse with few extra params, mainly the start and closing angle in radians. Processing also has degree to radian converters.
Run a loop of all the words in your IntDict and draw the arc, each time increase the width/height of the arc (maybe a dynamic and transparent fill color).
Also, it would be fun if you put the word at the end of the arc for which this arc was drawn. It would be simple if you try to find the polar coordinates of the closing point, then convert between coordinate systems.
Upvotes: 0