valetudo-map-parser 0.1.9b70__tar.gz → 0.1.9b72__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/PKG-INFO +1 -1
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/config/drawable.py +61 -62
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/pyproject.toml +1 -1
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/LICENSE +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/NOTICE.txt +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/README.md +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/__init__.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/config/__init__.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/config/async_utils.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/config/auto_crop.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/config/color_utils.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/config/colors.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/config/drawable_elements.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/config/enhanced_drawable.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/config/optimized_element_map.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/config/rand256_parser.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/config/shared.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/config/types.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/config/utils.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/hypfer_draw.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/hypfer_handler.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/hypfer_rooms_handler.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/map_data.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/py.typed +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/rand256_handler.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/reimg_draw.py +0 -0
- {valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/rooms_handler.py +0 -0
@@ -223,9 +223,7 @@ class Drawable:
|
|
223
223
|
|
224
224
|
@staticmethod
|
225
225
|
def point_inside(x: int, y: int, points: list[Tuple[int, int]]) -> bool:
|
226
|
-
"""
|
227
|
-
Check if a point (x, y) is inside a polygon defined by a list of points.
|
228
|
-
"""
|
226
|
+
"""Check if a point (x, y) is inside a polygon defined by a list of points."""
|
229
227
|
n = len(points)
|
230
228
|
inside = False
|
231
229
|
xinters = 0.0
|
@@ -243,79 +241,80 @@ class Drawable:
|
|
243
241
|
|
244
242
|
@staticmethod
|
245
243
|
def _line(
|
246
|
-
layer:
|
244
|
+
layer: np.ndarray,
|
247
245
|
x1: int,
|
248
246
|
y1: int,
|
249
247
|
x2: int,
|
250
248
|
y2: int,
|
251
249
|
color: Color,
|
252
250
|
width: int = 3,
|
253
|
-
) ->
|
251
|
+
) -> np.ndarray:
|
254
252
|
"""
|
255
|
-
Draw a line on a NumPy array (layer) from point A to B using
|
256
|
-
|
253
|
+
Draw a line on a NumPy array (layer) from point A to B using Bresenham's algorithm.
|
254
|
+
|
257
255
|
Args:
|
258
|
-
layer: The numpy array to draw on
|
256
|
+
layer: The numpy array to draw on (H, W, C)
|
259
257
|
x1, y1: Start point coordinates
|
260
258
|
x2, y2: End point coordinates
|
261
|
-
color: Color to draw with
|
262
|
-
width: Width of the line
|
259
|
+
color: Color to draw with (tuple or array)
|
260
|
+
width: Width of the line in pixels
|
263
261
|
"""
|
264
|
-
# Ensure coordinates are integers
|
265
262
|
x1, y1, x2, y2 = int(x1), int(y1), int(x2), int(y2)
|
266
|
-
|
267
|
-
# Get blended color for the line
|
263
|
+
|
268
264
|
blended_color = get_blended_color(x1, y1, x2, y2, layer, color)
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
@staticmethod
|
307
|
-
async def draw_virtual_walls(
|
308
|
-
layer: NumpyArray, virtual_walls, color: Color
|
309
|
-
) -> NumpyArray:
|
310
|
-
"""
|
311
|
-
Draw virtual walls on the input layer.
|
312
|
-
"""
|
313
|
-
for wall in virtual_walls:
|
314
|
-
for i in range(0, len(wall), 4):
|
315
|
-
x1, y1, x2, y2 = wall[i : i + 4]
|
316
|
-
# Draw the virtual wall as a line with a fixed width of 6 pixels
|
317
|
-
layer = Drawable._line(layer, x1, y1, x2, y2, color, width=6)
|
265
|
+
|
266
|
+
dx = abs(x2 - x1)
|
267
|
+
dy = abs(y2 - y1)
|
268
|
+
sx = 1 if x1 < x2 else -1
|
269
|
+
sy = 1 if y1 < y2 else -1
|
270
|
+
err = dx - dy
|
271
|
+
|
272
|
+
half_w = width // 2
|
273
|
+
h, w = layer.shape[:2]
|
274
|
+
|
275
|
+
while True:
|
276
|
+
# Draw a filled circle for thickness
|
277
|
+
yy, xx = np.ogrid[-half_w:half_w + 1, -half_w:half_w + 1]
|
278
|
+
mask = xx**2 + yy**2 <= half_w**2
|
279
|
+
y_min = max(0, y1 - half_w)
|
280
|
+
y_max = min(h, y1 + half_w + 1)
|
281
|
+
x_min = max(0, x1 - half_w)
|
282
|
+
x_max = min(w, x1 + half_w + 1)
|
283
|
+
|
284
|
+
submask = mask[
|
285
|
+
(y_min - (y1 - half_w)):(y_max - (y1 - half_w)),
|
286
|
+
(x_min - (x1 - half_w)):(x_max - (x1 - half_w))
|
287
|
+
]
|
288
|
+
layer[y_min:y_max, x_min:x_max][submask] = blended_color
|
289
|
+
|
290
|
+
if x1 == x2 and y1 == y2:
|
291
|
+
break
|
292
|
+
|
293
|
+
e2 = 2 * err
|
294
|
+
if e2 > -dy:
|
295
|
+
err -= dy
|
296
|
+
x1 += sx
|
297
|
+
if e2 < dx:
|
298
|
+
err += dx
|
299
|
+
y1 += sy
|
300
|
+
|
318
301
|
return layer
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
@staticmethod
|
306
|
+
async def draw_virtual_walls(
|
307
|
+
layer: NumpyArray, virtual_walls, color: Color
|
308
|
+
) -> NumpyArray:
|
309
|
+
"""
|
310
|
+
Draw virtual walls on the input layer.
|
311
|
+
"""
|
312
|
+
for wall in virtual_walls:
|
313
|
+
for i in range(0, len(wall), 4):
|
314
|
+
x1, y1, x2, y2 = wall[i : i + 4]
|
315
|
+
# Draw the virtual wall as a line with a fixed width of 6 pixels
|
316
|
+
layer = Drawable._line(layer, x1, y1, x2, y2, color, width=6)
|
317
|
+
return layer
|
319
318
|
|
320
319
|
@staticmethod
|
321
320
|
async def lines(arr: NumpyArray, coords, width: int, color: Color) -> NumpyArray:
|
File without changes
|
File without changes
|
File without changes
|
{valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/hypfer_draw.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/map_data.py
RENAMED
File without changes
|
{valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/py.typed
RENAMED
File without changes
|
File without changes
|
{valetudo_map_parser-0.1.9b70 → valetudo_map_parser-0.1.9b72}/SCR/valetudo_map_parser/reimg_draw.py
RENAMED
File without changes
|
File without changes
|