Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int y = 100;
- const int x = 100;
- const int offset = 20;
- IList<PolygonPoint> bounds = new List<PolygonPoint>
- {
- new PolygonPoint(0,0),
- new PolygonPoint(0, y),
- new PolygonPoint(x, y),
- new PolygonPoint(x, 0),
- };
- IList<PolygonPoint> hole = new List<PolygonPoint>
- {
- new PolygonPoint(offset, offset),
- new PolygonPoint(x - offset, offset),
- new PolygonPoint(offset, y - offset),
- new PolygonPoint(x - offset, y - offset),
- };
- Polygon polygon = new Polygon(bounds); // here polygon contains four dots
- polygon.AddHole(new Polygon(hole)); // and here - eight
- P2T.Triangulate(polygon); // here I get ten triangles
- foreach (var triangle in polygon.Triangles.Where(tr => tr.IsInterior)) // <-- problem
- {
- // draw
- }
- IList<PolygonPoint> hole = new List<PolygonPoint>
- {
- new PolygonPoint(offset, offset),
- new PolygonPoint(offset, y - offset),
- new PolygonPoint(x - offset, y - offset),
- new PolygonPoint(x - offset, offset),
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement