public TPolygon(TPoint LeftTopCorner, SizeF Size) { this.Dots = new TPoint[4]; this[0] = new Zones.TPoint(LeftTopCorner.X, LeftTopCorner.Y); this[1] = new Zones.TPoint(LeftTopCorner.X + Size.Width, LeftTopCorner.Y); this[2] = new Zones.TPoint(LeftTopCorner.X + Size.Width, LeftTopCorner.Y + Size.Height); this[3] = new Zones.TPoint(LeftTopCorner.X, LeftTopCorner.Y + Size.Height); }
private void Form1_Load(object sender, EventArgs e) { FormPoly = new Zones.TPolygon(); FormPoly.Dots = new Zones.TPoint[4]; FormPoly[0] = new Zones.TPoint(0, 0); FormPoly[1] = new Zones.TPoint(170, 0); FormPoly[2] = new Zones.TPoint(170, 170); FormPoly[3] = new Zones.TPoint(0, 170); }
private Zones.TPolygon GetPlitka90(PointF StartX, SizeF Plitka) { double x2 = StartX.X + Plitka.Width; double y2 = StartX.Y + Plitka.Height; Zones.TPolygon plb = new Zones.TPolygon(4); plb[0] = new Zones.TPoint(StartX.X, StartX.Y); plb[1] = new Zones.TPoint(x2, StartX.Y); plb[2] = new Zones.TPoint(x2, y2); plb[3] = new Zones.TPoint(StartX.X, y2); return(plb); }
private Zones.TPolygon[] CalcOutOfBoundsPoly(Zones.TPolygon Tile, Zones.TPolygon BoxRect, ClipperLib.ClipType clipType) { List <List <ClipperLib.IntPoint> > subj = new List <List <ClipperLib.IntPoint> >(); subj.Add(new List <ClipperLib.IntPoint>()); for (int i = 0; i < Tile.Dots.Length; i++) { subj[0].Add(new ClipperLib.IntPoint((long)Tile[i].X, (long)Tile[i].Y)); } List <List <ClipperLib.IntPoint> > clip = new List <List <ClipperLib.IntPoint> >(); clip.Add(new List <ClipperLib.IntPoint>(4)); for (int i = 0; i < BoxRect.Dots.Length; i++) { clip[0].Add(new ClipperLib.IntPoint((long)BoxRect[i].X, (long)BoxRect[i].Y)); } List <ClipperLib.ExPolygon> solution = new List <ClipperLib.ExPolygon>(); ClipperLib.Clipper c = new ClipperLib.Clipper(); c.AddPolygons(clip, ClipperLib.PolyType.ptSubject); c.AddPolygons(subj, ClipperLib.PolyType.ptClip); bool res = (c.Execute(clipType, solution)); // , ClipperLib.PolyFillType.pftEvenOdd, ClipperLib.PolyFillType.pftEvenOdd if (res) { if (solution.Count > 0) { List <Zones.TPolygon> pols = new List <Zones.TPolygon>(); for (int s = 0; s < solution.Count; s++) { Zones.TPolygon poly = new Zones.TPolygon((ushort)solution[s].outer.Count); for (int i = 0; i < poly.Dots.Length; i++) { poly[i] = new Zones.TPoint((double)solution[s].outer[i].X, (double)solution[s].outer[i].Y); } pols.Add(poly); } ; return(pols.ToArray()); } } ; return(null); }
private Zones.TPolygon GetPlitka45(PointF StartPoint, SizeF Plitka) { double r2 = Math.Sqrt(2); double x1 = StartPoint.X; double x2 = (double)(StartPoint.X + Plitka.Width * r2 / 2.0); double x3 = (double)(StartPoint.X + Plitka.Width * r2); double y1 = StartPoint.Y; double y2 = (double)(StartPoint.Y - Plitka.Height * r2 / 2.0); double y4 = (double)(StartPoint.Y + Plitka.Height * r2 / 2.0); Zones.TPolygon plb = new Zones.TPolygon(4); plb[0] = new Zones.TPoint(x1, y1); plb[1] = new Zones.TPoint(x2, y2); plb[2] = new Zones.TPoint(x3, y1); plb[3] = new Zones.TPoint(x2, y4); return(plb); }