protected PolygonF(Polygon ply) : this() { PolygonF polyf = PolygonF.FromPolygon(ply); this.AddRange(polyf._pnts.ToArray()); }
public static PolygonF Scale(PolygonF ply, float width, float height) { PointF[] p = new PointF[ply._pnts.Count]; ply._pnts.CopyTo(p); using (Matrix mat = new Matrix()) { mat.Scale(width, height); mat.TransformPoints(p); } return(new PolygonF(p)); }
public static PolygonF Offset(PolygonF ply, float x, float y) { PointF[] p = new PointF[ply._pnts.Count]; ply._pnts.CopyTo(p); for (int i = 0; i < p.Length; i++) { p[i].X += x; p[i].Y += y; } return(new PolygonF(p)); }
public static PolygonF Rotate(PolygonF ply, float degress, PointF center) { PointF[] p = new PointF[ply._pnts.Count]; ply._pnts.CopyTo(p); using (Matrix mat = new Matrix()) { mat.RotateAt(degress, center); mat.TransformPoints(p); } return(new PolygonF(p)); }
public virtual void RotateAtCentroid(float degrees) { PolygonF rotatePly = PolygonF.Rotate(this, degrees, this.Centroid); this.Clear(); this._pnts.AddRange(rotatePly._pnts.ToArray()); if (this._preCalcBBox) { this.UpdateMinMax(this._pnts); } rotatePly.Clear(); }
public virtual void Scale(float width, float height) { PolygonF scalePly = PolygonF.Scale(this, width, height); this.Clear(); this._pnts.AddRange(scalePly._pnts.ToArray()); if (this._preCalcBBox) { this.UpdateMinMax(this._pnts); } scalePly.Clear(); }
public virtual void Offset(float x, float y) { PolygonF offsetPly = PolygonF.Offset(this, x, y); this.Clear(); this._pnts.AddRange(offsetPly._pnts.ToArray()); if (this._preCalcBBox) { this.UpdateMinMax(this._pnts); } offsetPly.Clear(); }
public Polygon(params Point[] points) { this._ply = new PolygonF(points.Select(p => new PointF((float)p.X, (float)p.Y)).ToArray()); }
//*************************************************************************** // Class Constructors // public Polygon() { this._ply = new PolygonF(); }
public static void FillShape(PolygonF ply, Graphics g, Brush b) { using (GraphicsPath path = ply.GetShape()) g.FillPath(b, path); }
public static Polygon Rotate(Polygon ply, float degrees, Point center) { return(Polygon.Truncate(PolygonF.Rotate(ply._ply, degrees, new PointF((float)center.X, (float)center.Y)))); }
public static void DrawShape(PolygonF ply, Graphics g, Pen p) { using (GraphicsPath path = ply.GetShape()) g.DrawPath(p, path); }
public static PolygonF Scale(PolygonF ply, float width, float height) { PointF[] p = new PointF[ply._pnts.Count]; ply._pnts.CopyTo(p); using (Matrix mat = new Matrix()) { mat.Scale(width, height); mat.TransformPoints(p); } return new PolygonF(p); }
public static Polygon Ceiling(PolygonF ply) { return new Polygon(ply.GetPoints().Select(p => Point.Ceiling(p)).ToArray()); }
public static PointF GetCentroid(PointF[] points) { float areaDummy; return(PolygonF.GetCentroid(points, out areaDummy)); }
public static Polygon Ceiling(PolygonF ply) { return(new Polygon(ply.GetPoints().Select(p => Point.Ceiling(p)).ToArray())); }
public static Polygon Offset(Polygon ply, int x, int y) { return(Polygon.Truncate(PolygonF.Offset(ply._ply, (float)x, (float)y))); }
public static Polygon Scale(Polygon ply, int width, int height) { return(Polygon.Truncate(PolygonF.Scale(ply._ply, (float)width, (float)height))); }
//*************************************************************************** // Static Methods // public static Polygon Round(PolygonF ply) { return new Polygon(ply.GetPoints().Select(p => Point.Round(p)).ToArray()); }
public static Polygon Truncate(PolygonF ply) { return new Polygon(ply.GetPoints().Select(p => Point.Truncate(p)).ToArray()); }
public static PolygonF Rotate(PolygonF ply, float degress, PointF center) { PointF[] p = new PointF[ply._pnts.Count]; ply._pnts.CopyTo(p); using (Matrix mat = new Matrix()) { mat.RotateAt(degress, center); mat.TransformPoints(p); } return new PolygonF(p); }
public static Polygon Truncate(PolygonF ply) { return(new Polygon(ply.GetPoints().Select(p => Point.Truncate(p)).ToArray())); }
public static PolygonF Offset(PolygonF ply, float x, float y) { PointF[] p = new PointF[ply._pnts.Count]; ply._pnts.CopyTo(p); for (int i = 0; i < p.Length; i++) { p[i].X += x; p[i].Y += y; } return new PolygonF(p); }
public static Point GetCentroid(Point[] points) { return(Point.Truncate(PolygonF.GetCentroid(points.Select(p => new PointF((float)p.X, (float)p.Y)).ToArray()))); }
//*************************************************************************** // Static Methods // public static Polygon Round(PolygonF ply) { return(new Polygon(ply.GetPoints().Select(p => Point.Round(p)).ToArray())); }