Am looking for a way to trying to perform this change:
A and C are fixed 3D points. B shall then be moved so that AtoB and CtoB have the average distance of what they used to have.
Sounds trivial somehow but the best I got so far is this which ends up flipping the point and somewhat averages if executed multiple times.
Vector3 dir_a = B - A;
Vector3 dir_b = B - C;
float averageDistance = (dir_a.magnitude + dir_b.magnitude) / 2;
dir_a.Normalize();
dir_b.Normalize();
B -= (averageDistance) * (dir_a + dir_b);
Somebody have a hint in the right direction?

It's a bit ambiguous since there is usually a whole ring of valid solutions, but we can choose a point close to the original B (which has one issue which I address at the end). One way to do that, is to create a plane halfway between A and C perpendicular to the line between A and C, then starting on the intersection of that line and that plane, move towards B while staying on the plane until the distance is right. There is no search by the way, we can just calculate the required radius: we'll have a right-angle triangle where we are given the base, and we need to pick a height such that the hypotenuse has the desired length.
Like this:
Note that if A, B, and C, are collinear, then this approach doesn't work. If you care about that, you could detect that and try to use another vector instead of
mid_to_bin that case. Since this approach tries to go in the direction of B, if that direction is perpendicular to the plane then no movement is possible.dirmay become NaN or (thanks to floating point stuff making the vector being normalized only almost zero instead of actually zero) some not particularly useful direction.You can use any direction orthogonal to
axis, ieVector3 dir = Vector3.Normalize(Orthogonal(axis))and you can get some orthogonal vector like this: (if you're not super picky about what direction you get, just that it's orthogonal, and here I pick the longest option mainly to avoid accidentally getting a zero vector)Using that is more robust, but:
avg_d.