Skip to content

Instantly share code, notes, and snippets.

@cormullion
cormullion / noise-landscape.jl
Created October 9, 2020 07:51
noisy landscape
using Luxor, Colors, ColorSchemes
"""
draw a box with noisy top edge and straight sides
"""
function layer(leftminheight, rightminheight, noisefrequency;
detail=1,
persistence=0)
bottomleft, topleft, topright, bottomright = box(BoundingBox(), vertices=true)
ip1 = between(bottomleft, topleft, leftminheight)
@cormullion
cormullion / rr-logo.jl
Created October 5, 2020 17:16
rr-logo
using Luxor, Colors
function main(nrows, ncols, startpattern;
firstcolor = "rebeccapurple",
secondcolor = "darkorange",
backgroundcolor = "black",
backgrounddotcolor = "grey15",
highlightcolor = "white")
lw = (500/ncols) - 20
r_pattern = [
@cormullion
cormullion / julia-hacktoberfest.jl
Last active October 4, 2020 15:12
julia-hacktoberfest.jl
using Luxor, Thebes, Zalgo
leafverts = convert.(Point3D, Point[Point(-22.25390625, 44.8359375), Point(-42.9765625, 26.78515625), Point(-43.40625, 26.03125), Point(-35.67578125, 21.640625), Point(-35.66015625, 21.33984375), Point(-50.12109375, 7.46875), Point(-52.17578125, 4.1328125), Point(-47.66796875, 1.4140625), Point(-47.66015625, 1.17578125), Point(-61.1015625, -27.94140625), Point(-60.84375, -29.23828125), Point(-35.09375, -24.734375), Point(-34.35546875, -25.7109375), Point(-21.59375, -13.56640625), Point(-21.11328125, -13.94921875), Point(-22.65625, -40.26953125), Point(-22.44921875, -40.9609375), Point(-1.359375, -62.5703125), Point(-0.55078125, -62.203125), Point(5.35546875, -82.87109375), Point(5.80859375, -82.890625), Point(10.83203125, -62.71484375), Point(10.69921875, -61.34375), Point(29.7734375, -42.10546875), Point(30.01171875, -41.58203125), Point(24.234375, -13.328125), Point(24.4140625, -13.02734375), Point(36.2734375, -21.5625), Point(37.09375, -21.87109375), Point(57.6875, -23.015625),
@cormullion
cormullion / luxorminifb.jl
Last active November 16, 2021 13:23
Luxor -> MiniFB test
using Luxor, MiniFB, Colors
mutable struct Guilloche
f1::Float64
f2::Float64
f3::Float64
f4::Float64
# damping factors: increase to make the energy losses faster
xd1::Float64
xd2::Float64
using Luxor, ColorSchemes
struct Point4D <: AbstractArray{Float64, 1}
x::Float64
y::Float64
z::Float64
w::Float64
end
Point4D(a::Array{Float64, 1}) = Point4D(a...)
@cormullion
cormullion / juliastreamer.jl
Created July 5, 2020 17:41
Julia streamer logo
using Luxor, ColorSchemes
function sinecurveincreasing(thecurve, width=5.0; initialwidth=1, finalwidth=2)
leftcurve = Point[]
rightcurve = Point[]
for n in 1:length(thecurve)-1
# find slope of curve at those points
pt1 = Point(thecurve[n].x, cos(thecurve[n].y))
@cormullion
cormullion / julia-plots-logo.jl
Created June 15, 2020 12:41
julia plots logo
using Luxor
plotpoints = Point[
Point(-90.36775, 109.412),
Point(-17.1930000000000, 20.175),
Point(-60.1385, -121.20),
Point(29.972500000000025, -61.73075),
Point(109.87098, -41.90625),
Point(83.43848, 55.41374),
Point(208.39248, -38.902475),
@cormullion
cormullion / juliaperformance.jl
Last active June 14, 2023 11:09
julia performance
using Luxor
function main()
Drawing(500, 500, "/tmp/juliaperformance.svg")
origin()
squircle(O, 245, 245, :clip, rt=0.3)
sethue("ivory")
paint()
@layer begin
translate(0, 200)
@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]