2012-11-21 74 views
0

我使用Region找到两条路径的交集(由两个多边形创建)。将区域转换为图形路径

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的交点?

回答

1

检查的GraphicsPath是否通过使用

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); 

} 
交叉,不