-1

所以我是处理的新手,我正在尝试创建一个生成艺术作品,它显示一本书的单词用法(在我的例子中是 Great Gatsby)并以独特的格式显示它。到目前为止,我已经在 D. Shiffman 修补的旧文章的帮助下进行了数据提取部分,可以在下面找到。截至目前,虽然我正在决定显示方法,但不太确定如何去做。

我是由“Space is Vast”这个人决定的。我想我会格式化它,每个唯一的单词都是它自己的行,就像片段中的行一样,使用中的值将决定球体轨道周围的行长度。这两个都是在下面的代码中生成的值。

如果有人对流程有任何想法(参考、建议或实际代码),我们将不胜感激。再次感谢,祝您有美好的一天。

Img 可以在这里找到: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(){
  }
4

1 回答 1

0

如果你想创建类似Space is Vast的东西,那么你可以使用arcs。圆弧与椭圆相同,没有额外的参数,主要是弧度的起始角和闭合角。处理也有角度到弧度的转换器。

运行 IntDict 中所有单词的循环并绘制弧线,每次增加弧线的宽度/高度(可能是动态和透明的填充颜色)。

此外,如果您将单词放在绘制此弧的弧的末尾会很有趣。如果您尝试找到闭合点的极坐标,然后在坐标系之间进行转换,那将很简单。

于 2015-08-23T02:24:32.610 回答