-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
40 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,10 @@ | ||
open Joy | ||
|
||
let size = 800 | ||
let interval = 16 | ||
let line_interval = 800 / interval | ||
let rec range a b = if a > b then [] else a :: range (a + 1) b | ||
let inc x = x + 1 | ||
|
||
let _ = | ||
init ~size:(size, size) (); | ||
let half_size = size / 2 in | ||
let lines = | ||
List.map | ||
(fun i -> | ||
let newx = i |> inc |> ( * ) line_interval in | ||
line | ||
~a:(point (newx - half_size) (-half_size)) | ||
(point (newx - half_size) half_size)) | ||
(range 0 interval) | ||
in | ||
show lines; | ||
init (); | ||
let l1 = line (point 50 50) in | ||
let l2 = line (point (-50) 50) in | ||
let l3 = line ~a:(point (-50) 50) (point 50 50) in | ||
show [l1; l2; l3]; | ||
write ~filename:"line.png" () | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
open Joy | ||
|
||
let size = 800 | ||
let interval = 16 | ||
let line_interval = 800 / interval | ||
let rec range a b = if a > b then [] else a :: range (a + 1) b | ||
let inc x = x + 1 | ||
|
||
let _ = | ||
init ~size:(size, size) (); | ||
let half_size = size / 2 in | ||
let lines = | ||
List.map | ||
(fun i -> | ||
let newx = i |> inc |> ( * ) line_interval in | ||
line | ||
~a:(point (newx - half_size) (-half_size)) | ||
(point (newx - half_size) half_size)) | ||
(range 0 interval) | ||
in | ||
show lines; | ||
write ~filename:"parallel_lines.png" () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters