1

I am looking to find the area of region given by distance $d$ from a curve $f(t) = (x,y)$. In other words, the area covered by drawing a curve with a thick circular pencil of radius $d$ (thanks mvw)

I approached the problem as follows:

  1. Find two curves (the curve "above" $g(t)$ and the curve "below" $h(t)$)
  2. To find the points above and below $f(t)$, we find the slope of the perpendicular line $m=-{f'(t)}^{-1}$ and then move distance $d$ along it in both directions to get the points above and below
  3. I then say that $g(t) = f(t) + \frac{dm}{\|m\|}, h(t)=f(t) - \frac{dm}{\|m\|}$
  4. Then the area within that distance should be $\int{h(t)}-\int{g(t)}$

As far as I can tell though, there is a mistake somewhere as given the simple case of $f(t)=(0,0)$, I should get an area of $\pi$, but I get nothing of the sort.

I think the issue is in step 2? but I am open to other ways of solving this problem.

soandos
  • 1,806
  • @mvw d is just a constant, so I want "the area within distance d of a curve" – soandos Apr 20 '16 at 14:53
  • if the curve is a straight line of length $l$, then the area would be a rectangle of length $l$ and a height of $2d$, and then two half circles on the ends (with radius $d$) – soandos Apr 20 '16 at 14:56
  • That is like drawing the curve with a circular pencil of radius $d$. That seems tricky, e.g. if your curve is the unit circle you have a different overlap than in the case of the straight line. – mvw Apr 20 '16 at 14:59
  • @mvw that is it exactly. I'll reword it to make it clearer – soandos Apr 20 '16 at 15:00
  • There are analytical solutions only for some "nicely behaved" curves $\vec{f}(t)$. All self-intersecting curves shaped like $\varphi$ or 8, or curves with sharp peaks or small loops, are hard. If only the overall area is needed, I can think of several numerical methods (that vary by amount of memory needed) that could be used. – Nominal Animal Apr 20 '16 at 16:48
  • @NominalAnimal, Those would be helpful. If it matters, my curves self intersect a small number of times ( < 5) and accuracy does not need to be so precise. – soandos Apr 20 '16 at 16:50
  • @soandos: Unfortunately, "nicely behaved" usually means no intersections and radius of curvature everywhere at least $d$. In general, I would only use the approach if and only if $x$ and/or $y$ component of $\vec{f}(t)$ were linear. – Nominal Animal Apr 20 '16 at 16:56
  • Note: Related problems seem to be "Drawing of thick lines" and "Volume of Tubes" (in higher dimensions). – mvw Apr 20 '16 at 17:04
  • Pixel counting (voxel counting in higher dimensions) only needs to be done at the boundary region. Often the real hard part is to find a way to calculate the distance from an arbitrary point to the closest point on the curve; very often there are more than one local minima, which causes issues for many root finding algorithms. That can be helped enormously by storing the relevant curve parameter $t$ values for each affected lattice cell (within $d$) as initial values for root finding. – Nominal Animal Apr 20 '16 at 17:37

2 Answers2

0

If $f : I \to \mathbb{R^2}$ and $d \ge 0$ then the area of interest is $$ A = \{ u \in \mathbb{R}^2 \mid \exists t \in I: \lVert f(t) - u \rVert \le d \} $$ My guess is that $$ \pi d^2 \le \lvert A \rvert \le \pi d^2 + 2 s d $$ where $s$ is the length of the straightened curve (stretched to a straight line), which is one extremal case, while the curve wound around a point is the other.

mvw
  • 35,114
  • But is there a way to get an actual value? – soandos Apr 20 '16 at 16:33
  • Would left minus right as defined here http://math.stackexchange.com/questions/167543/finding-the-equation-of-a-curve-that-has-a-perpendicular-distance-of-d-from-an?rq=1 work? – soandos Apr 20 '16 at 16:37
  • 1
    Once the curve gets curved you have overlaps, which lead to a decrease in area. For a given curve you might try to determine this by some analysis. For more complicated cases or having to deal with any curve, I see no easier way than some numerical procedure which tries to cover the area with simple shapes, like smaller circles or rectangles, while keeping track of the overlap between the simple shapes. Could run down to counting pixels. – mvw Apr 20 '16 at 16:42
  • My thoughts would be to solve this without attempting to find the equations of the boundaries of the region. You don't think you need them, it's hard to come up with rules that will always produce the right formulas, and even if you do find the formulas it may be difficult to measure areas using those formulas. – David K Apr 20 '16 at 16:43
  • That's what I'm doing now, but its rather slow. I was surprised to see that such a simple to state problem doesn't have an easy analytic solution. Could I get a tighter bound by calculating the curves curvature at all points? – soandos Apr 20 '16 at 16:46
  • @DavidK Do you see an approach that is not counting pixels? – soandos Apr 20 '16 at 16:48
  • There is the approach in http://math.stackexchange.com/questions/744422/the-area-of-a-region-around-a-curve -- but I think that works only if the radius of curvature is never less than $d$. – David K Apr 20 '16 at 16:51
  • Imagine a curve that forms the letter B. If you vary the thickness $d$, you end up with areas with no, one or two holes. That is tricky. – mvw Apr 20 '16 at 16:52
  • By the way, the attempted calculations in the question show you come up with functions $g(t)$ and $h(t)$--evidently these are parameterized equations of the boundary. That's precisely what I suggested you not do. – David K Apr 20 '16 at 16:53
  • @soandos: For the nasty cases, we will always need some form of "counting pixels". It does not mean you need to render the curve, though; you could use e.g. Monte Carlo integration, calculating the distance of each random point to the curve. Recursive "bitmaps" with initial pixel size ~ $d/2$ should yield a much more effective approach (because you can then concentrate on the boundary regions, and can compute reliable upper and lower bounds for the area). – Nominal Animal Apr 20 '16 at 16:54
  • For piecewise smooth curve, we have $|A| \le \pi d^2 + 2sd$ in general. This is known as Naiman's inequality by the statisticians. – achille hui Apr 20 '16 at 16:59
  • @DavidK isn't there a separate issue where the curve is Florence flask shaped along the neck (if its narrower than $d$) – soandos Apr 20 '16 at 17:17
0

Let $\gamma(t)$ be a curve with radius of curvature at least $d$ at all points. Let $W(t)$ be a line segment of length $2d$ perpendicular to $\gamma$ at $\gamma(t)$. That is, $W(t)$ is like a pair of "whiskers" that sweep out some area as you move along the curve.

Let $W(t_1)$ be disjoint from $W(t_2)$ whenever $\gamma(t_1) \neq \gamma(t_2)$. That is, the curve never crosses itself or "sideswipes" (with its whiskers) an area that was already swept out.

Let $A$ be the region swept out. Then $\lvert A \rvert = \pi d^2 + 2sd$, where $s$ is the path length of $\gamma.$

For a less "well-behaved" curve that does not satisfy all the conditions above, cut one or more pieces from it that do satisfy those conditions, either doing so in a way that gives you no two pieces whose swept regions overlap, or being careful to keep any overlapping simple enough to deal with as explained below.

These are the "simple" pieces. Estimate their total area; this is $2ds_s - A_s$ where $s_s$ is the combined length of all these pieces and $A_s$ is the amount you have to deduct due to overlapping. (Computing $A_s$ is a relatively ad-hoc procedure in general; but if there is no overlap then $A_s = 0$.)

The remaining pieces of the curve are the "complicated" pieces. Here you do the best you can to cut these into shapes whose area you can measure, and add this to the total. If an approximate answer is good enough, this is a good place to do some approximating.

A possibly helpful fact in dealing with the "complicated" pieces is that if you have a curve of length $s_1$ whose direction changes a total of $\theta$ radians to the right (where $\theta$ can be greater than $2\pi$; that is, we're counting "turns", not just initial and final direction), and if the curve never curves to the left with radius of curvature less than $d$ nor does the left-hand part of the "whisker" re-enter any part of the area it already swept out, the region swept out by the left-hand part of the "whisker" is $s_1d + \frac12 \theta d$.

Finally, you have to add whatever the "end caps" at the two ends of the curve (if they exist) would contribute. This is at most $\pi d^2$; it can be less in the case where either of the "end caps" overlaps the region swept out by the whiskers along some part of the curve.

David K
  • 108,155