Information about the rotation of an object can be described by different representations, e.g. Euler angles, rotation matrices or quaternions. The latter representation is being intensively exploited in many applications, because of the compact description and interesting properties. In the paper the filtering method for rotational trajectories is proposed. We generalize anisotropic diffusion process defined for two dimensional images, taking into consideration specific properties of rotational motion. Filtering of trajectories in Euclidean space has already been researched in detail using different approaches. However, the straightforward application of well known filtering methods for the rotational space fails to produce appropriate results. We propose a new algorithm for processing trajectories directly in four dimensional space of unit quaternions. In the paper practical examples of the process, theoretical properties and numerical evaluation of the algorithm are presented.