Created
January 11, 2021 09:28
-
-
Save cormullion/9841da190cd8da34c95803f415b5425e to your computer and use it in GitHub Desktop.
mesh logo 1
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 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") |
Author
cormullion
commented
Jan 11, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment