Skip to content

Geometry & Config

Small geometry helpers and YAML configuration loading.

Geometry

geometry

wrap_to_pi

wrap_to_pi(angle)
Source code in src/hivebr/engine/geometry.py
def wrap_to_pi(angle: float) -> float:
    return float((angle + np.pi) % (2 * np.pi) - np.pi)

clamp

clamp(value, min_value, max_value)
Source code in src/hivebr/engine/geometry.py
def clamp(value: float, min_value: float, max_value: float) -> float:
    return max(min_value, min(value, max_value))

distance_between

distance_between(a, b)
Source code in src/hivebr/engine/geometry.py
def distance_between(a, b) -> float:
    return float(np.linalg.norm(np.asarray(a, dtype=float) - np.asarray(b, dtype=float)))

Config

config

load_config

load_config(path)
Source code in src/hivebr/engine/config.py
def load_config(path: str | Path) -> dict[str, Any]:
    path = Path(path)
    with path.open("r", encoding="utf-8") as f:
        return yaml.safe_load(f)