Skip to content

Commit 243f8d9

Browse files
authored
Merge pull request #90 from konbraphat51/dev
Version 1.0.7
2 parents d968f6b + 6576756 commit 243f8d9

File tree

3 files changed

+20
-31
lines changed

3 files changed

+20
-31
lines changed

AnimatedWordCloud/Animator/AllocationCalculator/StaticAllocationCalculator/StaticAllocationStrategies/MagneticAllocation/MagnetOuterFrontier.py

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def _detect_frontier_linealy(
136136
image_width: int,
137137
image_height: int,
138138
rect_added: Rect,
139-
frontier_former_side: list[tuple[int, int]],
139+
frontier_side: list[tuple[int, int]],
140140
) -> list[tuple[int, int]]:
141141
"""
142142
Detect the frontier from 1 line.
@@ -163,14 +163,11 @@ def _detect_frontier_linealy(
163163
:rtype: list[tuple[int, int]]
164164
"""
165165
# a clone made
166-
frontier_former_side = _sort_by_direction(
167-
frontier_former_side, detection_ray_direction
168-
)
166+
frontier_side = _sort_by_direction(frontier_side, detection_ray_direction)
169167

170168
# true while the launcher is in the area hitting the rect_added
171169
hitting = False
172170

173-
detected_points = []
174171
image_size = (image_width, image_height)
175172
launcher_position = launcher_point_start.clone()
176173

@@ -191,9 +188,9 @@ def _detect_frontier_linealy(
191188
Rect((0, 0), image_size),
192189
)
193190

194-
# update detected_points
195-
_process_ray_result(
196-
result_ray_launched, detected_points, launcher_direction
191+
# update frontier
192+
_remember_ray_result(
193+
result_ray_launched, frontier_side, launcher_direction
197194
)
198195

199196
# if the ray launcher escapes from the new rect hitting area...
@@ -204,16 +201,16 @@ def _detect_frontier_linealy(
204201
# move launcher
205202
launcher_position += launcher_direction
206203

207-
return detected_points
204+
return frontier_side
208205

209206

210-
def _process_ray_result(
207+
def _remember_ray_result(
211208
result_ray_launched: tuple[Vector, Rect] | None,
212209
detected_points: list[tuple[int, int]],
213210
launcher_direction: Vector,
214211
) -> None:
215212
"""
216-
process the result of the ray launched.
213+
remember the result of the ray launched.
217214
218215
:param tuple[Vector, Rect]|None result_ray_launched: Result of the ray launched
219216
:param list[tuple[int, int]] detected_points: List of points that are detected. This will be modified.
@@ -331,31 +328,23 @@ def _will_hit_rect_added(
331328
:rtype: bool
332329
"""
333330

334-
if (
335-
# if the launcher moving vertically...
336-
(launcher_direction.x == 0)
337-
and
331+
# if the launcher moving vertically...
332+
if launcher_direction.x == 0:
338333
# ...check y axis
339-
(
334+
return (
340335
rect_added.left_top[1]
341336
<= launcher_position.y
342337
<= rect_added.right_bottom[1]
343338
)
344-
):
345-
# ... is hitting
346-
return True
339+
347340
# if the launcher moving horizontally...
348-
# ...check x axis
349-
elif (
350-
rect_added.left_top[0]
351-
<= launcher_position.x
352-
<= rect_added.right_bottom[0]
353-
):
354-
# ... is hitting
355-
return True
356341
else:
357-
# ... is not hitting
358-
return False
342+
# ...check x axis
343+
return (
344+
rect_added.left_top[0]
345+
<= launcher_position.x
346+
<= rect_added.right_bottom[0]
347+
)
359348

360349

361350
def _add_newly_found_point(

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# AnimatedWordCloud ver 1.0.6
1+
# AnimatedWordCloud ver 1.0.7
22

33
**UNDER CONSTRUCTION**
44

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def requirements_from_file(file_name):
1919

2020
setup(
2121
name="AnimatedWordCloudTimelapse",
22-
version="1.0.6",
22+
version="1.0.7",
2323
description="Animate a timelapse of word cloud",
2424
long_description=readme,
2525
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)