RigidMotion

Contents

RigidMotion#

class pulserver.virtual.RigidMotion[source]#

Bases: object

A subject moving as a rigid body, as Isochromats takes a motion.

At time t, in s on the isochromats’ clock, the point p of the subject at rest lies at R(t) (p - centre) + centre + offset(t), every vector along the axes of the positions, in m.

Parameters:
  • rotation (callable, optional) – R(t), a (3, 3) orthonormal matrix; the identity without one.

  • offset (callable, optional) – offset(t), a translation of (3,) metres; none without one.

  • centre (array_like, default=(0, 0, 0)) – The point rotation turns about, in m.

Examples

A nod of 2 degrees about x, once every 4 s, and a drift of 1 mm/min along z:

>>> import numpy as np
>>> from pulserver.virtual import RigidMotion
>>> def nod(t):
...     angle = np.radians(2.0) * np.sin(2.0 * np.pi * t / 4.0)
...     c, s = np.cos(angle), np.sin(angle)
...     return np.array([[1.0, 0.0, 0.0], [0.0, c, -s], [0.0, s, c]])
>>> motion = RigidMotion(nod, lambda t: [0.0, 0.0, 1e-3 * t / 60.0])
>>> motion(1.0, np.array([[0.0, 0.1, 0.0]])).round(5)
array([[0.     , 0.09994, 0.00351]])

Methods

transform

Return (R, shift), with which the point p at rest lies at R @ p + shift at t.