So I have two non-unit vectors $f$ and $t $. They are generated from 4 Cartesian positions $ f = [x_2, y_2, z_2 ] - [x_1, y_1, z_1 ] $ and $ t = [x_3, y_3, z_3 ] - [x_1, y_1, z_1 ] $
I know that the distance between the positions are equivalent, $r_{12} = r_{13}$.
But I need to rotate these vectors to be equal, where $\theta = arccos\left(\frac{f}{\vert \vert f \vert \vert} \cdot \frac{t}{\vert \vert t \vert \vert}\right)= 0$ and $ f = t = [x_2, y_2, z_2 ] - [x_1, y_1, z_1 ]$
I need to generate a rotation matrix for this so that way the other Cartesian positions ([$x_4, y_4, z_4$], $\dots, [x_n, y_n, z_n]$) are rotated similarly.
I have tried to use the follow rotation matrix but it is not working since it breaks $r_{12} = r_{13}$ condition, meaning that $ f \neq t \neq [x_2, y_2, z_2 ] - [x_1, y_1, z_1 ]$ and $r_{12} \neq r_{13}$.
Definitions
$ \begin{align} u &= \frac{t}{\vert \vert t \vert \vert} \\ a &= cos\left(\frac{\theta}{2}\right) &b &= u_{x} * sin\left(\frac{\theta}{2} \right) \\ c &= u_{y}* sin\left(\frac{\theta}{2}\right) &d &= u_{z} *sin\left(\frac{\theta}{2}\right) \end{align}$
Rotation Matrix $\mathbf{B} = \begin{bmatrix} a^2 + b^2 - c^2 - d^2 & 2.0 (bc - ad) & 2.0(bd + ac) \\ 2.0 (bc + ad) & a^2 + c^2 - b^2 - d^2 & 2.0(cd - ab) \\ 2.0 (cd - ab) & 2.0(bd - ac) & a^2 + d^2 - b^2 - c^2 \\ \end{bmatrix}$
Then the rotation is $t' = \mathbf{B}t$
Let $\vec{p}_i = (x_i, y_i, z_i)$, $\vec{v} = \vec{p}_2 - \vec{p}_1$ (corresponding to OP's $f$), and $\vec{u} = \vec{p}_4 - \vec{p}_3$ (corresponding to OP's $t$).
You need a rotation of angle $\theta$ around unit axis $\hat{a} = (a_x, a_y, a_z)$ to bring $\vec{u}$ parallel to $\vec{v}$, i.e. $$\frac{\lVert \vec{u} \rVert}{\lVert \vec{v} \rVert} \vec{v} = \mathbf{R} \vec{u} \quad \iff \quad \vec{v} = \frac{\lVert \vec{v} \rVert}{\lVert \vec{u} \rVert } \mathbf{R} \vec{u}$$ where $$\mathbf{R} = \left[ \begin{matrix} c + a_x^2 u & a_x a_y u - a_z s & a_x a_z u + a_y s \\ a_x a_y u + a_z s & c + a_y^2 u & a_y a_z u - a_x s \\ a_x a_z u - a_y s & a_y a_z u + a_x s & c + a_z^2 u \\ \end{matrix} \right] \tag{1}\label{G1}$$ and $$\begin{aligned} c &= \cos \theta \\ s &= \sin \theta \\ u &= 1 - \cos \theta = 1 - c \\ \end{aligned}$$
The unit rotation axis is perpendicular to both vectors: $$\hat{a} = \frac{\vec{a}}{\lVert \vec{a} \rVert}, \quad \vec{a} = \vec{u} \times \vec{v}$$ and the angle fulfills $$\begin{aligned} \cos \theta &= \frac{\vec{u} \cdot \vec{v}}{\lVert \vec{u} \rVert \, \lVert \vec{v} \rVert} \\ \sin \theta &= \frac{\lVert \vec{u} \times \vec{v} \rVert}{\lVert \vec{u} \rVert \, \lVert \vec{v} \rVert} \\ \end{aligned}$$
In practice, you'll want to normalize the two vectors to unit length first, $$\hat{u} = \displaystyle \frac{ \vec{p}_4 - \vec{p}_3 }{\lVert \vec{p}_4 - \vec{p}_3 \rVert} = \left[ \begin{matrix} u_x \\ u_y \\ u_z \end{matrix} \right] = \left[ \begin{matrix} \displaystyle \frac{ x_4 - x_3 }{\sqrt{ (x_4 - x_3)^2 + (y_4 - y_3)^2 + (z_4 - z_3)^2 }} \\ \displaystyle \frac{ y_4 - y_3 }{\sqrt{ (x_4 - x_3)^2 + (y_4 - y_3)^2 + (z_4 - z_3)^2 }} \\ \displaystyle \frac{ z_4 - z_3 }{\sqrt{ (x_4 - x_3)^2 + (y_4 - y_3)^2 + (z_4 - z_3)^2 }} \\ \end{matrix} \right] \tag{2a}\label{G2a}$$ $$\hat{v} = \displaystyle \frac{ \vec{p}_2 - \vec{p}_1 }{\lVert \vec{p}_2 - \vec{p}_1 \rVert} = \left[ \begin{matrix} v_x \\ v_y \\ v_z \end{matrix} \right] = \left[ \begin{matrix} \displaystyle \frac{ x_2 - x_1 }{\sqrt{ (x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2 }} \\ \displaystyle \frac{ y_2 - y_1 }{\sqrt{ (x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2 }} \\ \displaystyle \frac{ z_2 - z_1 }{\sqrt{ (x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2 }} \\ \end{matrix} \right] \tag{2b} \label{G2b}$$ Then, $$\begin{aligned} t_x &= u_y v_z - u_z v_y \\ t_y &= u_z v_x - u_x v_z \\ t_z &= u_x v_y - u_y v_x \\ t_n &= \sqrt{ t_x^2 + t_y^2 + t_z^2 } \\ c = \cos\theta & = u_x v_x + u_y v_y + u_z v_z \\ s = \sin\theta & = t_n = \sqrt{ 1 - c^2 } \\ a_x &= \displaystyle \frac{t_x}{t_n} \\ a_y &= \displaystyle \frac{t_y}{t_n} \\ a_z &= \displaystyle \frac{t_z}{t_n} \\ \end{aligned} \tag{3}\label{G3}$$ and with these (and $u = 1 - c$), use $\eqref{G1}$ to construct the rotation matrix $\mathbf{R}$.