roscoe
Well-known Member
- Joined
- Jun 4, 2002
- Messages
- 1,062
- Office Version
- 365
- Platform
- Windows
- MacOS
I have a random polygon defined by (x,y) coordinates if each vertex. I have a requirement to generate a duplicate polygon on the inside where each line segment is a set distance away from the outside. For example, I have a box that is 4" on a side. I need to create another box whose line segments are offset to the inside 0.5" (so the new box would be 3" on each side and centered).
If I had to generate this from scratch, my workflow would be something like this:
1) Use the (x,y) coordinates of the ends of each line segment and find the line equation (y=mx+b).
2) Use geometry to calculate a parallel line offset towards the inside of the polygon (y’=mx+b’)
3) Find the intersections (x’,y’) of each of these new line segments
Anybody out there have code that already does this or something similar that I can edit? Are there functions in excel that can some of these steps already (like finding slope and intercept of a line)
Thanks
If I had to generate this from scratch, my workflow would be something like this:
1) Use the (x,y) coordinates of the ends of each line segment and find the line equation (y=mx+b).
2) Use geometry to calculate a parallel line offset towards the inside of the polygon (y’=mx+b’)
3) Find the intersections (x’,y’) of each of these new line segments
Anybody out there have code that already does this or something similar that I can edit? Are there functions in excel that can some of these steps already (like finding slope and intercept of a line)
Thanks