py3dframe.Frame.save_to_dict#
- Frame.save_to_dict(method: str | Sequence[str] = ['quaternion', 'rotation_vector', 'rotation_matrix']) Dict[str, Any] [source]#
Save the Frame object to a dictionary.
The dictionary has the following structure:
{ "translation": [float, float, float], "quaternion": [float, float, float, float], "rotation_vector": [float, float, float], "rotation_matrix": [[float, float, float], [float, float, float], [float, float, float]], "euler_angles": [float, float, float], "convention": int "parent": None }
The quaternion is given in WXYZ format (scalar first).
The rotation vector is given in radians.
The Euler angles are given in radians and the axes are “xyz”.
The rotation is given in the convention of the frame.
The translation vector is given in the convention of the frame.
See also
method
py3dframe.Frame.load_from_dict()
to load the Frame object from a dictionary.
For the reader, only one of the rotation keys is needed to reconstruct the frame. The other keys are provided for convenience and user experience. The reader chooses the key to use in the following order of preference if several are given:
quaternion
rotation_vector
rotation_matrix
euler_angles
Warning
euler_angles
can raise a this warning :UserWarning: Gimbal lock detected. Setting third angle to zero since it is not possible to uniquely determine all angles.
I recommand to not use it.
Note
For retrocompatibility, the default method “quaternion” must be used.
- Parameters:
method (Union[str, Sequence[str]], optional) – The method to use to save the rotation. It can be one of the following : “quaternion”, “rotation_vector”, “rotation_matrix” or “euler_angles”. Several methods can be used at the same time. Default is [“quaternion”, “rotation_vector”, “rotation_matrix”].
- Returns:
The dictionary containing the Frame object.
- Return type:
Dict[str, Any]