To be able to edit code and run cells, you need to run the notebook yourself. Where would you like to run the notebook?

This notebook takes about 30 seconds to run.

In the cloud (experimental)

Binder is a free, open source service that runs scientific notebooks in the cloud! It will take a while, usually 2-7 minutes to get a session.

On your computer

(Recommended if you want to store your changes.)

  1. Copy the notebook URL:
  2. Run Pluto

    (Also see: How to install Julia and Pluto)

  3. Paste URL in the Open box

Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Author 1
👀 Reading hidden code
using PenPlots, PlutoUI
1.7 s
👀 Reading hidden code
coords = [
Point(i, sin(i/5) + rand())
for i in 1:100
]
268 ms
👀 Reading hidden code
Path(coords)
14.6 μs
👀 Reading hidden code
59.5 μs
point_at_angle (generic function with 1 method)
👀 Reading hidden code
point_at_angle(a) = Point(cos(2π * a), sin(2π * a))
520 μs
20
👀 Reading hidden code
nturns = 20
11.8 μs
👀 Reading hidden code
@bind offset Slider(0:.01:5)
411 ms
👀 Reading hidden code
@bind scale Slider(0.9:.01:1.2)
658 μs
👀 Reading hidden code
11.8 μs
Error message

UndefVarError: img not defined

Stack trace

Here is what happened, the most recent locations are first:

  1. get_value_at(p::GeometryBasics.Point{2, Float64})
    function get_value_at(p::Point)	max_size = minimum(size(img)) / 2	q = max_size * p + Point(max_size, max_size)
  2. Show more...
Try asking on Julia Discourse!
[
# Path(spiral(false)),
Path(spiral(true)),


# Path((scale * spiral()) .+ Point(offset, 0)),
]
👀 Reading hidden code
---
spiral (generic function with 1 method)
spiral(special::Bool) = [
if special
p = a * point_at_angle(a)
val = get_value_at(p / nturns)

a * point_at_angle(a) + (1.0 - val) * 0.4 * point_at_angle(a^2 * 7)
else
a * point_at_angle(a)
end

for a in range(0, nturns, 5000 * nturns)
]
👀 Reading hidden code
1.4 ms
👀 Reading hidden code
61.7 μs
👀 Reading hidden code
60.3 μs
using Images
👀 Reading hidden code
5.6 s
img = load(download("https://fonsp.com/img/doggoSmall.jpg?raw=true"))
👀 Reading hidden code
---
Error message

ArgumentError: No file exists at given path: /Users/fons/Pictures/axi/berg2.jpeg

Stack trace

Here is what happened, the most recent locations are first:

  1. checkpath_load
  2. load(::String; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
  3. load
  4. img = load("/Users/fons/Pictures/axi/berg2.jpeg")
img = load("/Users/fons/Pictures/axi/berg2.jpeg")
👀 Reading hidden code
---
get_value_at (generic function with 1 method)
function get_value_at(p::Point)

max_size = minimum(size(img)) / 2

q = max_size * p + Point(max_size, max_size)


r(x) = round(Int, x)

color = get(
img,
(
r(q[2]),
r(q[1]),
),
zero(eltype(img)),
)
gray(Gray(color))
end
👀 Reading hidden code
1.2 ms
Error message

UndefVarError: img not defined

Stack trace

Here is what happened, the most recent locations are first:

  1. get_value_at(p::GeometryBasics.Point{2, Int64})
    function get_value_at(p::Point)	max_size = minimum(size(img)) / 2	q = max_size * p + Point(max_size, max_size)
  2. Show more...
Silly computer!
get_value_at(Point(1,0))
👀 Reading hidden code
---
Error message

UndefVarError: img not defined

Stack trace

Here is what happened, the most recent locations are first:

  1. get_value_at(p::GeometryBasics.Point{2, Float64})
    function get_value_at(p::Point)	max_size = minimum(size(img)) / 2	q = max_size * p + Point(max_size, max_size)
  2. Show more...
get_value_at(Point(-.99999,-.3))
👀 Reading hidden code
---