Suppose I have 5 Vector3s, A-E.
I want to know how to rotate D about A so that A, B, and D are collinear.
Then I want to know how to rotate E about A so that A, C, and E are collinear.
And then I want to know how to take those two rotations, average them together, and instead rotate D and E about A with that average rotation, so that A, B, and D are sort-of collinear and A, C, and E are sort-of collinear… it’s supposed to be a best attempt at satisfying both constraints only rotating D and E about A with a single rotation.
I think this will involve Quaternions, but beyond that, I’m not really sure how to do this.
var q1 = Quaternion.FromToRotation(D - A, B - A);
var q2 = Quaternion.FromToRotation(E - A, C - A);
var avg = Quaternion.Slerp(q1, q2, 0.5);
D = A + avg * (D - A);
E = A + avg * (E - A);
Thanks, ArtOfWarfare. Your method is straightforward and works. I wrote a version for an arbitrary quaternion amount:
Quaternion average = new Quaternion(0, 0, 0, 0);
amount = 0;
foreach (var quaternion in quaternions)
average = Quaternion.Slerp(average, quaternion, 1 / markerAmount);