diverse Anpassungen während das Meetings
This commit is contained in:
parent
76f00b46cb
commit
98a329c9d9
|
@ -4,7 +4,7 @@ import math
|
|||
|
||||
|
||||
class Circle:
|
||||
def __init__(self, name: str, filepath: str, length=50, height=50, radius=2, distance=4.5, offset_percentage=50):
|
||||
def __init__(self, name: str, filepath: str, length=50, height=50, radius=1, distance=2.4, offset_percentage=50):
|
||||
assert length >= 0, "length can not be negative"
|
||||
assert height >= 0, "height can not be negative"
|
||||
assert radius >= 0, "radius can not be negative"
|
||||
|
@ -54,7 +54,7 @@ class Circle:
|
|||
|
||||
@distance.setter
|
||||
def distance(self, val):
|
||||
assert val >= 2 * radius, "distance must be grater then two times the radius"
|
||||
assert val >= 2 * self.__radius, "distance must be grater then two times the radius"
|
||||
self.__distance = val
|
||||
|
||||
@property
|
||||
|
@ -73,6 +73,7 @@ class Circle:
|
|||
x = self.__radius
|
||||
y = self.__radius
|
||||
i = 1
|
||||
dictance_y = (math.sqrt(3) / 2) * self.__distance
|
||||
|
||||
canvas = draw.Drawing(self.__length, self.__height, origin=(0, 0))
|
||||
|
||||
|
@ -89,13 +90,13 @@ class Circle:
|
|||
else:
|
||||
x = self.__radius + self.__offset
|
||||
|
||||
y = y + self.__distance
|
||||
y = y + dictance_y
|
||||
i = i + 1
|
||||
|
||||
if generate_shifted_pattern:
|
||||
i = 1
|
||||
x_shifted = self.__radius + self.__distance / 2
|
||||
y_shifted = self.__radius + self.__distance / 2
|
||||
y_shifted = self.__radius + dictance_y / (2 * math.sqrt(3))
|
||||
|
||||
canvas_shifted = draw.Drawing(self.__length, self.__height, origin=(0, 0))
|
||||
|
||||
|
@ -110,7 +111,7 @@ class Circle:
|
|||
x_shifted = self.__radius + self.__distance / 2
|
||||
else:
|
||||
x_shifted = self.__radius + self.__distance / 2 + self.__offset
|
||||
y_shifted = y_shifted + self.__distance
|
||||
y_shifted = y_shifted + dictance_y
|
||||
i = i + 1
|
||||
|
||||
if filetype == 'svg':
|
||||
|
@ -222,6 +223,7 @@ class Hexagon:
|
|||
if generate_shifted_pattern:
|
||||
x_shifted = distance / 2
|
||||
y_shifted = distance / (2 * math.sqrt(3))
|
||||
i = 1
|
||||
|
||||
canvas_shifted = draw.Drawing(self.__length, self.__height, origin=(0, 0))
|
||||
|
||||
|
@ -250,9 +252,9 @@ class Hexagon:
|
|||
x_shifted = x_shifted + distance
|
||||
|
||||
if i % 2 == 0:
|
||||
x_shifted = 0
|
||||
else:
|
||||
x_shifted = distance / 2
|
||||
else:
|
||||
x_shifted = distance
|
||||
|
||||
y_shifted = y_shifted + distance_y
|
||||
i = i + 1
|
||||
|
@ -426,7 +428,7 @@ if __name__ == '__main__':
|
|||
except AssertionError as error:
|
||||
print(error)
|
||||
print(
|
||||
f"\nAktuelle Werte\n1. Höhe: {circle.height} mm\n2. Länge: {circle.length} mm\n3. Radius: {circle.radius} mm\n4. Abstand: {circle.distance} mm\n5. Offset: {circle.offset_percentage} %\n6. Versetztes Muster generiren: {shift}\n7. Dateityp: {filetype}\n>")
|
||||
f"\nAktuelle Werte\n1. Höhe: {circle.height} mm\n2. Länge: {circle.length} mm\n3. Radius: {circle.radius} mm\n4. Abstand: {circle.distance} mm\n5. Offset: {circle.offset_percentage} %\n6. Versetztes Muster generiren: {shift}\n7. Dateityp: {filetype}\n")
|
||||
|
||||
circle.circle_generation(filetype, shift)
|
||||
|
||||
|
|
Loading…
Reference in New Issue