0

使用 Clipper(C#) 偏移轮廓时出现错误,以下是路径和代码:

List<List<IntPoint>> contours = new List<List<IntPoint>>() {
    new List<IntPoint>()
    {
        new IntPoint(89081288,31121153),
        new IntPoint(79573289,41300154),
        new IntPoint(89989888,51429549)
    },
    new List<IntPoint>()
    {
        new IntPoint(103433436,22509154),
        new IntPoint(103687434,32572554),
        new IntPoint(93177234,22454711)
    }
};
List<List<IntPoint>> result = new List<List<IntPoint>>();

ClipperOffset co = new ClipperOffset();
co.AddPaths(contours, JoinType.jtMiter, EndType.etClosedPolygon);
co.Execute(ref result, 1 * 1000000);

图片是

偏移误差

非常感谢

4

1 回答 1

0

解决方案:在 AddPaths 之前,确保轮廓正确,例如方向,没有自交叉...为此,请使用 Clipper.SimplifyPolygons。

co.AddPaths(Clipper.SimplifyPolygons(contours), JoinType.jtMiter, EndType.etClosedPolygon);
于 2021-07-02T01:19:07.337 回答