rerun-viewer / utils /geometry.py
abreza's picture
refactor and organize files
ffbf761
raw
history blame
353 Bytes
import numpy as np
from scipy.spatial.transform import Rotation
from typing import Dict
def vector3_to_numpy(vec: Dict[str, float]) -> np.ndarray:
return np.array([vec['x'], vec['y'], vec['z']])
def euler_to_quaternion(euler: Dict[str, float]) -> np.ndarray:
return Rotation.from_euler('xyz', [euler['x'], euler['y'], euler['z']]).as_quat()