Linear interpolation between two vectors. Args: x1 (np.ndarray): [..., d] vector 1 x2 (np.ndarray): [..., d] vector 2 t (np.ndarray): [...] interpolation parameter. [0, 1] for interpolation between x1 and x2, otherwise for extrapolation. Returns: np.nda
(x1: np.ndarray, x2: np.ndarray, t: np.ndarray)
| 993 | |
| 994 | |
| 995 | def lerp(x1: np.ndarray, x2: np.ndarray, t: np.ndarray) -> np.ndarray: |
| 996 | """ |
| 997 | Linear interpolation between two vectors. |
| 998 | |
| 999 | Args: |
| 1000 | x1 (np.ndarray): [..., d] vector 1 |
| 1001 | x2 (np.ndarray): [..., d] vector 2 |
| 1002 | t (np.ndarray): [...] interpolation parameter. [0, 1] for interpolation between x1 and x2, otherwise for extrapolation. |
| 1003 | |
| 1004 | Returns: |
| 1005 | np.ndarray: [..., d] interpolated vector |
| 1006 | """ |
| 1007 | return x1 + np.asarray(t)[..., None] * (x2 - x1) |
| 1008 | |
| 1009 | |
| 1010 | def lerp_se3_matrix(T1: np.ndarray, T2: np.ndarray, t: np.ndarray) -> np.ndarray: |
no outgoing calls
no test coverage detected