Best way to calculate the inner path of a shape?

130 Views Asked by At

Let's suppose I have the following shape: enter image description here I want to calculate its inner path by a given distance (let's say 200), what would be the best way to do it?

At the end I would like to get the gray shape (sorry for the bad sketch) : enter image description here

I would start with

  1. translate the lines by the distance,
  2. increate the arcs's radius by the distance
  3. calculate all the intersections, then somehow (?) exclude the segments that won't be part of the new inner shape (like the bottom line in this example)

Is there any better (or simpler) way to do it?

Thanks

2

There are 2 best solutions below

0
On BEST ANSWER

The name of your "inner path" is offset curve or parallel curve. See the earlier MSE question, Self-intersection removal in offset curves. To add to Jaap Scherphuis' comment, the offset curve may self-intersect. In general they are not easy to calculate.

OffsetCurve

Image from Paul Murrell, "Offset Curves for Variable-Width X-splines," 2017. Link to paper.

0
On

I should add that, at least in the simpler situations, Adobe Illustrator's Object / Path / Offset Path... creates exactly what the OP seeks.

Note the contrast with the OP's offset curve, which does not offset equally from every point. Here one can imagine sliding a disk around tangentially inside the outer curve, and recording the position of the center of the disk.

OffsetAI