Skip to content

Commit 39b694b

Browse files
committed
fix: check dimensions of bounding box constructor
1 parent f69f6d8 commit 39b694b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

LoopStructural/datatypes/_bounding_box.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,26 @@ def __init__(
3636
nsteps : Optional[np.ndarray], optional
3737
_description_, by default None
3838
"""
39+
if origin is not None and len(origin) != dimensions:
40+
logger.warning(
41+
f"Origin has {len(origin)} dimensions but bounding box has {dimensions}"
42+
)
43+
raise LoopValueError("Origin has incorrect number of dimensions")
44+
if maximum is not None and len(maximum) != dimensions:
45+
logger.warning(
46+
f"Maximum has {len(maximum)} dimensions but bounding box has {dimensions}"
47+
)
48+
raise LoopValueError("Maximum has incorrect number of dimensions")
49+
if global_origin is not None and len(global_origin) != dimensions:
50+
logger.warning(
51+
f"Global origin has {len(global_origin)} dimensions but bounding box has {dimensions}"
52+
)
53+
raise LoopValueError("Global origin has incorrect number of dimensions")
54+
if nsteps is not None and len(nsteps) != dimensions:
55+
logger.warning(
56+
f"Nsteps has {len(nsteps)} dimensions but bounding box has {dimensions}"
57+
)
58+
raise LoopValueError("Nsteps has incorrect number of dimensions")
3959
# reproject relative to the global origin, if origin is not provided.
4060
# we want the local coordinates to start at 0
4161
# otherwise uses provided origin. This is useful for having multiple bounding boxes rela

0 commit comments

Comments
 (0)