Menu

Polygon offset

Renato
2015-05-27
2015-07-01
  • Renato

    Renato - 2015-05-27

    Is it possible to specify a different offset distance to each edge of a polygon?

     
  • Brandon Massoni

    Brandon Massoni - 2015-07-01

    I tried offsetting the polygon (X,Y coordinate below) with poor results in C# (see image). Does anyone know what's wrong?

    Here are the settings...
    var offset = new ClipperOffset();
    offset.AddPath(path, JoinType.jtRound, EndType.etClosedPolygon);
    var solution = new List<List<IntPoint>>();
    offset.Execute(ref solution, -10);

    path List<IntPoints> (Polygon CCW Ordered)
    -10 -10
    100 25
    40 120
    75 50
    60 40
    40 60
    20 10
    30 120
    20 140
    20 40
    -10 100
    -10 -10

     

    Last edit: Brandon Massoni 2015-07-01
  • Angus Johnson

    Angus Johnson - 2015-07-01

    Works for me...

          Int64[][] ints1 = new Int64[][]
          {
              new Int64[]
                { -10, -10,100, 25,40, 120,75, 50,60, 40,40, 60,20, 10,30, 120,20, 140,20, 40,-10, 100  }
          };
          subj.Add(IntsToPolygon(ints1[0]));
          ClipperOffset co = new ClipperOffset();
            co.AddPaths(subj, JoinType.jtRound, EndType.etClosedPolygon);
            co.Execute(ref solution, -10);