You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Edited for clarity:
I have a polygon (array of Vector2s) and an array of polygons that represent interior holes. After I create the PolygonWithHoles2 instance using the outermost polygon, I then use the AddHole method for each of the holes. I would expect an interior skeleton generated using the PolygonWithHoles2 instance to respect the previously added holes. However, the resulting skeleton remains the same as though no holes had been added at all. I've attached images demonstrating this (Input polygons/holes depicted in red, generated lines depicted in pink). How do you create a skeleton with interior holes? Below is my code:
`
////Get the instance to the offset algorithm.
var instance = PolygonOffset2.Instance;
var polygon = new Polygon2<EIK>(args.Lines.First().Points.Select(p => new Point2d(p.X, p.Y)).ToArray());
if (polygon.IsClockWise) {
args.Lines.First().Points.Reverse();
polygon = new Polygon2<EIK>(args.Lines.First().Points.Select(p => new Point2d(p.X, p.Y)).ToArray());
}
var polygonWithHoles = new PolygonWithHoles2<EIK>(polygon);
foreach (var hole in args.Lines.Skip(1)) {
var polygonHole = new Polygon2<EIK>(hole.Points.Select(p => new Point2d(p.X, p.Y)).ToArray());
if (polygonHole.IsCounterClockWise) {
hole.Points.Reverse();
polygonHole = new Polygon2<EIK>(hole.Points.Select(p => new Point2d(p.X, p.Y)).ToArray());
}
polygonWithHoles.AddHole(polygonHole);
}
//The skeleton is return as a array of segments.
var skeleton = new List<Segment2d>();
instance.CheckInput = true;
instance.CreateInteriorSkeleton(polygonWithHoles, false, skeleton);
foreach (var segment in skeleton) {
Utils.AddToBmp(bmp, new Vector2[] {
new Vector2((float)segment.A.x, (float)segment.A.y),
new Vector2((float)segment.B.x, (float)segment.B.y)
}, Color.HotPink);
}
`
The text was updated successfully, but these errors were encountered:
Edited for clarity:
I have a polygon (array of Vector2s) and an array of polygons that represent interior holes. After I create the PolygonWithHoles2 instance using the outermost polygon, I then use the AddHole method for each of the holes. I would expect an interior skeleton generated using the PolygonWithHoles2 instance to respect the previously added holes. However, the resulting skeleton remains the same as though no holes had been added at all. I've attached images demonstrating this (Input polygons/holes depicted in red, generated lines depicted in pink). How do you create a skeleton with interior holes? Below is my code:
`
////Get the instance to the offset algorithm.
var instance = PolygonOffset2.Instance;
`
The text was updated successfully, but these errors were encountered: