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
#!/usr/bin/env julia | |
using Luxor, Colors | |
function julia_balls() | |
# get centers for the three balls | |
points = reverse(ngon(0, 0, 100, 3, pi/6, vertices=true)) | |
gsave() | |
# setcolor(0.251, 0.388, 0.847) # the darker blue not used | |
# setcolor(0.4, 0.51, 0.878) # the lighter blue not used |
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
#!/usr/bin/env julia | |
using Luxor, Colors | |
function julia_balls() | |
# get centers for the three balls | |
points = reverse(ngon(0, 0, 100, 3, pi/6, vertices=true)) | |
gsave() | |
# setcolor(0.251, 0.388, 0.847) # the darker blue not used | |
# setcolor(0.4, 0.51, 0.878) # the lighter blue not used |
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
#!/usr/bin/env julia | |
using Luxor, Colors | |
Drawing(600, 500, "/tmp/stackad.png") | |
origin() | |
background("white") | |
# background textifying, not for reading, fortunately | |
function background_text(str_array, fontsz, beginning::Point, ending::Point) |
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
#!/usr/bin/env julia | |
using Luxor | |
Drawing(500, 500, "/tmp/julia-flowers.png") | |
background("white") | |
function juliaflowers(cpos::Point, radius; petals=30, outercircleratio=0.75, innercircleratio=0.65) | |
# clockwise, from bottom LEFT... | |
points3 = ngon(cpos, radius, 3, pi/6, vertices=true) |
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
#!/usr/bin/env julia | |
using Luxor | |
function pidigits(n) | |
result = Int[] | |
k, a::BigInt, b::BigInt, a1::BigInt, b1::BigInt = 2, 4, 1, 12, 4 | |
while n > 0 | |
p, q, k = k * k, 2k + 1, k + 1 | |
a, b, a1, b1 = a1, b1, p * a + q * a1, p * b + q * b1 |
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
using Luxor | |
function three_circles(cpos::Point, circle_radius; outercircleratio=0.75, innercircleratio=0.65) | |
fontface("Georgia-Bold") | |
fontsize(26) | |
# clockwise, from bottom LEFT... | |
points3 = ngon(cpos, circle_radius, 3, pi/6, vertices=true) | |
for (n, p) in enumerate(points3) | |
sethue(color_sequence[n][1]...) | |
circle(p, outercircleratio * circle_radius, :fill) |
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
using Luxor | |
function drawcell(centerpos, width, height, colornumber; hollow=false) | |
darker_purple = (0.584, 0.345, 0.698) | |
lighter_purple = (0.667, 0.475, 0.757) | |
darker_green = (0.22, 0.596, 0.149) | |
lighter_green = (0.376, 0.678, 0.318) | |
darker_red = (0.796, 0.235, 0.2) | |
lighter_red = (0.835, 0.388, 0.361) | |
color_sequence = [(darker_red, lighter_red), |
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
#!/usr/bin/env julia | |
# inspired by http://stackoverflow.com/questions/40031913/simulate-a-bouncing-ball | |
# and the inspired Chris Rackauckas | |
using DifferentialEquations, ParameterizedFunctions, NLsolve, Luxor | |
f = @ode_def BallBounce begin | |
dy = v | |
dv = -g |
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
#!/usr/bin/env julia | |
using Luxor, Colors | |
"make a color more white" | |
function whiten(col::Color, f=0.5) | |
hsl = convert(HSL, col) | |
h, s, l = hsl.h, hsl.s, hsl.l | |
return convert(RGB, HSL(h, f, f)) | |
end |
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
#!/usr/bin/env julia | |
using Luxor | |
function makerandomepitrochoid(n) | |
hlist = [] | |
plist = [] | |
for i in 1:n | |
R = 20 | |
r = rand(30:3:91) |
OlderNewer