Skip to content

Instantly share code, notes, and snippets.

@cormullion
cormullion / geostats.jl
Last active January 15, 2021 11:14
Make geostats logo in Luxor, using the awesome Contours.jl
using Luxor, Contour, Images
function geostats(s)
Δ = s/500 # scale factor, original design was 500units
circle(O, 245Δ, :clip)
sethue("white")
circle(O, 245Δ, :fill)
# generate contours from image
pwd()
using Luxor, Colors
function main(fname)
Drawing(600, 600, fname)
origin()
circle(O, 290, :clip)
sethue("white")
paint()
colors = [Luxor.julia_blue, Luxor.julia_red, Luxor.julia_green, Luxor.julia_purple]
@cormullion
cormullion / hilbert-animation.jl
Created January 31, 2020 09:04
hilbert animation
using Luxor, Colors
function hilbert(pointslist::Array{Point, 1},
start::Point, unitx::Point, unity::Point, depth)
if depth <= 0
push!(
pointslist,
Point(start.x + (unitx.x + unity.x)/2, start.y + (unitx.y + unity.y)/2))
else
hilbert(pointslist, start,
@cormullion
cormullion / revise-graphics.jl
Last active February 5, 2020 10:06
revise graphics
using Luxor
"""
makegear(nteeth, s, pos, rot)
nteeth is number of teeth, s is basically radius
pos is center, rot is initial rotation
"""
function makegear(nteeth, s, pos, rot)
@layer begin
@cormullion
cormullion / xmastree.jl
Created December 13, 2019 18:06
xmas tree animation
using Luxor, ColorSchemes
function maketriangulargrid(dw, dh, gw, gh)
grid = Point[]
for x in -dw:gw:dw, y in -dh:gh:dh
push!(grid, Point(x, y))
end
return polytriangulate(grid)
end
@cormullion
cormullion / agents.jl
Created October 9, 2019 16:18
agents
using Luxor, DSP
# dimensions drawing
const W = 500
const H = 500
const GRIDSQUARESIZE = 10
function drawcellulargrid(a)
rows, cols = size(a)
@cormullion
cormullion / JuliaCon2019 Videos.md
Last active July 24, 2019 15:55
JuliaCon 2019 Videos

no longer being updated - go here instead!

title url viewcount
A General-Purpose Toolbox for Efficient Kronecker-Based Learning 🔗 0
A New Breed of Vehicle Simulation 🔗 0
A Probabilistic Programming Language for Switching Kalman Filters 🔗 0
A Showcase for Makie 🔗 0
Analyzing Social Networks with SimpleHypergraphs.jl 🔗 0
Array Data Distribution with ArrayChannels.jl 🔗 0
using Luxor, Colors
function phyllotaxis(L, startrad, N)
deviation = 5/8
goldenangle = mod2pi(Base.MathConstants.φ * 2π)
lgrad = 0.45L
lgarea = lgrad^2 * π
meanarea = lgarea/N
minarea = meanarea * (1 - deviation)
maxarea = meanarea * (1 + deviation)
@cormullion
cormullion / julialabeltags.jl
Last active April 29, 2019 08:42
label tag
using Luxor
function drawtag(w, h, pos;
ratio = 0.2,
rotation = 0)
@layer begin
translate(pos)
rotate(rotation)
shape = box(O + (w/4, 0), w, h, vertices=true)
# need point middle/left of box
using Luxor, Colors
function flame(pos, col, action=:none)
@layer begin
translate(pos)
col == 1 && (mesh1 = mesh(box(O - (0, 100), 200, 260), [
Colors.RGB(colorant"orange"),
Colors.RGB(colorant"darkorange"),
Colors.RGB(colorant"red"),
Colors.RGB(colorant"firebrick4")]))