首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将Region转换为GraphicsPath

将Region转换为GraphicsPath
EN

Stack Overflow用户
提问于 2012-11-21 11:51:47
回答 2查看 3.4K关注 0票数 0

我使用Region来寻找两条路径的交点(由两个多边形创建)。

代码语言:javascript
复制
GraphicsPath gp1 = new GraphicsPath();
gp1.AddPolygon(P);//P - array of points [first polygon]

Region d = new Region(gp1);

GraphicsPath gp2 = new GraphicsPath();
gp2.AddPolygon(P_);//P_ - array of points [second polygon]
d.Intersect(gp2);//founded intersection

如何获得区域d的交点?

EN

回答 2

Stack Overflow用户

发布于 2012-11-21 13:12:02

我推荐使用适合此任务的多边形交点库。

下面是一个可以从C#中使用的最优秀的示例

http://www.angusj.com/delphi/clipper.php

我也相信如果需要的话,也有很多其他的用C#写的。这是一个关于这个话题的问答:

How to intersect two polygons?

票数 1
EN

Stack Overflow用户

发布于 2013-04-16 13:00:10

使用检查graphicspath是否相交

代码语言:javascript
复制
if(!d.IsEmpty(this.CreateGraphics())

{

RectangleF rectBound=d.GetBound(this.CreateGraphics());

Pointf intersectionPoint=new Pointf(rectBound.X+rectBound.Width/2,rectBound.Y+rectBound.Height/2);

}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13486071

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档