1.我在 PictureBox 上画一个椭圆和一条线。2.执行查看内容
后,我将 Paths 对象计数为零
3.对象包含此查看内容。clipper.PolyTreeToPaths(polytree_solution);
PolyTree
我知道我的问题与这些链接相似,但我无法解决问题,可能是我无法在代码中找到错误。 链接 1 链接2 链接3
//adding subject (lines)
Paths subj=new Paths(1);
subj.Add(new Path());
subj[0].Add(new IntPoint(0,0));
subj[0].Add(new IntPoint(440,280));
subj[0].Add(new IntPoint(440,0));
subj[0].Add(new IntPoint(0,280));
subj[0].Add(new IntPoint(440/2,280));
subj[0].Add(new IntPoint(440/2,0));
//for clip, GraphicsPath object is defined properly by ellipse points by help of mouse events
GraphicsPath path=new GraphicsPath();
path.AddEllipse(m_rectArena);
Paths clip=new Paths(1);
int scale=100;
path.Flatten();
Path clip2=new Path(path.PointCount);
foreach(PointF p in path.PathPoints)
{
clip2.Add(new IntPoint((int)(p.X*scale),(int)(p.Y*scale)));
}
clip.Add(clip2);
Paths solution=new Paths();
PolyTree polytree_solution=new PolyTree();
Clipper c=new Clipper();
c.AddPath(subj[0],PolyTree.ptSubject,false);
c.AddPaths(clip,PolyType.ptClip,true);
c.Execute(ClipType.ctIntersection,polytree_solution,PolyFilllType.pftEvenOdd,PolyFillType.pftEvenOdd);
Paths openp=Clipper.PolyTreeToPaths(polytree_solution);
1.我想要ct.Intersection
线条(主题)和圆圈(剪辑),但这没有发生图片点击这里。
2.PictureBox上的实际绘图点击这里