Mustergenerator/Dreieck.py

64 lines
1.1 KiB
Python

# -*- coding: utf-8 -*-
"""
Created on Sun Oct 29 21:51:09 2023
@author: Lukas
"""
import drawsvg as draw
import math
# Mittelpunkt X-Koordinate
x1=0
# Mittelpunkt Y-Koordinate
y1=0
# Schlüsselbreite
sb = 50.0000
#Breite Feld
length=10000
#Höhe Feld
height = 10000
#Abstand X
ax=20
#Abstand Y
ay=30
#Versatz der Spalten
versatz= 0
#höhe dreieck
h= 20
#breite dreieck
b = 30
#Def
v=0
g=-1
r=1
x=0
y=0
f=-1
size = sb/math.sqrt(3)
d = draw.Drawing(length, height, origin=(0, 0))
x =x1
y =y1
while y <= height:
x=x1+((versatz)*v)
while x <= length:
if f == -1:
d.append(draw.Lines(x, y, x+b, y, x+b/2, y+h,
fill='red', stroke='black', close='true'))
else:
d.append(draw.Lines(x, y+h, x+b, y+h, x+b/2, y,
fill='red', stroke='black', close='true'))
f=-f
x =x+ax
y =y+ay
v= -((1-g)/2)
g=-g
d.append(draw.Circle(0, 0, 40))
#plt.show()
d.save_svg('polygon.svg')