2

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?

IanLarson
  • 125

2 Answers2

1

"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.

  • As in a line that has a perpendicular thickness. The line at the inner/outer edge would not be identical to the centerline. – IanLarson Nov 10 '19 at 21:29
  • by "perpendicular thickness" do you mean the edge is the centerline vector plus a constant vector? – Alexandru Ionut Nov 10 '19 at 21:32
  • All points on the inner/outer edge are a fixed distance from the centerline. https://en.wikipedia.org/wiki/Parallel_curve – IanLarson Nov 10 '19 at 21:34
  • Do you want to know the 2d case or arbitrary dimensions? – Alexandru Ionut Nov 10 '19 at 21:42
  • 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. – Alexandru Ionut Nov 10 '19 at 21:52
  • Sure, but I'm wondering if there's a specific relationship between the curve lengths such that if I know only the length of a curve A and the normal distance of parallel curve B from curve A, I can determine the length of Curve B. – IanLarson Nov 10 '19 at 22:04
  • Sure, but the letter "C" drawn with uniform weight and perpendicular terminals also has start and end points forming a straight line, but the length of the interior, exterior, and center curves are not equal. – IanLarson Nov 10 '19 at 22:15
  • I will correct my previous comment. – Alexandru Ionut Nov 10 '19 at 22:18
  • I call a ribbon your centerline curve and the 2 offset curves. I say the 2 edges of the ribbon are cut square if the first point on the centerlines is mapped to the first 2 points on the edges and the last point on the centerline is mapped to the last 2 points on the edges. The 2 mappings are given by the equation on wiki with the scalar and normal unit vector. If the ribbon is cut square, the centerline and edges have the same arc length. – Alexandru Ionut Nov 10 '19 at 22:24
  • Then imagine that curve makes a circle on a plane. That circle has a width extruded on the curve normal perpendicular to the plane normal. The interior and exterior edges are not the same length. – IanLarson Nov 10 '19 at 22:31
  • If you cut out a ribbon from the 3 circles, the relation holds. If you want to stay in the case of a circle and the thought experiment you just provided, there is a simple relationship between the 3 circumferences. – Alexandru Ionut Nov 10 '19 at 22:40
  • In this picture, the red and green lines are parallel curves and have different lengths:

    https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Offset-definition-poss.svg/1280px-Offset-definition-poss.svg.png

    Circles would be simple, but I'm talking about any arbitrary curve. With circles, those circumference lengths have a specific relationship. Does such a relationship exist for an arbitrary curve? That's my question.

    – IanLarson Nov 10 '19 at 22:50
  • You need to define the specific end conditions for the 2 curves or else the question does not make any sense. – Alexandru Ionut Nov 10 '19 at 23:28
  • Imagine I am given a paint brush and your centerline curve with star and end points for the centerline curve. Translation and rotation of the brush through space allows me to draw the edge curves also. Translation changes the 3 arc lengths the same. Rotation changes the edge curve length but not the centerline length. Hence, there is no universal relation without extra conditions. This answers your question. – Alexandru Ionut Nov 10 '19 at 23:37
1

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$.

achille hui
  • 122,701
  • 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? – IanLarson Nov 10 '19 at 22:56
  • @IanLarson In that case, the tangent "vectors" at the two end points are opposite to each other, so $\Delta\theta = \pm \pi$. – achille hui Nov 10 '19 at 22:59
  • 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? – IanLarson Nov 10 '19 at 23:18
  • 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. – achille hui Nov 10 '19 at 23:29
  • 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. – IanLarson Nov 10 '19 at 23:47
  • @Jack hmm... that has been undeleted by someone else. – achille hui Nov 11 '19 at 19:31
  • @achillehui: Indeed, thanks for the message. –  Nov 11 '19 at 20:13