diff --git a/config/config.exs b/config/config.exs index 956a7ea..0d441c9 100644 --- a/config/config.exs +++ b/config/config.exs @@ -5,7 +5,7 @@ use Mix.Config # Configure the main viewport for the Scenic application config :scenic_escher, :viewport, %{ name: :main_viewport, - size: {700, 600}, + size: {700, 650}, default_scene: {ScenicEscher.Scene.Home, nil}, drivers: [ %{ diff --git a/lib/fitting.ex b/lib/fitting.ex index 8461042..fdaf917 100644 --- a/lib/fitting.ex +++ b/lib/fitting.ex @@ -8,7 +8,7 @@ defmodule Fitting do def get_stroke_width(%Box{b: b, c: c}) do ratio = max(Vector.length(b), Vector.length(c)) / 100.0 - max(ratio, 1.0) + max(ratio, 0.5) end def create_picture(shapes, options \\ []) do diff --git a/lib/picture.ex b/lib/picture.ex index c7d5919..88fab72 100644 --- a/lib/picture.ex +++ b/lib/picture.ex @@ -115,4 +115,73 @@ defmodule Picture do ]).(box) end end + + def nonet(p1, p2, p3, p4, p5, p6, p7, p8, p9) do + above_ratio( + 1, + 2, + beside_ratio(1, 2, p1, beside(p2, p3)), + above( + beside_ratio(1, 2, p4, beside(p5, p6)), + beside_ratio(1, 2, p7, beside(p8, p9)) + ) + ) + end + + def side(0, _fish), do: fn _ -> [] end + + def side(n, fish) when n > 0 do + fn box -> + quartet( + side(n - 1, fish), + side(n - 1, fish), + turn(ttile(fish)), + ttile(fish) + ).(box) + end + end + + def corner(0, _fish), do: fn _ -> [] end + + def corner(n, fish) when n > 0 do + fn box -> + quartet( + corner(n - 1, fish), + side(n - 1, fish), + side(n - 1, fish) |> turn, + utile(fish) + ).(box) + end + end + + def square_limit(0, _fish), do: fn _ -> [] end + + def square_limit(n, fish) when n > 0 do + fn box -> + corner = corner(n - 1, fish) + side = side(n - 1, fish) + + nw = corner + nc = side + ne = corner |> turn |> turn |> turn + mw = side |> turn + mc = utile(fish) + me = side |> turn |> turn |> turn + sw = corner |> turn + sc = side |> turn |> turn + se = corner |> turn |> turn + + nonet( + nw, + nc, + ne, + mw, + mc, + me, + sw, + sc, + se + ).(box) + end + end end diff --git a/lib/scenes/home.ex b/lib/scenes/home.ex index ab81df6..496fb81 100644 --- a/lib/scenes/home.ex +++ b/lib/scenes/home.ex @@ -22,20 +22,10 @@ defmodule ScenicEscher.Scene.Home do # debug: true ) - atom = - Picture.quartet( - Picture.ttile(fish), - Picture.ttile(fish) |> Picture.turn(), - Picture.ttile(fish) |> Picture.turn() |> Picture.turn() |> Picture.turn(), - Picture.ttile(fish) |> Picture.turn() |> Picture.turn() - ) - picture = - Picture.quartet( - atom, - atom, - atom, - atom + Picture.square_limit( + 5, + fish ) paths =