Google Classroom
GeoGebraGeoGebra Classroom

Geometric pattern

I saw a nice pattern in Matt's t-shirt and I thought I can make it in GeoGebra: https://www.youtube.com/watch?v=ga9Qk38FaHM&ab_channel=Stand-upMaths The code is a little messy but works. I will refactor in the future. :)

GGB scripting version 1

A1 = (0, 0) A2 = (x(A1) + 0.87, y(A1) + 0.5) A3 = (x(A1) + 0.87, y(A1) + 3) A4 = (x(A1), y(A1) + 3.5) A5 = (x(A1) -0.87, y(A1) + 3) A6 = (x(A1) - 0.87, y(A1) + 0.5) rightSide = Polygon({A1, A2, A3, A4, A1}) leftSide = Polygon({A1, A4, A5, A6, A1}) rightSide' = Polygon({A1, A2, A3, A4, A1}) leftSide' = Polygon({A1, A4, A5, A6, A1}) block01 = {rightSide, leftSide} block02 = Rotate(block01, 2pi/3, A1) block03 = Rotate(block01, -2pi/3, A1) block02' = Rotate(block01, 2pi/3, A1) block03' = Rotate(block01, -2pi/3, A1) centerFigure = {rightSide, leftSide, block02, block03} #d1 = Length(A1, A4) + Length(A1, A2) B1 = (x(A1) + 3.9, y(A1) + 2.25) B2 = (x(A1), y(A1) + 4.5) B3 = (x(A1) - 3.9, y(A1) + 2.25) B4 = (x(A1) - 3.9, y(A1) - 2.25) B5 = (x(A1), y(A1) - 4.5) B6 = (x(A1) + 3.9, y(A1) - 2.25) Execute(Zip("u"+k+" = Vector(A1, B"+k+")", k, 1...6)) #layer01 = Translate(centerFigure, u1) Execute(Zip("layer0"+k+" = Translate(centerFigure, u"+k+")", k, 1...6)) Execute(Zip("layer0"+k+"' = Translate(centerFigure, u"+k+")", k, 1...6)) small01 = Rotate(Translate(block01, u2), -pi/3, B2) small02 = Rotate(Translate(block01, u2), pi/3, B2) small03 = Rotate(Translate(block01, u2), pi/3, A1) small04 = Translate(Rotate(block01, pi/3, A1), u4) small05 = Translate(Rotate(block01, pi, A1), u4) small06 = Translate(Rotate(block01, pi, A1), u5) small07 = Translate(Rotate(block01, pi, A1), u6) small08 = Translate(Rotate(block01, -pi/3, A1), u6) small09 = Translate(Rotate(block01, -pi/3, A1), u1) small01' = Rotate(Translate(block01, u2), -pi/3, B2) small02' = Rotate(Translate(block01, u2), pi/3, B2) small03' = Rotate(Translate(block01, u2), pi/3, A1) small04' = Translate(Rotate(block01, pi/3, A1), u4) small05' = Translate(Rotate(block01, pi, A1), u4) small06' = Translate(Rotate(block01, pi, A1), u5) small07' = Translate(Rotate(block01, pi, A1), u6) small08' = Translate(Rotate(block01, -pi/3, A1), u6) small09' = Translate(Rotate(block01, -pi/3, A1), u1)

GGB scripting version 2

A1 = (0, 0) A2 = (x(A1) + 0.87, y(A1) + 0.5) A3 = (x(A1) + 0.87, y(A1) + 3) A4 = (x(A1), y(A1) + 3.5) A5 = (x(A1) -0.87, y(A1) + 3) A6 = (x(A1) - 0.87, y(A1) + 0.5) Ln = 1...6 Execute(Zip("SetVisibleInView(A"+k+", 1, false)", k, Ln)) rightSide = Polygon({A1, A2, A3, A4, A1}) leftSide = Polygon({A1, A4, A5, A6, A1}) SetLayer(rightSide, 4) SetLayer(leftSide, 4) rightSide' = Polygon({A1, A2, A3, A4, A1}) leftSide' = Polygon({A1, A4, A5, A6, A1}) SetLayer(rightSide', 5) SetLayer(leftSide', 5) block01 = {rightSide, leftSide} block02 = Rotate(block01, 2pi/3, A1) block03 = Rotate(block01, -2pi/3, A1) SetLayer(block02, 4) SetLayer(block03, 4) block02' = Rotate(block01, 2pi/3, A1) block03' = Rotate(block01, -2pi/3, A1) SetLayer(block02', 5) SetLayer(block03', 5) centerFigure = {rightSide, leftSide, block02, block03} B1 = (x(A1) + 3.9, y(A1) + 2.25) B2 = (x(A1), y(A1) + 4.5) B3 = (x(A1) - 3.9, y(A1) + 2.25) B4 = (x(A1) - 3.9, y(A1) - 2.25) B5 = (x(A1), y(A1) - 4.5) B6 = (x(A1) + 3.9, y(A1) - 2.25) Execute(Zip("SetVisibleInView(B"+k+", 1, false)", k, Ln)) Execute(Zip("u"+k+" = Vector(A1, B"+k+")", k, Ln)) Execute(Zip("SetVisibleInView(u"+k+", 1, false)", k, Ln)) Execute(Zip("first0"+k+" = Translate(centerFigure, u"+k+")", k, Ln)) Execute(Zip("first0"+k+"' = Translate(centerFigure, u"+k+")", k, Ln)) Execute(Zip("SetLayer(first0"+k+", 2)", k, Ln)) Execute(Zip("SetLayer(first0"+k+"', 3)", k, Ln)) Execute(Zip("second0"+k+" = Rotate(Translate(centerFigure, u"+k+"), pi/3, B"+k+")", k, Ln)) Execute(Zip("second0"+k+"' = Rotate(Translate(centerFigure, u"+k+"), pi/3, B"+k+")", k, Ln)) Execute(Zip("SetLayer(second0"+k+", 0)", k, Ln)) Execute(Zip("SetLayer(second0"+k+"', 1)", k, Ln))

