Twin Paradox (SR): How can we express the comparative length of arbitrary world-lines mathematically? The simplest and most intuitive way I have found so far for explaining which twin ages less in the Twin Paradox, is that it's the twin who's world-line is the longest (if it's the longest in one inertial reference frame, it's the longest in all inertial reference frames).
Now what I'm looking for is a more formal, mathematical way to express the comparative length of any 2 world lines, preferably in terms of variables that could be easily measured by each twin respectively. Variables like proper time, proper acceleration (or comparative velocity), ... and allowing both twins to travel freely in space between their point of separation and their point of reunion.
The solution I'm looking for would look something like this: The twin who ages less is the twin for whom the following mathematical formula [insert solution here] is smaller (or larger) than the same mathematical formula for his twin.
Intuitively I feel like the formula would have to be something like: [sum of each world-line segment's proper time multiplied with the same segment's speed relative to x] or [sum of the distance travelled in each world-line segment, distance as expressed by y] but I haven't been able to find a precise expression for this formula yet.
One solution that might work is: The twin who ages less is the twin who travelled a larger distance relative to an (imaginary) object traveling at a constant speed from their point of separation to their point of reunion. This distance could be calculated by each twin based on their relative speed to this imaginary object and the proper time they traveled at this speed. But: Can we do without the reference to this imaginary object and it's inertial reference frame ? Using only what can actually be observed by the twins ?
PS: here's an image to go along with my question. Intuitively I can "see" that the 2-segment journey is "longer" in euclidean space, so it must be "shorter" in terms of its proper time.

EDIT: Lots of great solutions in the answers below! My issue with the standard solution is it requires agreeing on a common shared coordinate system upon which to draw and measure the length of the world lines. If possible, I would like to find a criterion (for who ages less) based simply on what the twins observe between the moment of separation and the moment of reunion. What can they observe ? Their relative speed at separation, their changes of speed before reunion, and the proper times that passed for each (constant-speed) leg of their travels.
 A: If it’s a piecewise straight world line, for each segment of it add the “proper time”
$$ \Delta \tau = c^{-1} \sqrt{c^2 \Delta t^2 - \Delta r^2}. $$
If it’s a smooth curve, the formula above is still valid for infinitesimal intervals and the sum becomes an integral.
The twin for which the resulting sum / integral is larger will age more. The value of the sum / integral gives you the time experienced by the twin.
The value of the sum / integral is a spacetime invariant, it doesn’t depend on the reference frame. It’s values computed for different frames will all coincide.
A: The twin who ages less is the twin for whom the following mathematical formula $$ \tau = \int \sqrt{1-\frac{v(t)^2}{c^2}}dt$$ is smaller than the same mathematical formula for his twin.
In this formula $v(t)$ is the velocity of the twin in question. This formula only works for an inertial frame in flat spacetime (no significant gravity), but the twin can accelerate or move arbitrarily.

My issue with the standard solution is it requires agreeing on a common shared coordinate system upon which to draw and measure the length of the world lines

This is not correct. There does not need to be any agreement on a common shared coordinate system. The above formula will work in any inertial frame. Further, if some twin wishes to use a non-inertial frame then they can use this equation: $$\tau=\int \sqrt{-g_{\mu \nu} dx^\mu dx^\nu}$$
A: Imagine twins who do fast space travel in opposite directions. Whatever one of them does, the other does the same in the opposite direction. Finally they are reunited at the spot they left, both at the same position with the same velocity. Which do you think will be older?
They will be the same age.
The one who is younger will be the one who has experienced more acceleration. When you accelerate your time slows down, and when you accelerate in the opposite direction your time slows down the same amount.
So make your graph show not positions, or velocities but accelerations independent of direction.
I'm an amateur at this and I could be wrong.
Oops! Your original problem calls for instantaneous velocity changes, which in the real world is impossible. When you change instantaneously from one direction and speed to a different direction and speed, you subject the twin not to 1g of acceleration, or 100g of acceleration but infinite acceleration.
So I don't know how to calculate the acceleration in this problem.
The experiment can never be done to find out which twin ages faster. It is not physics. It would not be surprising if it results in paradoxes.
