kleinere Anpassungen

This commit is contained in:
Mika 2023-11-01 15:37:01 +01:00
parent 978a85713d
commit 5b2b84dbf0

View File

@ -7,6 +7,7 @@ class Circle:
def __init__(self, name: str, filepath: str, length=1000, height=1000, radius=10, distance=60, offset=50): def __init__(self, name: str, filepath: str, length=1000, height=1000, radius=10, distance=60, offset=50):
# run validations # run validations
assert length >= 0, "length can not be negative" assert length >= 0, "length can not be negative"
assert height >= 0, "height can not be negative"
assert radius >= 0, "radius can not be negative" assert radius >= 0, "radius can not be negative"
assert distance >= 2*radius, "distance must be grater den two times the radius" assert distance >= 2*radius, "distance must be grater den two times the radius"
assert offset >= 0, "offset can only be 0 - 100 %" assert offset >= 0, "offset can only be 0 - 100 %"
@ -28,6 +29,7 @@ class Circle:
@length.setter @length.setter
def length(self, val): def length(self, val):
assert length >= 0, "length can not be negative"
self.__length = val self.__length = val
@property @property
@ -36,6 +38,7 @@ class Circle:
@height.setter @height.setter
def height(self, val): def height(self, val):
assert height >= 0, "height can not be negative"
self.__height = val self.__height = val
@property @property
@ -44,6 +47,7 @@ class Circle:
@radius.setter @radius.setter
def radius(self, val): def radius(self, val):
assert radius >= 0, "radius can not be negative"
self.__radius = val self.__radius = val
@property @property
def distance(self): def distance(self):
@ -51,6 +55,7 @@ class Circle:
@distance.setter @distance.setter
def distance(self, val): def distance(self, val):
assert distance >= 2 * radius, "distance must be grater den two times the radius"
self.__distance = val self.__distance = val
@property @property
@ -63,9 +68,10 @@ class Circle:
@offset.setter @offset.setter
def offset(self, val): def offset(self, val):
assert offset >= 0, "offset can only be 0 - 100 %"
assert offset <= 100, "offset can only be 0 - 100 %"
self.__offset = (self.__distance / 100) * val self.__offset = (self.__distance / 100) * val
def circle_generation(self): def circle_generation(self):
x1 = 10 x1 = 10