Key the cache of Transforms using the trajectory.

Fix #303.