Final version

A1 = (0, 0) A2 = (x(A1) + 0.87, y(A1) + 0.5) A3 = (x(A1) + 0.87, y(A1) + 3) A4 = (x(A1), y(A1) + 3.5) A5 = (x(A1) -0.87, y(A1) + 3) A6 = (x(A1) - 0.87, y(A1) + 0.5) Ln = 1...6 Execute(Zip("SetVisibleInView(A"+k+", 1, false)", k, Ln)) rightSide = Polygon({A1, A2, A3, A4, A1}) leftSide = Polygon({A1, A4, A5, A6, A1}) rightSide' = Polygon({A1, A2, A3, A4, A1}) leftSide' = Polygon({A1, A4, A5, A6, A1}) block01 = {rightSide, leftSide} block02 = Rotate(block01, 2pi/3, A1) block03 = Rotate(block01, -2pi/3, A1) block02' = Rotate(block01, 2pi/3, A1) block03' = Rotate(block01, -2pi/3, A1) centerFigure = {rightSide, leftSide, block02, block03} B1 = (x(A1) + 3.9, y(A1) + 2.25) B2 = (x(A1), y(A1) + 4.5) B3 = (x(A1) - 3.9, y(A1) + 2.25) B4 = (x(A1) - 3.9, y(A1) - 2.25) B5 = (x(A1), y(A1) - 4.5) B6 = (x(A1) + 3.9, y(A1) - 2.25) Execute(Zip("SetVisibleInView(B"+k+", 1, false)", k, Ln)) Execute(Zip("u"+k+" = Vector(A1, B"+k+")", k, Ln)) Execute(Zip("SetVisibleInView(u"+k+", 1, false)", k, Ln)) Execute(Zip("first0"+k+" = Translate(centerFigure, u"+k+")", k, Ln)) Execute(Zip("first0"+k+"' = Translate(centerFigure, u"+k+")", k, Ln)) Execute(Zip("second0"+k+" = Rotate(Translate(centerFigure, u"+k+"), pi/3, B"+k+")", k, Ln)) Execute(Zip("second0"+k+"' = Rotate(Translate(centerFigure, u"+k+"), pi/3, B"+k+")", k, Ln)) C1 = (x(A1), y(A1) + 2.5) C2 = (x(A1) + 0.87, y(A1) + 3) C3 = (x(A1), y(A1) + 3.5) C4 = (x(A1) - 0.87, y(A1) + 3) Execute(Zip("SetVisibleInView(C"+k+", 1, false)", k, 1...4)) rom01 = Polygon({C1, C2, C3, C4}) rom02 = Rotate(rom01, 2pi/3) rom03 = Rotate(rom01, -2pi/3) Lk = {5, 6, 1} Execute(Zip("p0"+k+" = Translate(rom01, u"+k+")", k, 1...3)) Execute(Zip("q0"+k+" = Translate(rom02, u"+k+")", k, 3...5)) Execute(Zip("r0"+k+" = Translate(rom03, u"+k+")", k, Lk)) Execute(Zip("p0"+k+"' = Translate(rom01, u"+k+")", k, 1...3)) Execute(Zip("q0"+k+"' = Translate(rom02, u"+k+")", k, 3...5)) Execute(Zip("r0"+k+"' = Translate(rom03, u"+k+")", k, Lk)) #-- Set Layers --# Execute(Zip("SetLayer(second0"+k+", 0)", k, Ln)) Execute(Zip("SetLayer(second0"+k+"', 1)", k, Ln)) Execute(Zip("SetLayer(first0"+k+", 2)", k, Ln)) Execute(Zip("SetLayer(first0"+k+"', 3)", k, Ln)) Execute(Zip("SetLayer(p0"+k+", 4)", k, 1...3)) Execute(Zip("SetLayer(q0"+k+", 4)", k, 3...5)) Execute(Zip("SetLayer(r0"+k+", 4)", k, Lk)) Execute(Zip("SetLayer(p0"+k+"', 5)", k, 1...3)) Execute(Zip("SetLayer(q0"+k+"', 5)", k, 3...5)) Execute(Zip("SetLayer(r0"+k+"', 5)", k, Lk)) SetLayer(rightSide, 6) SetLayer(leftSide, 6) SetLayer(rightSide', 7) SetLayer(leftSide', 7) SetLayer(block02, 6) SetLayer(block03, 6) SetLayer(block02', 7) SetLayer(block03', 7)