Pythagoras tree Affine 3 for Juan Carlos
For Juan Carlos Ponce Campuzano post "Script: Pythagoras tree"
With some knowledge of lineair algebra you could use affine transformations
This time I projected directly in a 2D View from plane z=1.
See more affine transformations in
Nice to see Monique GOBRIAL using Plant Growing for her Balade-Fleurie-nuit
Below is the creation script of this "Pythagoras tree Affine 3"
z1=(z=1)
#================================================
# Right click on z1 in the Algebra View and select "Create 2D View from z1"
#================================================
P1 =( 0.5, 1, 1)
P2 =(-0.5, 1, 1)
P = Point(Semicircle(P2, P1))
Pol=Polygon({P1, P, P2,(-0.5, 0, 1),( 0.5, 0, 1)})
# Affine transformations (to create Right and Left branches)
#================================================
vL=Vector(P2, P)
vR=Vector(P, P1)
tL=Vector((0,0,0), Midpoint(P, P2))
tR=Vector((0,0,0), Midpoint(P, P1))
L={{x(vL), -y(vL), x(tL)}, {y(vL), x(vL), y(tL)}, {0, 0, 1}}
R={{x(vR), -y(vR), x(tR)}, {y(vR), x(vR), y(tR)}, {0, 0, 1}}
Text = "Augmented matrices"
TextL= FormulaText(L, true, true)
TextR= FormulaText(R, true, true)
# Create 8 levels of branches
#================================================
N = 8
LN = Sequence(1,N)
LM0={{{1,0,0}, {0,1,0}, {0,0,1}}}
Execute[Zip["LM"+k+"=Join[Zip[{M*L, M*R}, M,LM"+(k-1)+"]]", k,LN]]
Execute[Zip["LB"+k+"=Zip[ApplyMatrix[M, Pol], M, LM"+k+"]", k,LN]]
# Settings
#================================================
SetValue(P,(0, 1.5, 1))
SetColor(P, "Red")
SetCaption(P, "Drag!")
ShowLabel(P, true)
M = Slider(0, N, 1, 1, 160, false, true, false, false)
SetValue(M,N)
SetConditionToShowObject(P1, false)
SetConditionToShowObject(P2, false)
SetConditionToShowObject(vR, false)
SetConditionToShowObject(vL, false)
Execute(Zip("SetConditionToShowObject(LB"+k+", "+k+"<=M)", k, LN))
SetCoords[TextL, 0, -0.25]
SetCoords[TextR, 0, -1.5]