/// <summary> /// Reorders the values to match the order of the given <c>JointSet</c>. /// </summary> /// <param name="newOrder">A <c>JointSet</c> with the same name of joints, but in a different order than the current <c>JointSet</c>.</param> /// <returns>A new instance of <c>JointValues</c>.</returns> /// <exception cref="ArgumentException">Thrown when the given <paramref name="newOrder"/> is not a permutation of the names in the <c>JointSet</c>.</exception> public JointValues Reorder(JointSet newOrder) { if (!newOrder.IsSimilar(this.JointSet)) { throw new ArgumentException("The given joint set must be similar to the current joint set.", nameof(newOrder)); } return(new JointValues(newOrder, newOrder.Select(x => this[x]))); }