Transform a data set by exploting the vectorfield
The issue with considering anything as one dimensional in this problem is that they cannot be manipulated as required by the solution.
This can be solved by the optimsation of a function that modifies the $x_i$s towards the direction that minimises some expression of &quot;error&quot;. The error here seems to be the distance of each point from the nearest intersection with the known lines.
The minimisation of that error alone is not enough to produce the required result here, but we will come back to this later.
The key &quot;tool&quot; here is the manipulation of the $x_i$s via modifications to the line they reside upon. This makes it a bit clearer why $g(x)$ is not a useful way of seeing things here.
For example, how are we going to rotate a $g(x)$? How are we going to &quot;move it&quot; towards the left or towards the right? If the answers to these questions are &quot;we will just add some offset&quot; or &quot;send it through some rotation matrix&quot;, then $g(x)$ cannot stay as it is because it would be unaware of the space it is moving in.
Instead, suppose that all $x_i$s rest on a line running through and parallel to some vector $\vec{a}$. This, being a vector allows us to move it around (to translate the vector, simply add the required $x,y$ offset) and rotate it (to rotate the vector, simply scale its components by the appropriate coefficients). Consequently, we now cannot leave the description of the points as $x_i$ but instead something like $p_i$ taken from the set of points $P$ with each point being a pair of $(x,y)$ coordinates.
To complete the loop we need a way by which to change this line the points are resting on by some factor that is the result of the minimisation. We can do this by combining a translation and a rotation matrix and use the minimisation to inform us about the final $\text{offset}_x, \text{offset}_y, \theta$ parameters required to make the vector $\vec{a}$ coincide with the right points on the &quot;fan&quot; that is created by the $f_i$s.
In terms of practically doing this, you can establish a very simple function for manipulating the $p_i$s as $\text{mod_points}(P,\text{offset}_x, \text{offset}_y, \theta)=p_{i,n-1} \cdot M_{translate}(\text{offset}_x, \text{offset}_y,) \cdot M_{rotate}(\theta)$ where $P$ is the current position of the points, $p \in P$ and $n \in \mathbb{N}$ is the iteration step. Other platforms (e.g. MATLAB, Scilab, Octave, Julia and others) will have similar optimisation functionality of course.
At each iteration ($n$) use this to derive the error function you are trying to minimise. The error function takes the known lines and the positions of the transformed points and returns how far away from optimal is the solution. For example, $\text{fit_error}(f_i, \text{modified_P})$.
This $\text{fit_error}()$ will then be used in place of fun in scipy.optimise.minimise() and your initial $p_i$s (or $x_i$s as you call them now) will be the initial positions x0.
After a number of iterations, minimise() will have moved the line that the $P$s rest upon on the right intersection point with the &quot;fan&quot; that is defined by the (now known as) $x_i$s.
But, if you try to do this, you will notice that the minimisation of the error is not a sufficient condition because it allows the following solution:

Is this a valid solution according to the criterion of minimal error? Yes it is, this line produces points that rest on the known lines. Is it an acceptable solution?....No.
What else should we do to produce a valid and acceptable solution? Add a constraint to the calculation function so that the $P$ set gets closer to the intersections with the $f_i$ lines while at the same time the distances between the points themselves are also preserved. You can model this as two expressions for the error and add them with weight coefficients so that you can tune what sort of priority you want to give over either of the constraints.
Hope this helps.
EDIT:
You have two options regarding preserving the distance of the points:

Calculate the distance from the points, but infer where should the $\vec{a}$ go next. Then, since you do have the line that the points are on and their &quot;inter-distances&quot; are fixed, you can use the orientation of $\vec{a}$ to calculate where each point should be, knowing just the first one. (Subsequent points will be positioned at known distance $d$ from the previous known point towards the direction of $\vec{a}$).

Literally include all distances that need to be preserved in the expression for the error. In this case it would be distances $d(p_n,p_{n+1}), d(p_n,p_{n+2}), d(p_{n+1}, p_{n+2}), d(p_n,p_{n+3}), d(p_{n+1}, p_{n+3}), d(p_{n+2}, p_{n+3})$ where $d()$ is a function that returns the Euclidean distance and $n = 0$ is the index in $P$.