c4dynamics.states.lib.quatbody.quatbody.data

Contents

c4dynamics.states.lib.quatbody.quatbody.data#

quatbody.data(var=None, scale=1.0)[source]#

Returns arrays of stored time and data.

Extends state.data() with the Euler angles phi, theta, psi, which are derived from the stored quaternion histories (see quat2euler). For every other variable, the behavior is identical to state.data().

Parameters:
  • var (str, optional) – The name of the variable or parameter of the required histories. In addition to the state variables and the parameters, phi, theta, psi are supported.

  • scale (float or int, optional) – A scaling factor to apply to the variable values. Defaults to 1.

Returns:

out (tuple of numpy.array or numpy.array) – A tuple of the time and the variable histories, or the entire state histories if var is not provided.

Examples

>>> qb = c4d.quatbody()
>>> for t in [0, 1, 2]:
...   qb.psi = t * 10 * c4d.d2r
...   qb.store(t)
>>> qb.data('psi', c4d.r2d)  
(array([0, 1, 2]), array([0, 10, 20]))