public Triangle(Point p1, Point p2, Point p3) { this._srcTri = new TriangleF( new PointF((float)p1.X, (float)p1.Y), new PointF((float)p2.X, (float)p2.Y), new PointF((float)p3.X, (float)p3.Y)); }
//*************************************************************************** // Static Methods // public static TriangleF Rotate(TriangleF tri, float degrees, PointF center) { PointF[] p = new PointF[] { new PointF(tri.PointA.X, tri.PointA.Y), new PointF(tri.PointB.X, tri.PointB.Y), new PointF(tri.PointC.X, tri.PointC.Y) }; using (System.Drawing.Drawing2D.Matrix mat = new System.Drawing.Drawing2D.Matrix()) { mat.RotateAt(degrees, center); mat.TransformPoints(p); } return(new TriangleF(p[0], p[1], p[2])); }
public virtual float GetAngleAtPoint(int idx) { this.CheckRange(idx, "idx"); PointF p1 = idx > 0 ? this._pnts[idx - 1] : this._pnts[this._pnts.Count - 1]; PointF p2 = this._pnts[idx]; PointF p3 = idx < this._pnts.Count - 1 ? this._pnts[idx + 1] : this._pnts[0]; TriangleF tri = new TriangleF(p1, p2, p3); return(tri.Angle_B); }
public static void FillShape(TriangleF tri, Graphics g, Brush b) { using (GraphicsPath path = tri.GetShape()) g.FillPath(b, path); }
public static void DrawShape(TriangleF tri, Graphics g, Pen p) { using (GraphicsPath path = tri.GetShape()) g.DrawPath(p, path); }
public static Triangle Ceiling(TriangleF value) { return new Triangle(Point.Ceiling(value.PointA), Point.Ceiling(value.PointB), Point.Ceiling(value.PointC)); }
//*************************************************************************** // Static Methods // public static Triangle Round(TriangleF value) { return new Triangle(Point.Round(value.PointA), Point.Round(value.PointB), Point.Round(value.PointC)); }
/// <summary>Rotates the triangle around the center of its angle bisectors.</summary> /// <param name="degrees">The number of degrees to rotate. Positive values result in a clockwise rotation.</param> public void RotateAtMassCenter(float degrees) { this = TriangleF.Rotate(this, degrees, AngleBisectorIntersection); }
/// <summary>Rotates the triangle around the point of intersection of its medians.</summary> /// <param name="degrees">The number of degrees to rotate. Positive values result in a clockwise rotation.</param> public void RotateAtMedianCenter(float degrees) { this = TriangleF.Rotate(this, degrees, MedianIntersection); }
public static Triangle Ceiling(TriangleF value) { return(new Triangle(Point.Ceiling(value.PointA), Point.Ceiling(value.PointB), Point.Ceiling(value.PointC))); }
public static Triangle Truncate(TriangleF value) { return(new Triangle(Point.Truncate(value.PointA), Point.Truncate(value.PointB), Point.Truncate(value.PointC))); }
//*************************************************************************** // Static Methods // public static Triangle Round(TriangleF value) { return(new Triangle(Point.Round(value.PointA), Point.Round(value.PointB), Point.Round(value.PointC))); }
public void Clear() { this._srcTri = TriangleF.Empty; }
public virtual float GetAngleAtPoint(int idx) { this.CheckRange(idx, "idx"); PointF p1 = idx > 0 ? this._pnts[idx - 1] : this._pnts[this._pnts.Count - 1]; PointF p2 = this._pnts[idx]; PointF p3 = idx < this._pnts.Count - 1 ? this._pnts[idx + 1] : this._pnts[0]; TriangleF tri = new TriangleF(p1, p2, p3); return tri.Angle_B; }
//*************************************************************************** // Class Constructors // public Triangle(Rectangle rect) { this._srcTri = new TriangleF(new RectangleF( new PointF((float)rect.Location.X, (float)rect.Location.Y), new SizeF((float)rect.Size.Width, (float)rect.Size.Height))); }
/// <summary>Rotates the triangle around the point of intersection of its perpendicular bisectors.</summary> /// <param name="degrees">The number of degrees to rotate. Positive values result in a clockwise rotation.</param> public void RotateAtCircumCenter(float degrees) { this = TriangleF.Rotate(this, degrees, this.PerpendicularBisectorIntersection); }
public void DrawShape(Graphics g, Pen p) { TriangleF.DrawShape(this, g, p); }
public static Triangle Truncate(TriangleF value) { return new Triangle(Point.Truncate(value.PointA), Point.Truncate(value.PointB), Point.Truncate(value.PointC)); }
public void FillShape(Graphics g, Brush b) { TriangleF.FillShape(this, g, b); }
//*************************************************************************** // Static Methods // public static TriangleF Rotate(TriangleF tri, float degrees, PointF center) { PointF[] p = new PointF[] { new PointF(tri.PointA.X, tri.PointA.Y), new PointF(tri.PointB.X, tri.PointB.Y), new PointF(tri.PointC.X, tri.PointC.Y) }; using (System.Drawing.Drawing2D.Matrix mat = new System.Drawing.Drawing2D.Matrix()) { mat.RotateAt(degrees, center); mat.TransformPoints(p); } return new TriangleF(p[0], p[1], p[2]); }