1
$\begingroup$

If you have an arbitrary line, say a bezier curve, that has a width, is there a relationship between the length of the curve at the inner and outer edges? Given the width of the curve at the centerline, can you determine the length at ±width/2 distance from the centerline?

$\endgroup$
1
$\begingroup$

Let $\gamma : [0,L] \to \mathbb{R}^2$ be any $C^2$ curve (i.e. continuously differentiable up to $2^{nd}$ order) parameterized by arc-length $s$ with length $L$. Let

  • $t(s) = \frac{d\gamma(s)}{ds}$ and $n(s)$ be the tangent and normal vector of $\gamma$ at point $\gamma(s)$.
  • $\theta(s)$ be the angle${}^{\color{blue}{[1]}}$ between $t(s)$ and the $x$-axis.
  • $\kappa(s) = \frac{d\theta(s)}{ds}$ be corresponding curvature and choose the sign of $n(s)$ such that $$ \begin{cases} \frac{dt(s)}{ds} &= \kappa(s) n(s)\\ \frac{dn(s)}{ds} &= -\kappa(s) t(s) \end{cases}$$

One way to define a parallel curve (also known as offset curve) at a signed distance $\rho$ from $\gamma$ is the curve with following parameterization

$$\gamma_{\delta} : [0,L] \ni s \quad\mapsto\quad \gamma(s) + \rho n(s) \in \mathbb{R}^2 $$

When $\rho$ is sufficiently small (i.e. $|\rho \kappa(s)| < 1$ for $s \in [0,L]$), the curve will also be $C^2$ without any strange artefact like a cusp. The length of $\gamma_\delta$ will be given by an integral

$$\int_0^L \left| \frac{d\gamma_{\delta}(s)}{ds}\right| ds = \int_0^L \left| \frac{d\gamma(s)}{ds} + \rho \frac{dn(s)}{ds}\right| ds = \int_0^L \left| ( 1 - \rho\kappa(s)) t(s) \right| ds\\ = \int_0^L \left(1 - \rho\frac{d\theta(s)}{ds}\right)ds = L - \rho \Delta\theta$$ where $\Delta\theta = \theta(L) - \theta(0)$ is the change of $\theta$ between the two endpoints of $\gamma$.

Apply this to a Bézier curve with length $L$ and width $w$. As long as the Bézier curve doesn't self intersecting nor have any cusp, the curve of the outer/inner edges will be $L \pm \frac{w}{2}\Delta\theta$. Which sign to use depends on the orientation of curve and how you call an edge outer/inner.

The result can be extended to $B$-spline consists of $C^2$ Bézier curves ($C^2$ with respect to arc-length) as segments. As long as the segments are joined together with matching tangent vectors (i.e. $C^1$ over whole spline) and the $B$-spline doesn't self-intersect, above formula remains valid (for sufficiently small $w$).

Notes

  • $\color{blue}{[1]}$, the angle $\theta$ between $t(s)$ and $x$-axis is defined only up to multiples of $2\pi$. In above derivation, $\theta(s)$ is chosen so that it is continuous over $[0,L]$. Even when $t(0) = t(L)$, there is no need for $\theta(0)$ equal to $\theta(L)$.

    As an example, consider a circle with a short segment at the bottom removed. We have $t(0) \approx t(L)$ but $\theta(0) \approx 0$ while $\theta(L) \approx 2\pi$.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ What about in a situation where a curve forms a "U" shape and the start and end points have the same tangent? Wouldn't that make Δ𝜃 == 0, making the edges L ± 0w/2? $\endgroup$ – IanLarson Nov 10 '19 at 22:56
  • $\begingroup$ @IanLarson In that case, the tangent "vectors" at the two end points are opposite to each other, so $\Delta\theta = \pm \pi$. $\endgroup$ – achille hui Nov 10 '19 at 22:59
  • $\begingroup$ Whoops! Completely right. I think I meant a circle. If you had a curve making a circle, or any similar loop, I'm given to understand the curve normal would twist 180°, maintaining consistent edge lengths, but what about a situation with a fixed normal, such as in a bezier drawn in a 2D plane? $\endgroup$ – IanLarson Nov 10 '19 at 23:18
  • $\begingroup$ For a circle or loop, the normal would turn around for $360^\circ$. I don't understand what you mean for a Bézier with a fixed normal. The normal doesn't turn when the tangent doesn't turn, this happens only on those portion of a curve which are straight line segments. The difference between the inner/outer edges doesn't change over such segments. $\endgroup$ – achille hui Nov 10 '19 at 23:29
  • $\begingroup$ Ah, I was misunderstanding what you were saying and it was clashing with what I was picturing in my head. Makes perfect sense now. Thanks so much. $\endgroup$ – IanLarson Nov 10 '19 at 23:47
0
$\begingroup$

"say a bezier curve, that has a width" How do you define this object? If the edges of this object are just the same bezier curve itself, you have your answer. If the edges are something else, it depends on your definition.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ As in a line that has a perpendicular thickness. The line at the inner/outer edge would not be identical to the centerline. $\endgroup$ – IanLarson Nov 10 '19 at 21:29
  • $\begingroup$ by "perpendicular thickness" do you mean the edge is the centerline vector plus a constant vector? $\endgroup$ – Alexandru Ionut Nov 10 '19 at 21:32
  • $\begingroup$ All points on the inner/outer edge are a fixed distance from the centerline. en.wikipedia.org/wiki/Parallel_curve $\endgroup$ – IanLarson Nov 10 '19 at 21:34
  • $\begingroup$ Do you want to know the 2d case or arbitrary dimensions? $\endgroup$ – Alexandru Ionut Nov 10 '19 at 21:42
  • $\begingroup$ From the definition on wiki, the edge curves are your centerline curve plus a scalar times the unit normal vector. This gives you an expression for your curve in cartesian space. The curvature of your edge curve is also expressed as a rational function of the curvature of your centerline curve. In the 2d planar case, this gives you the natural equations for your edge curve given the natural equations of your centerline curve. $\endgroup$ – Alexandru Ionut Nov 10 '19 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.