mirror of
https://github.com/enzet/map-machine.git
synced 2025-04-28 17:57:11 +02:00
Issue #114: wrap temporarily matrix creation.
If the resulting canvas is too big, overlap algorithm may fail to create matrix for occupied space.
This commit is contained in:
parent
28ab57676e
commit
11228c0718
1 changed files with 10 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
"""
|
||||
Point: node representation on the map.
|
||||
"""
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
import numpy as np
|
||||
|
@ -25,6 +26,15 @@ class Occupied:
|
|||
|
||||
def __init__(self, width: int, height: int, overlap: int) -> None:
|
||||
self.matrix = np.full((int(width), int(height)), False, dtype=bool)
|
||||
try:
|
||||
self.matrix = np.full((int(width), int(height)), False, dtype=bool)
|
||||
except Exception:
|
||||
logging.fatal(
|
||||
"Failed to allocate a matrix required by overlap algorithm. "
|
||||
"Try to use smallest area or try --overlap=0 options."
|
||||
)
|
||||
exit(1)
|
||||
|
||||
self.width: float = width
|
||||
self.height: float = height
|
||||
self.overlap: int = overlap
|
||||
|
|
Loading…
Add table
Reference in a new issue