@@ -757,14 +757,20 @@ def as_homogeneous_matrix(self, translation_unit: UnitLike) -> np.ndarray:
757
757
time_dim = 1
758
758
759
759
rotation = np .resize (self .orientation .data , (time_dim , 3 , 3 ))
760
- translation = np .resize (
761
- self .coordinates .data .to (translation_unit ).m , (time_dim , 3 )
762
- )
763
- homogeneous_matrix = np .resize (np .identity (4 ), (time_dim , 4 , 4 ))
764
- homogeneous_matrix [:, :3 , :3 ] = rotation
765
- homogeneous_matrix [:, :3 , 3 ] = translation
760
+ coordinates = self .coordinates
761
+ if not isinstance (coordinates , TimeSeries ):
762
+ translation = np .resize (
763
+ coordinates .data .to (translation_unit ).m , (time_dim , 3 )
764
+ )
765
+ homogeneous_matrix = np .resize (np .identity (4 ), (time_dim , 4 , 4 ))
766
+ homogeneous_matrix [:, :3 , :3 ] = rotation
767
+ homogeneous_matrix [:, :3 , 3 ] = translation
766
768
767
- return np .squeeze (homogeneous_matrix )
769
+ return np .squeeze (homogeneous_matrix )
770
+ else :
771
+ raise NotImplementedError (
772
+ "Cannot convert LCS with `TimeSeries` coordinates to homogeneous matrix"
773
+ )
768
774
769
775
def _interp_time_orientation (self , time : Time ) -> xr .DataArray :
770
776
"""Interpolate the orientation in time."""
0 commit comments