This is a very specific question and since I am no mathematician by trade I did not really figure out how to ask it in mathematical jargon, I apologize in advance for the inconvenience.
This is a problem I stumbled upon while doing regular linear algebra for an application for computational chemistry. It showed up in a subroutine to assemble the geometry of a large, complicated molecule which I had to do one piece at a time. I jotted down a few trials on how to solve this, but it got me stumped real fast and I can't find a way out.
Stripped from its chemical details, the problem is as such.
Suppose there is a set of points $\mathcal{S}$ in 3D Euclidian space $\mathbb{R}^3$ which is a subset of a larger set $\mathcal{A}$. Each of these points have a color. They can all be the same color or each be a different color or any combination of colors. Each color $c$ is associated with a certain distance $d_c$. This value $d_c$ is the optimal distance from the origin for the points of color $c$.
The solution to the problem would be to find the rotations and translations that transform the entire set of points $\mathcal{A}$ such that the norm of the position vector $|\vec{p}_i|$ of each point in $\mathcal{S}$ is as close as possible to each of their optimal distances.
So the question is: Is it possible to find the rotation matrices and translation vectors that accomplish that? Is there a procedure to do it?
P.S: It is important that the transformations be applied to all the points in $\mathcal{A}$ simultaneously.
From your description it looks like all the points are fixed relative to each other. In that case, the only freedom is locating the origin. Let $d_k$ be the optimum distance for point $k$ while $s_k(x)$ is the distance when the origin is at a point $x$. Your problem is minimizing $\sum\limits_k (d_k-s_k(x))^2$ as a function of $x$.
Alternatively you might want to minimize $\sum\limits_k |d_k-s_k(x)|$.
Specifically, let $(y_{1k},y_{2k},y_{3k})$ be the location of point $k$ and $(x_1,x_2,x_3)$ the origin. So $s_k(x)=\sqrt{\sum\limits_{j=1}^3(y_{jk}-x_j)^2}$