Skip to main content
Commonmark migration
Source Link

##A preview

A preview

##First try

First try

##Second try: converting all this to vector graphics

Second try: converting all this to vector graphics

##A preview

##First try

##Second try: converting all this to vector graphics

A preview

First try

Second try: converting all this to vector graphics

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Here's a go at implementing Wordle's layout algorithm, described at cormullion's linkcormullion's link.

Here's a go at implementing Wordle's layout algorithm, described at cormullion's link.

Here's a go at implementing Wordle's layout algorithm, described at cormullion's link.

added 968 characters in body
Source Link
Szabolcs
  • 238.9k
  • 32
  • 653
  • 1.3k

I don't have time to finish this, but here'sHere's a go at implementing the idea from Wordle's layout algorithm, described at cormullion's link.

Mathematica graphics

Some explanations:

This code takes the word images one by one and tries to place them at a random position. If it does not fit at that position, it tries other positions, moving on an outward winding Archimedean spiral. The step size of moving on this spiral should be chosen so that the points are distributed with an approximately constant density in the plane, and are not on gathered on a few thin lines. I used this code to verify the point distribution for a given step size (1 was good enough for a first try):

Manipulate[Graphics[Point@Table[x/100 {Cos[x], Sin[x]}, {x, 0, 100, s}]], {s, 0.1, 1.5}] 

Testing for image overlap (i.e. whether the word fits) is done by composing the image onto a canvas which has all the previously placed words, and verifying that no black pixels will collide (i.e. the total pixel count will not change after placing the image). There are probably faster ways to do this.

I don't have time to finish this, but here's a go at implementing the idea from cormullion's link.

Mathematica graphics

Here's a go at implementing Wordle's layout algorithm, described at cormullion's link.

Mathematica graphics

Some explanations:

This code takes the word images one by one and tries to place them at a random position. If it does not fit at that position, it tries other positions, moving on an outward winding Archimedean spiral. The step size of moving on this spiral should be chosen so that the points are distributed with an approximately constant density in the plane, and are not on gathered on a few thin lines. I used this code to verify the point distribution for a given step size (1 was good enough for a first try):

Manipulate[Graphics[Point@Table[x/100 {Cos[x], Sin[x]}, {x, 0, 100, s}]], {s, 0.1, 1.5}] 

Testing for image overlap (i.e. whether the word fits) is done by composing the image onto a canvas which has all the previously placed words, and verifying that no black pixels will collide (i.e. the total pixel count will not change after placing the image). There are probably faster ways to do this.

added 40 characters in body
Source Link
Szabolcs
  • 238.9k
  • 32
  • 653
  • 1.3k
Loading
added 164 characters in body
Source Link
Szabolcs
  • 238.9k
  • 32
  • 653
  • 1.3k
Loading
added 1012 characters in body
Source Link
Szabolcs
  • 238.9k
  • 32
  • 653
  • 1.3k
Loading
Source Link
Szabolcs
  • 238.9k
  • 32
  • 653
  • 1.3k
Loading