Average Rotation
The Average Rotation node is used for computing average rotations and displacements of a virtual rigid body, which is represented by a number of points in the structure. The corresponding velocities and accelerations are also computed.
In the general case, the number of points can be larger than what is needed to define a rigid body movement (3 in 3D and 2 in 2D). Unless the points are attached to a rigid object, it is only possible to determine the rotation in an average sense.
If a certain reference point has a given translation up and a rotation Θp, then the displacement of any other point i can under rigid body assumptions be computed as
where ri is the distance vector from the reference point to point i. The equation in this form is valid under the assumption of small rotations. In case of large rotations, the displacement due to rotation is instead described by a rotation matrix R:
Here, I is the identity matrix. The rotation matrix is described with a quaternion formulation where parameters a, b, c, and d are components of a unit quaternion.
An extra constraint must be added to enforce a unit quaternion.
In 2D, points can only rotate about the z-axis. The rotation matrix requires only one dependent variable, the rotation angle ϕ:
The average rotation and displacement for the set of points is determined using the method of least squares. The square of the difference between the actual displacements and the assumed rigid-body displacement is minimized,
Here, the up and Θp are replaced with the sought-after average displacement uavg and average rotation Θavg respectively. The vector Θavg is the axis-angle representation of the rotation. The magnitude, ||Θavg||, is the rotation angle.
The average velocity and acceleration of the set of points are given as the first and second derivative with respect to time.
;
Analogous, the average angular velocity and accelerations are defined as
;