5

I like to implement an arc-length Parameterization of a cubic bezier curve. So far I have implemented the method of calculating the arc length of the curve and now I'm stuck at calculating the times to divide the original curve into equal arc length segments.

What i have:

  • $m = 5$ The number of segments to create
  • $i = 0,1, ...., m$
  • $s = \text{arc length}$
  • $l = s / m$
  • $t_0,t_1,...,t_n$ The parameter values of the original bezier curve.

The formula I have: $$\int_{t_0}^{\tilde{t_i}} ds/dt = i * \tilde{l}$$

To calculate the value of $\tilde{t_i}$ I would have to go through 2 steps:

  1. Calculate a spline segment indexed by $j$ which satisfies $\sum_{p=0}^{j-1} l_p \le i * \tilde{l} < \sum_{p=0}^{j}l_p$
  2. Compute $\tilde{t_i}$ such that $\int_{t_j}^{\tilde{t_i}}ds/dt * dt = i * \tilde{l} - \sum_{p=0}^{j-1}l_p$

To my questions:

  1. What is $\tilde{l}$? I know it is an approximated value but is it neccesery to be different or could just use $l$?

  2. The first calculation of $j$ makes sense, but how would I solve the second to $\tilde{t_i}$?

Maybe I just don't understand correctly what the integral $\int_a^bds/dt*dt$ is or how I can calculate it programmatically.

I am following this paper.

Gilles 'SO- stop being evil'
  • 44,159
  • 8
  • 120
  • 184
user39558
  • 51
  • 1

1 Answers1

1

The link to the paper is dead, but through the help of Wayback Archive, I determined that it was referring to "Arc-Length Parameterized Spline Curves for Real-Time Simulation" by Wang, Kearney, and Atkinson.

As I understand the paper, it turns out that you have miswrote the $\tilde l$ as $l$. It's easy to miss, but the tilde mark is actually there. That answers question 1.

The $s$ is the parameterization of the arc length.

$$ s = \int_{t_0}^{t}\sqrt{x'(\tau)^2+y'(\tau)^2+z'(\tau)^2}d\tau $$

I've swapped the integrating variable with $\tau$ to avoid confusion. Everywhere this formula appears, it needs to be calculated numerically, for example, using quadrature formula (except for Pythagorean hodograph curves, where it may be solved analytically). That answers the part where you said you didn't understand correctly.

Anyways, the derivative w.r.t. $t$ is simply

$$ {ds\over dt} = \sqrt{x'(t)^2+y'(t)^2+z'(t)^2} $$

The full arc length is given by $L$, not $s$, so $\tilde l = L/m$. The length of each interval $[t_i,t_{i+1}]$ is

$$ l_i = \int_{t_i}^{t_{i+1}}{ds\over dt}dt $$

Our goal is to find $\tilde t_i$ such that $$ i\tilde l = \int_{t_0}^{\tilde t_i}{ds\over dt}dt $$

The paper does this by finding the interval $[t_j,t_{j+1}]$ in which $\tilde t_i$ exists, thus the condition $\sum_{p=0}^{j-1} l_p \le i\tilde t_i < \sum_{p=0}^j l_p$. Once we've determined the interval, we find $\tilde t_i$ inside this interval such that the following is satisfied $$ \sum_{p=0}^{j-1}l_p + \int_{t_j}^{\tilde t_i}{ds\over dt}dt = i\tilde l $$ The authors used bisection method to solve this. I would prefer to rewrite this as a root-finding problem $$ f(\tilde t_i) = \sum_{p=0}^{j-1}l_p + \int_{t_j}^{\tilde t_i}{ds\over dt}dt - i\tilde l $$ and use one of the better root finding algorithms such as Brent's method.

I would also have wrote the cumulative lengths as $L_j=\sum_{p=0}^j l_p$ to avoid cluttering the formulas with the summation symbol.

The rest of the paper is about reinterpolating the curve in terms of points evalueated on the newly found $\tilde t_i$, but since it's not asked here, I will stop my answer here.

syockit
  • 111
  • 2