PyGGB : Truchet & Translations

# truchet triangles frises translation 2 6/08/2023[br]from random import*[br]import time[br]from math import*[br][br]# background:[br]A=Point(-1,-1,is_visible=False)[br]B=Point(100,-1,is_visible=False)[br]background=Polygon(A,B,4,opacity=1,color=[1,1,1]) [br][br]def motif(n,m,t,u):[br] [br] for i in range(n):[br] for j in range(m):[br] r=random()[br] if r<0.25 :[br] for k in range(0,t):[br] for p in range(0,u):[br] col=[(i+j)/(2*n),(i+j)/(2*n)*r,r**2*abs(sin(k+p))][br] l=[Point(i+k*n,j+p*m,is_visible=False),Point(i+1+k*n,j+p*m,is_visible=False),Point(i+1+k*n,j+1+p*m,is_visible=False)][br] s=Polygon(l,color=col,opacity=1,line_thickness=0)[br] [br] elif r<0.5 :[br] [br] for k in range(0,t):[br] for p in range(0,u):[br] col=[(i+j)/(2*n),(i+j)/(2*n)*r,r**2*abs(sin(k+p))][br] l=[Point(i+k*n,j+p*m,is_visible=False),Point(i+k*n,j+1+p*m,is_visible=False),Point(i+1+k*n,j+p*m,is_visible=False)][br] s=Polygon(l,color=col,opacity=1,line_thickness=0)[br] [br] [br] elif r<0.75 :[br] [br] for k in range(0,t):[br] for p in range(0,u):[br] col=[(i+j)/(2*n),(i+j)/(2*n)*r,r**2*abs(sin(k+p))][br] l=[Point(i+1+k*n,j+p*m,is_visible=False),Point(i+1+k*n,j+1+p*m,is_visible=False),Point(i+k*n,j+1+p*m,is_visible=False)][br] s=Polygon(l,color=col,opacity=1,line_thickness=0)[br] [br] [br] else:[br] [br] for k in range(0,t):[br] for p in range(0,u):[br] col=[(i+j)/(2*n),(i+j)/(2*n)*r,r**2*abs(sin(k+p))][br] l=[Point(i+k*n,j+p*m,is_visible=False),Point(i+k*n,j+1+p*m,is_visible=False),Point(i+1+k*n,j+1+p*m,is_visible=False)][br] s=Polygon(l,color=col,opacity=1,line_thickness=0)[br] [br] [br] time.sleep(0.001)[br] [br]motif(3,4,5,4)
[b][size=150][url=https://geogebra.org/python?name=%23+truchet+triangles++frises+translation+2+6%2F08%2F2023&code=eJzdlV9rwjAUxd%2FzKS7sJa2Zpt1fxvqwPex57yJSa6rXpklJ4sBvv7habTcdDmQbpiW35BwOSX%2BEewHOLLO5cL5iqmZSWIDcoPXVmVRZmTrUCmK4HfD7QczjK5IbXYLXpr5gWWnjQlJXcFiKWi9TN9%2Bq5AImaVbMjF6q6QN5Sl41KkcvI%2BZftOM3tDiRInlJpRUBed7oEef7Dbsw75SrmVb0iT2za6arNEO3SiKWaalNMoyYf0YBABAyFTmU2mFOFSuZY8vggXgBPqZcG0BAtT7YTFC10RppsZPKlrQeJqn%2FBQ06y5iDeeT9%2BAa69iax2CVy5j5lto1V29jsed%2FwR06GFHuLYEDjUAWs9R0aZsIwDtOJpRYVLXpVEIwORvmgGgH2ilCxRa8Ky68cWOOJfuSK9vsO78ZuKcsNVz%2B3WEtUYuzmmBVKWJvwLohmdBaF3PDZh%2BfseX3L4Tiqv0rrML67s%2BN3krt0HOm%2FZmjFmbE7%2Fd37l%2BTWXb5vpRAV5X3Oo24GqXvslW%2FHN%2By61t4BnwAhtw%3D%3D]Lien[/url][/size][/b]

Information: PyGGB : Truchet & Translations