Skip to content

Instantly share code, notes, and snippets.

@christianp
Created January 5, 2022 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christianp/278f6d05030a5142a188073ba77175e4 to your computer and use it in GitHub Desktop.
Save christianp/278f6d05030a5142a188073ba77175e4 to your computer and use it in GitHub Desktop.
Constructing a square with area 5
let(
middle, point(3/2,3/2),
t, point(0,1)..point(2,1)..point(2,0),
t2, point(0,1)..point(2,0)..point(0,0),
colors, qualitative_color_schemes(5)[0],
eukleides("A 3×3 grid of squares. The middle square is filled in, and the 2×1 rectangles around it each have half filled in. The filled-in shapes together make a square whose corners touch the edges of the grid.",
[
map(x filled color, [x,color], zip(iterate(rotate(tri,middle,deg(90)),tri,t,3), colors))
, map(x filled color opacity(0.3), [x,color], zip(iterate(rotate(tri,middle,deg(90)),tri,t2,3), colors))
, polygon(iterate(rotate(p,middle,deg(90)), p, point(0,1), 4)) dashed
, polygon(square(point(1,1),1)) filled colors[4]
, ( map(point(x,0)..point(x,3), x, 0..3)
+ map(point(0,y)..point(3,y), y, 0..3)
) white
]
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment