Skip to content

Commit

Permalink
Rectangles look less glitchy than triangles
Browse files Browse the repository at this point in the history
  • Loading branch information
e-n-f committed Dec 7, 2023
1 parent 9ae1e57 commit 7d6233a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions earcut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ drawvec reinforce(drawvec const &pts, std::vector<std::vector<Point>> polygon, d
double ang = atan2(py - pts[indices[v1]].y, px - pts[indices[v1]].x);
double dist = scale - d;

out2.push_back(draw(VT_MOVETO, pts[indices[v1]].x, pts[indices[v1]].y));
out2.push_back(draw(VT_MOVETO, pts[indices[v2]].x, pts[indices[v2]].y));
out2.push_back(draw(VT_LINETO, pts[indices[v2]].x + dist * cos(ang), pts[indices[v2]].y + dist * sin(ang)));
out2.push_back(draw(VT_LINETO, pts[indices[v3]].x + dist * cos(ang), pts[indices[v3]].y + dist * sin(ang)));
out2.push_back(draw(VT_LINETO, pts[indices[v1]].x, pts[indices[v1]].y));
out2.push_back(draw(VT_LINETO, pts[indices[v3]].x, pts[indices[v3]].y));
out2.push_back(draw(VT_LINETO, pts[indices[v2]].x, pts[indices[v2]].y));
}
}
}
Expand Down

0 comments on commit 7d6233a

Please sign in to comment.