String Art (pyggb beta test)
Script:
import time
dim=10
# background:
A=Point(-dim-2,-dim-2, is_visible=False)
B=Point(dim+2,-dim-2, is_visible=False)
background=Polygon(A,B,4,opacity=1,color=[0,0,0])
# fonctions:
def symaxex(M):
P = Point(-M.x,M.y, is_visible=False)
return P
def symaxey(M):
P = Point(M.x,-M.y, is_visible=False)
return P
def symo(M):
P = Point(-M.x,-M.y, is_visible=False)
return P
def astroide(n):
for i in range(n):
t = i / (n - 1)
P1=Point(dim*t,0, is_visible=False)
P2=Point(0,dim*(1-t), is_visible=False)
Segment(P1, P2,color=[t,0.3,0.7],line_thickness=3)
Segment(symaxex(P1), symaxex(P2),color=[t,0.3,0.7],line_thickness=3)
Segment(symaxey(P1), symaxey(P2),color=[t,0.3,0.7],line_thickness=3)
Segment(symo(P1), symo(P2),color=[t,0.3,0.7],line_thickness=3)
time.sleep(0.08)
# pour n=30
astroide(30)
Pour tester et modifier le script :
Lien nº1 : https://geogebra.org/python/index.html
Lien nº2: https://geogebra.github.io/pyggb/