Skip to content

Instantly share code, notes, and snippets.

@cormullion
cormullion / delaunay-to-voronoi.jl
Last active January 8, 2022 10:41
Delaunay to Voronoi
# should run this using Luxor#master or >= v2.20.0 -
# I replaced a dodgy implementation of Jarvis March with
# a hopefully less dodgy implementation of Graham Scan.
using Luxor, ColorSchemes
@draw begin
background("black")
println("create points")
verts = randompointarray(BoundingBox(), 30)
@cormullion
cormullion / julia-graphs-icon.jl
Created November 9, 2021 10:34
Julia Graphs icon
using Luxor
using Graphs
using Colors
function lighten(col::Colorant, f)
c = convert(RGB, col)
return RGB(f * c.r, f * c.g, f * c.b)
end
function julia_sphere(pt::Point, w, col::Colorant;
@cormullion
cormullion / graph-logo.jl
Last active October 19, 2021 14:35
little graph network that unfortunately looks a bit like a chemical molecule
using Luxor, LightGraphs, Random, Colors
function lighten(col::Colorant, f)
c = convert(RGB, col)
return RGB(f * c.r, f* c.g, f * c.b)
end
function julia_sphere(pt, w;
col = 1,
action = :none,
@cormullion
cormullion / newmakie.jl
Last active February 27, 2022 16:58
new-makie.jl
using Luxor, Colors, Thebes
# requires Luxor >= 2.15.0
function make_conical_mesh(;
origin = O,
radius = 250,
startangle = 0,
endangle = 2π,
startoutsidecolor = colorant"red",
@cormullion
cormullion / aliasing-test.jl
Last active July 6, 2021 13:26
Alias text test
using Luxor
function make_matrix()
Drawing(40, 40, :image)
background(1, 1, 1, 1)
setantialias(0)
origin()
setcolor(0, 0, 0, 1)
fontsize(40)
text("a", halign=:center, valign=:middle)
using Luxor, Colors
function draw_logo(color=colorant"black")
box(O, 580, 500, 40, :clip)
mountain = [
Point(-300, 250),
Point(-300, 200),
Point(-64, -70),
Point(40, 40),
Point(105, -5),
using Luxor
function jump_circles()
setline(12)
setlinecap("round")
line(Point(20, 68), Point(120, 28), :stroke)
line(Point(4, 120), Point(120, 4), :stroke)
pts = box(Point(86, 84), 40, 40, vertices=true)
@layer begin
sethue(Luxor.julia_red)
@cormullion
cormullion / airport-map.jl
Created January 25, 2021 23:18
draw world airport map
using Shapefile, Luxor, BenchmarkTools
cd(@__DIR__)
include(joinpath(dirname(pathof(Luxor)), "readshapefiles.jl"))
function drawairportmap(outputfilename, countryoutlines, airportdata)
Drawing(4000, 2000, outputfilename)
origin()
background(0.05, 0.2, 0.15)
### A Pluto.jl notebook ###
# v0.12.15
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local el = $(esc(element))
@cormullion
cormullion / mesh-logo-1.jl
Created January 11, 2021 09:28
mesh logo 1
using Luxor
function meshlogo(fname)
Drawing(600, 600, fname)
origin()
# background
squircle(O, 285, 285, :clip, rt=0.2)
sethue("slateblue4")
paint()