2

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

Mat
  • 139
  • 1
    What do you mean by inner path? – Vivaan Daga Feb 20 '23 at 13:52
  • @Shinrin-Yoku Updated the description, I hope it makes my question more clear. – Mat Feb 20 '23 at 14:33
  • Do you want the length? – Vivaan Daga Feb 20 '23 at 14:38
  • This is a tricky problem when you have non-convex shapes. The leftover shape could become disconnected. If the original shape is a non-convex polygon, the leftover shape is not a polygon - the "dents" should now have a circular arc. – Jaap Scherphuis Feb 20 '23 at 14:56
  • What format is your original curve in, and what format do you want your offset curve in? You could do it the way you've described, but honestly, I'd probably create my original curve inside some drafting program, and it would most likely have an "offset curve" function. – JonathanZ Feb 21 '23 at 01:21

2 Answers2

3

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.

1

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