Skip to content

Instantly share code, notes, and snippets.

@cormullion
Created January 11, 2021 09:28
Show Gist options
  • Save cormullion/9841da190cd8da34c95803f415b5425e to your computer and use it in GitHub Desktop.
Save cormullion/9841da190cd8da34c95803f415b5425e to your computer and use it in GitHub Desktop.
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()
# build point array
pts = polysample(box(O, 600, 600, vertices=true), 16)
for pt in ngon(O, 100, 3, π/6, vertices=true)
for θ in 0:π/8:6π
for i in 160:40:265
push!(pts, pt + polar(i, θ))
end
end
end
# make triangulation
tris = polytriangulate(pts)
# draw triangles
setline(.5)
for tri in tris
#sethue("white")
sethue("red")
poly(tri, :stroke, close=true)
end
# clipping for julia circles
@layer begin
for pt in ngon(O + (0, 35), 150, 3, π/6, vertices=true)
circlepath(pt, 110, :path)
end
sethue("white")
setline(3)
strokepreserve()
clip()
setline(1)
for tri in tris
sethue([Luxor.julia_red, Luxor.julia_green, Luxor.julia_purple][rand(1:end)])
poly(tri, :fillpreserve, close=true)
sethue("white")
strokepath()
end
sethue("white")
circle.(pts, 3, :fill)
clipreset()
end
# draw nodes
sethue("white")
circle.(pts, 3, :fill)
#outline
setline(4)
sethue("red")
squircle(O, 285, 285, :stroke, rt=0.2)
finish()
preview()
end
meshlogo("/tmp/meshlogo.png")
@cormullion
Copy link
Author

meshlogo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment