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? 
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
You need to work with dircetion to be able to define what is outside/inside. Better is to work with to the left/right of the arrow (vector).
In my example the offset is to the right of the vector, now you need to calculate all intersections of the red lines to define the new start-end points of the lines.
Example: P0 = (5,2) & P1 = (2, 1.7)
V1 = -3, -0.3. Rotating clock wise 90deg gives us vector -0.3, 3 (a,b) -> (b, -a)
Divide the vector by 3 (thats about the distance in the drawing) gives us (-0.1, 1) ofsetting point P0 by the vector gives P0' (5,2) - v(-0.1,1) = (4.9, 3)