Outline a closed figure

I am drawing figures made up of line segments (x1,y1)-(x2,y2), there are between 3 and 6 segments, all line segements are some multiple of 45 degrees (mostly 0 and 90)

Given the array of points I need to draw the figure (that is the easy part)…but then I need to move X pixels and draw and outer line as well
the line segments may or may not be drawn in any particular order

an acceptable solution can replace drawing a “line” with drawing a “rectangle”, but the important item is the INSIDE dimensions of the figure must be correct

the problem is figureing out for each segment, do you add or subtract from either X and/or Y

the blue does are the provided X,Y coordinates, the black line is simply connecting the dots, its is the GREEN line I need to determine

I found this, which seems to be exactly what I want, but not into “C” enough to understand some of the code :frowning:

http://csharphelper.com/blog/2016/01/enlarge-a-polygon-in-c/

The code itself doesn’t seem very C-ish. You need to find a vector class so that you can do the normalisation of the vector.

Thanks… turns out I can “cheat”… one I started looking at the code that was generating the inside polygon, I just needed to move each point the correct multiple of 45 degrees and it came out perfect… Since all my internal angles are 90, it reduced the math considerably…

You need to perform polygon offsetting.

If your polygon is simple you can cheat. However, as soon as your angles are not 90 degrees things become a lot more difficult as you have to deal with miters.

There is an open source library called Clipper that can do this (and by chance is available in the MBS plugins).
http://www.angusj.com/delphi/clipper.php

They are… I did :slight_smile:

Please try my clipper plugin:
https://www.mbsplugins.de/archive/2018-01-30/Did_you_try_our_new_Clipper_pl

documentation:
http://www.monkeybreadsoftware.net/pluginpart-clipper.shtml

Thank you for you input… but as stated… the problem was solved, without the need for fancy vectoring software, or complex plugins