Skip to content

Commit

Permalink
fix some bugs and add OBBs.
Browse files Browse the repository at this point in the history
Fix some bugs and add a layout for the word cloud algorithm.
  • Loading branch information
rogrosso committed Jul 20, 2023
1 parent ddae984 commit 503eea1
Show file tree
Hide file tree
Showing 3 changed files with 578 additions and 172 deletions.
15 changes: 15 additions & 0 deletions common/random.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,19 @@ export function easyRandom(s) {
seed = (seed * 16807) % 2147483647
return (seed - 1) / 2147483647
}
}

export function normalRandomFactory(seed, m_, s_) {
const mu = m_
const sigma = s_
const pi2 = 2 * Math.PI
const random = random_seed(seed)
return function( ) {
let u1 = 1 - random()
let u2 = random()
const mag = sigma * Math.sqrt(-2 * Math.log(u1))
const z0 = mag * Math.cos(pi2 * u2) + mu
const z1 = mag * Math.sin(pi2 * u2) + mu
return z0
}
}
7 changes: 7 additions & 0 deletions infovis/text/wordcloud.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ <h3>Perception</h3>
</li>
<li>exploration: tag clouds provide suboptimal support when searching for specific tags</li>
</ul>
<h3>Algorithm</h3>
<p>
The word cloud layout algorithm is straightforward. For each word, an outgoing spiraling path centered at the center
of the drawing area is generated. Words are moved stepwise along the path. At each step, if the word is place in the
canvas if there are no collision with other words. The computation of collisions uses OBBs and the
Separating Axis Theorem.
</p>
<hr>
<div class="canvas">
<div id="word-cloud" class="grid-container-1-column"></div>
Expand Down
Loading

0 comments on commit 503eea1

Please sign in to comment.