开发者

Reshaping One Polygon Around Another

I don't think this is a duplicate question - at least I hope not.

I have two polygons A and B. B may be entirely inside A or may partly intersect with it. The requirement is to redraw polygon A so that it wraps around Polygon B. I am clear how to handle the case where B is entirely within A. I cut A at the nearest point to B and then insert the points that make up B into the point list for A at the nearest point and add that point again. This should create a flow of A around B. I have plenty of geometry algorithms in my library to calculate distances, bearings and so on but I can't see any of them being helpful Both polygons can be concave, convex etc etc.

My problem comes where B is partially within A. Here I get as far as identifying where the edges of B intersect the edges of A and creating new points in A for those. I then remove any A point that are fully within B since I no longer need them. Here it falls apart. I know the points in B that I need to insert into A. What I don't know is where to insert them or how to work that out.

I have looked at several articles that cover polygon intersection and collision - for example this How to inters开发者_StackOverflow社区ect two polygons?.

What I am not clear about is whether I should be looking at this as a way of solving my problem or whether there is something simpler here that I am missing

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