# Constant arc length between any two consecutive points on a parabola

I'm working on a shmup and have bullets spawning along a predefined path, using time as a parameter. I have two parametric equations

$$x=t-2$$ and $$y = (t-2)^2$$

that define the points where bullets spawn. This spawns bullets along a parabola but the spacing between bullets is significantly smaller near the vertex and I want the spacing between every pair of consecutive bullets to be equal.

I'm looking for an expression for that results in points that are on the same curve(as defined by the parametric equations above) and have a constant arc length between any two successive points so that all the points are equally spaced along the curve, does anyone know what such an expression would be(if one exists) or how to find one? Also numerical solutions are fine if an exact solution can't be found. There's this question that asked something similar Keeping the arc length constant between points in a spiral

Also is there a general solution to this sort of constant arc length problem for any curve or is this something you'd need to solve on a case-by case basis? I have a feeling it'd be the latter.

• Similar to how to straighten parabola Commented Sep 27, 2023 at 11:24
• Could you provide some more details? Is the game 3D, 2D, etc? Do the bullets obey ordinary physics? Do they travel at a constant horizontal velocity?
– Jam
Commented Sep 27, 2023 at 11:25

The arclength between two points $$(a,b)$$ being given by $$L_{ab}=\int_a^b\sqrt{\left(\frac{dx}{dt}\right)^2+\left(\frac{dy}{dt}\right)^2}\,dt$$ let $$I=\int\sqrt{\left(\frac{dx}{dt}\right)^2+\left(\frac{dy}{dt}\right)^2}\,dt$$ which is $$I=\frac{1}{4} \left(2 (t-2) \sqrt{4 (t-4) t+17}-\sinh ^{-1}(4-2 t)\right)$$

So, we know $$L_{ab}$$ and, if I properly understand, you are look for $$t$$ such that $$L_{bc}+L_{ab}=2L_{ab}=I$$ There is no analytical solution and numerical methods would be required.

The simplest is to use Newton, Halley or Householder methods with $$t_0=b$$ to find to zero of $$f(t)=\frac{1}{4} \left(2 (t-2) \sqrt{4 (t-4) t+17}-\sinh ^{-1}(4-2t)\right)-2L_{ab}$$

At this point, we $$f(b)=\frac{1}{4} \left(2 \sqrt{4 (b-4) b+17} (b-2)-\sinh ^{-1}(4-2 b)-8 L\right)$$ $$f'(b)=\sqrt{4 (b-4) b+17}$$ $$f''(b)=\frac{4 (b-2)}{\sqrt{4 (b-4) b+17}}$$ $$f'''(b)=\frac{4}{(4 (b-4) b+17)^{3/2}}$$

Now, depending on the selected method, use $$t_1^{(2)}=t_0 - \frac{f(t_0)}{f'(t_0)}$$ $$t_1^{(3)}=t_0 - \frac {2 f(t_0) f'(t_0)} {2 {[f'(t_0)]}^2 - f(t_0) f''(t_0)}$$ $$t_1^{(4)}=t_0 - \frac{6f(t_0)\,f'(t_0)^2-3f(t_0)^2f''(t_0)}{6f'(t_0)^3-6f(t_0)f'(t_0)\,f''(t_0)+f(t_0)^2\,f'''(t_0)}$$

For an example, using $$a=2$$ and $$b=5$$ $$L_{ab}=\frac{1}{4} \left(6 \sqrt{37}+\sinh ^{-1}(6)\right)$$

These will give

$$t_1^{(2)}=6.60241 \quad\quad t_1^{(3)}=6.27191\quad\quad t_1^{(4)}=6.32733$$ while, repeating iterations, the solution is $$6.31931$$.

Edit

After you have generated the initial estimate of your choice, take into account that $$\sqrt I$$ is very close to a linear function. This will be very good for any root-finding method.

So, consider finding the zero of function $$g(t)=\frac{1}{2} \sqrt{2 (t-2) \sqrt{4 (t-4) t+17}-\sinh ^{-1}(4-2 t)}-\sqrt{2L_{ab}}$$

For the worked example, Newton iterates would be

$$\left( \begin{array}{cc} k & t_k \\ 0 & 6.600000000 \\ 1 & 6.319499787 \\ 2 & 6.319306984 \\ \end{array} \right)$$

Here is how I would do it:

Fix a step size $$s$$ that is a tenth of the distance that you want between your points. Now to get from one point $$(x,x^2)$$ to the next, you make ten steps to $$x_1,\ldots,x_{10}$$, where each step approximates an arc length of $$s$$ using the gradient $$2x_i$$ of the parabola. Specifically, from $$x_i$$ you go to $$x_{i+1}=x_i+\frac{s}{\sqrt{1+4x_i^2}}$$ (To see this, draw a little right-angled triangle with base $$\delta x$$, height $$2x_i\delta x$$, and hypotenuse $$s$$; Pythagoras gives you $$\delta x=s/\sqrt{1+4x_i^2}$$).

This is fast and easy to program, and it should be accurate enough to fool the most discerning eye. You might even be able to get away with fewer than ten steps between bullets $$-$$ experiment will tell.

Applying @Claude Leibovici’s setup, we solve, assuming a primitive, and substitute $$t=\frac12\sinh(\frac w2)+2$$:

$$L_t=2L_{a,b}\\\int \sqrt{1+4(t-2)^2}dt=2 \int_a^b \sqrt{1+4(t-2)^2}dt=2L_{a,b}\\\frac12\sqrt{4(t-2)^2+1}(t-2)+\frac14\sinh^{-1}(2(t-2))\\w+\sinh(w)=16L_{a,b}$$

Now apply the hyperbolic Kepler equation integral solution using Anger Weber A:

$$\bbox[3px,border: 4px groove black]{L_t=2L_{a,b}\implies t=\frac12\sinh\left(\frac12\int_{c-i\infty}^{c+i\infty}\frac{e^{16L_{a,b}s}}{2is}\operatorname A_s(s)ds\right)+2}$$

The exact analytic solution has an inverse Laplace transform and uses the Mathematica code:

1/2 Sinh[1/2*InverseLaplaceTransform[\[Pi]/s ResourceFunction["AngerWeberA"][s ,s],s,16*k]]+2

for given $$k=L_{a,b}$$ shown here: