Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
Signed-off-by: martinRenou <martin.renou@gmail.com>
  • Loading branch information
martinRenou committed Sep 26, 2020
1 parent be37390 commit cd69bdc
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion examples/RoughCanvas.ipynb
Expand Up @@ -197,6 +197,41 @@
"\n",
"c"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Draw thousands of shapes at once"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"n_particles = 3_000\n",
"\n",
"import numpy as np\n",
"\n",
"x = np.array(np.random.rayleigh(250, n_particles), dtype=np.int32)\n",
"y = np.array(np.random.rayleigh(250, n_particles), dtype=np.int32)\n",
"size = np.random.randint(4, 8, n_particles)\n",
"\n",
"canvas = RoughCanvas(width=800, height=500)\n",
"\n",
"canvas"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"canvas.fill_rects(x, y, size)"
]
}
],
"metadata": {
Expand All @@ -215,7 +250,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down

0 comments on commit cd69bdc

Please sign in to comment.