I have a list of point2D that makes a closed polygon. Now I want to create another set of 2D points by offsetting the polygon given an option inside or outside and an offset value. How can I do it? 

For every polygon vertex calculate outer bisector vector as sum of normalized normals na and nb of two neighbor edges), then normalize it
bis = na + nb
bis = bis / Length(bis)
Then find needed length of bisector to provide offset distance as
l = d / Sqrt((1 + dotproduct(na,nb))/2)
(derived from l=d/cos(fi/2) and half-angle cosine formula)
And get offset polygon vertex (use minus for inner offset!):
P' = P + l * bis
Added: python implementation here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With