Bug fixes
This commit is contained in:
parent
98a329c9d9
commit
942b480aaa
|
@ -8,6 +8,7 @@ class Circle:
|
|||
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 <= distance / 2, "radius must be smaller then half the distance"
|
||||
assert distance >= 2*radius, "distance must be grater then two times the radius"
|
||||
assert offset_percentage >= 0, "offset can only be 0 - 100 %"
|
||||
assert offset_percentage <= 100, "offset can only be 0 - 100 %"
|
||||
|
@ -46,6 +47,7 @@ class Circle:
|
|||
@radius.setter
|
||||
def radius(self, val):
|
||||
assert val >= 0, "radius can not be negative"
|
||||
assert radius <= self.__distance / 2, "radius must be smaller then half the distance"
|
||||
self.__radius = val
|
||||
|
||||
@property
|
||||
|
@ -56,6 +58,7 @@ class Circle:
|
|||
def distance(self, val):
|
||||
assert val >= 2 * self.__radius, "distance must be grater then two times the radius"
|
||||
self.__distance = val
|
||||
self.__offset = (val / 100) * self.__offset_percentage
|
||||
|
||||
@property
|
||||
def offset_percentage(self):
|
||||
|
@ -73,7 +76,7 @@ class Circle:
|
|||
x = self.__radius
|
||||
y = self.__radius
|
||||
i = 1
|
||||
dictance_y = (math.sqrt(3) / 2) * self.__distance
|
||||
distance_y = (math.sqrt(3) / 2) * self.__distance
|
||||
|
||||
canvas = draw.Drawing(self.__length, self.__height, origin=(0, 0))
|
||||
|
||||
|
@ -90,13 +93,13 @@ class Circle:
|
|||
else:
|
||||
x = self.__radius + self.__offset
|
||||
|
||||
y = y + dictance_y
|
||||
y = y + distance_y
|
||||
i = i + 1
|
||||
|
||||
if generate_shifted_pattern:
|
||||
i = 1
|
||||
x_shifted = self.__radius + self.__distance / 2
|
||||
y_shifted = self.__radius + dictance_y / (2 * math.sqrt(3))
|
||||
y_shifted = self.__radius + distance_y / (2 * math.sqrt(3))
|
||||
|
||||
canvas_shifted = draw.Drawing(self.__length, self.__height, origin=(0, 0))
|
||||
|
||||
|
@ -111,7 +114,7 @@ class Circle:
|
|||
x_shifted = self.__radius + self.__distance / 2
|
||||
else:
|
||||
x_shifted = self.__radius + self.__distance / 2 + self.__offset
|
||||
y_shifted = y_shifted + dictance_y
|
||||
y_shifted = y_shifted + distance_y
|
||||
i = i + 1
|
||||
|
||||
if filetype == 'svg':
|
||||
|
|
Loading…
Reference in New Issue