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]));
 }
Example #3
0
        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);
 }
Example #5
0
 public static void DrawShape(TriangleF tri, Graphics g, Pen p)
 {
     using (GraphicsPath path = tri.GetShape())
         g.DrawPath(p, path);
 }
Example #6
0
 public static Triangle Ceiling(TriangleF value)
 { return new Triangle(Point.Ceiling(value.PointA), Point.Ceiling(value.PointB), Point.Ceiling(value.PointC)); }
Example #7
0
 //***************************************************************************
 // Static Methods
 // 
 public static Triangle Round(TriangleF value)
 { return new Triangle(Point.Round(value.PointA), Point.Round(value.PointB), Point.Round(value.PointC)); }
Example #8
0
 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));
 }
 /// <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);
 }
Example #10
0
 /// <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);
 }
Example #11
0
 public static Triangle Ceiling(TriangleF value)
 {
     return(new Triangle(Point.Ceiling(value.PointA), Point.Ceiling(value.PointB), Point.Ceiling(value.PointC)));
 }
Example #12
0
 public static Triangle Truncate(TriangleF value)
 {
     return(new Triangle(Point.Truncate(value.PointA), Point.Truncate(value.PointB), Point.Truncate(value.PointC)));
 }
Example #13
0
 //***************************************************************************
 // Static Methods
 //
 public static Triangle Round(TriangleF value)
 {
     return(new Triangle(Point.Round(value.PointA), Point.Round(value.PointB), Point.Round(value.PointC)));
 }
Example #14
0
 public void Clear()
 {
     this._srcTri = TriangleF.Empty;
 }
Example #15
0
        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;
        }
Example #16
0
 //***************************************************************************
 // 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)));
 }
Example #17
0
 /// <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);
 }
Example #18
0
 public void Clear()
 { this._srcTri = TriangleF.Empty; }
Example #19
0
 public void DrawShape(Graphics g, Pen p)
 {
     TriangleF.DrawShape(this, g, p);
 }
Example #20
0
 public static Triangle Truncate(TriangleF value)
 { return new Triangle(Point.Truncate(value.PointA), Point.Truncate(value.PointB), Point.Truncate(value.PointC)); }
Example #21
0
 public void FillShape(Graphics g, Brush b)
 {
     TriangleF.FillShape(this, g, b);
 }
Example #22
0
 //***************************************************************************
 // 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]);
 }
Example #23
0
 public static void DrawShape(TriangleF tri, Graphics g, Pen p)
 {
     using (GraphicsPath path = tri.GetShape())
         g.DrawPath(p, path);
 }
Example #24
0
 public static void FillShape(TriangleF tri, Graphics g, Brush b)
 {
     using (GraphicsPath path = tri.GetShape())
         g.FillPath(b, path);
 }
Example #25
0
 //***************************************************************************
 // 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)));
 }