Skip to content

Commit

Permalink
Explain how to build square limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ju Liu committed Mar 16, 2019
1 parent 885446c commit 5511c28
Show file tree
Hide file tree
Showing 22 changed files with 439 additions and 25 deletions.
449 changes: 431 additions & 18 deletions README.md

Large diffs are not rendered by default.

Binary file added images/fish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/fish_corner_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/fish_corner_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/fish_over.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/fish_side_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/fish_side_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/fish_ttile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/fish_utile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/letter_f_beside.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/letter_f_beside_flipped.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/letter_f_beside_ratio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/letter_f_flipped.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/letter_f_nonet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/letter_f_quartet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/letter_f_tossed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/square_limit_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/square_limit_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/square_limit_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/box.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule Box do
end

def flip(%Box{a: a, b: b, c: c}) do
%Box{a: Vector.add(a, c), b: b, c: Vector.neg(c)}
%Box{a: Vector.add(a, b), b: Vector.neg(b), c: c}
end

def toss(%Box{a: a, b: b, c: c}) do
Expand Down
6 changes: 3 additions & 3 deletions lib/picture.ex
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ defmodule Picture do

def ttile(fish) do
fn box ->
side = fish |> toss |> flip
side = fish |> toss

over([
fish,
side |> turn,
side |> turn |> turn
side |> flip,
side |> turn |> flip
]).(box)
end
end
Expand Down
7 changes: 4 additions & 3 deletions lib/scenes/home.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ defmodule ScenicEscher.Scene.Home do
alias Scenic.Graph

import Scenic.Primitives
import Picture

@graph Graph.build(font: :roboto, font_size: 24, theme: :light)
|> group(
fn g ->
# We create a box
box = %Box{
a: Vector.build(75.0, 75.0),
b: Vector.build(500.0, 0.0),
c: Vector.build(0.0, 500.0)
b: Vector.build(400.0, 0.0),
c: Vector.build(0.0, 400.0)
}

# We create a fish
Expand All @@ -34,7 +35,7 @@ defmodule ScenicEscher.Scene.Home do
path(acc, elem, options)
end)
end,
translate: {20, 60}
translate: {75, 75}
)

def init(_, _) do
Expand Down

0 comments on commit 5511c28

Please sign in to comment.