2012-11-21 72 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); 

} 
交叉,不