Script: Pythagoras tree

Script
[size=150]#=====================[br]# Define auxiliar tool[br]#=====================[br][br]A =(0, 0)[br]B = (4, 0)[br]base = Polygon(A, B, 4)[br][br]E = Midpoint(C, D)[br]arc = Semicircle(D, C)[br]F = Point(arc)[br]α = Angle(C, E, F)[br][br]C' = Rotate(C, α, E)[br]C'_1 = Rotate(C, α, E)[br][br]pointsBase = {D, C', C'_1, C}[br][br]ShowExtra = false[br]SetConditionToShowObject(A, ShowExtra)[br]SetConditionToShowObject(B, ShowExtra)[br]#SetConditionToShowObject(base, ShowExtra)[br]SetConditionToShowObject(C, ShowExtra)[br]SetConditionToShowObject(D, ShowExtra)[br]SetConditionToShowObject(E, ShowExtra)[br]SetConditionToShowObject(arc, ShowExtra)[br]#SetConditionToShowObject(F, ShowExtra)[br]SetConditionToShowObject(α, ShowExtra)[br]SetConditionToShowObject(C', ShowExtra)[br]SetConditionToShowObject(C'_1, ShowExtra)[br]SetConditionToShowObject(pointsBase, ShowExtra)[br][br]# In this case I defined the tool as: [br]# BasePoints( , , )[br][br][br]#=====================[br]# Construction begins[br]#=====================[br][br]N = 7[br]M = Slider(1, N, 1, 1, 160, false, true, false, false)[br]SetValue(M, N)[br]Lm = Sequence(1, M)[br]LN = Sequence(1, N)[br][br]Sname = Zip("S" + Text(n), n, LN)[br]Execute(Zip(name " = Sequence(k, k, 1, 2^("+(n+1)+"), 2)", name, Sname, n, LN ))[br]LK = Remove(LN, {1})[br]Tname = Zip("T" + Text(n), n, LK)[br]Execute(Zip(name " = Sequence(k, k, 1, 2^("+(n+1)+"), 4)", name, Tname, n, LK ))[br][br]#=====================[br]# Points[br]#=====================[br]Execute( Join( {"points1 = BasePoints(A, B, α)"}, Zip( "points"+(n+1)+" = Join(Zip(BasePoints(Element(points"+(n)+", k), Element(points"+(n)+", k + 1), α), k, S"+n+")) ", n, LN) ) )[br]SetVisibleInView(points8, 1, false)[br][br]#=====================[br]# Squares[br]#=====================[br]Execute(Zip( "squares"+n+" = Zip(Polygon(Element(points"+n+", k), Element(points"+n+", k + 1), 4), k, S"+n+")", n, LN))[br][br]#=====================[br]# Triangles[br]#=====================[br]triangles1 = Polygon(points1)[br][br]Execute( Zip( "triangles"+(n)+" = Zip(Polygon(Element(points"+(n)+", k), Element(points"+(n)+", k + 1), Element(points"+(n)+", k + 3)), k, T"+(n)+")", n, LK) )[br][br]#=========================[br]# Settings. Let's make it pretty :-)[br]#=========================[br][br]SetVisibleInView(Sname, 1, false)[br]SetVisibleInView(Tname, 1, false)[br]Execute(Zip("SetVisibleInView(S"+k+", 1, false)", k, LN))[br]Execute(Zip("SetVisibleInView(T"+k+", 1, false)", k, LK))[br][br][br]Execute(Zip("SetConditionToShowObject(points"+k+", "+k+"<=M)", k, LN))[br]Execute(Zip("SetConditionToShowObject(squares"+k+", "+k+"<=M)", k, LN))[br]Execute(Zip("SetConditionToShowObject(triangles"+k+", "+k+"<=M)", k, LN))[br][br][/size][size=150]#====================================================[br]# Maybe there is an easier way to do this. [br]# What do you think Thijs?[br]# See this [url=https://www.geogebra.org/p/iqSaNXfoFec]thread[/url] for details[br]#====================================================[/size]

Information: Script: Pythagoras tree