Parallel line using Clipper library

2019-06-19 03:15发布

问题:

I'm using CLIPPER library to offset line and trying to make parallel line.

ClipperOffset co = new ClipperOffset();

co.AddPath (s, JoinType.jtRound, EndType.etOpenRound);

co.Execute (ref solution, 15);

Result is right image in attachment. I need parallel lines instead of offset line "around" main line.

Does anyone know is it possible in Clipper or maybe anyone have any idea how to filter result points to remove unnecessary?

回答1:

Using Endtype.etOpenButt while adding the path will help you:

https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibendtype

You will also need to cut few points at the very beginning and in the middle of the resulting polygon maybe, well to extract your two "parallel" lines.



标签: c# clipperlib