コード例 #1
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));
 }
コード例 #2
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]));
 }
コード例 #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);
        }
コード例 #4
0
 public static void FillShape(TriangleF tri, Graphics g, Brush b)
 {
     using (GraphicsPath path = tri.GetShape())
         g.FillPath(b, path);
 }
コード例 #5
0
ファイル: Triangle.cs プロジェクト: tenshino/RainstormStudios
 public static void DrawShape(TriangleF tri, Graphics g, Pen p)
 {
     using (GraphicsPath path = tri.GetShape())
         g.DrawPath(p, path);
 }
コード例 #6
0
ファイル: Triangle.cs プロジェクト: tenshino/RainstormStudios
 public static Triangle Ceiling(TriangleF value)
 { return new Triangle(Point.Ceiling(value.PointA), Point.Ceiling(value.PointB), Point.Ceiling(value.PointC)); }
コード例 #7
0
ファイル: Triangle.cs プロジェクト: tenshino/RainstormStudios
 //***************************************************************************
 // Static Methods
 // 
 public static Triangle Round(TriangleF value)
 { return new Triangle(Point.Round(value.PointA), Point.Round(value.PointB), Point.Round(value.PointC)); }
コード例 #8
0
ファイル: Triangle.cs プロジェクト: tenshino/RainstormStudios
 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));
 }
コード例 #9
0
 /// <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);
 }
コード例 #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);
 }
コード例 #11
0
 public static Triangle Ceiling(TriangleF value)
 {
     return(new Triangle(Point.Ceiling(value.PointA), Point.Ceiling(value.PointB), Point.Ceiling(value.PointC)));
 }
コード例 #12
0
 public static Triangle Truncate(TriangleF value)
 {
     return(new Triangle(Point.Truncate(value.PointA), Point.Truncate(value.PointB), Point.Truncate(value.PointC)));
 }
コード例 #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)));
 }
コード例 #14
0
 public void Clear()
 {
     this._srcTri = TriangleF.Empty;
 }
コード例 #15
0
ファイル: Polygon.cs プロジェクト: tenshino/RainstormStudios
        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;
        }
コード例 #16
0
ファイル: Triangle.cs プロジェクト: tenshino/RainstormStudios
 //***************************************************************************
 // 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)));
 }
コード例 #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);
 }
コード例 #18
0
ファイル: Triangle.cs プロジェクト: tenshino/RainstormStudios
 public void Clear()
 { this._srcTri = TriangleF.Empty; }
コード例 #19
0
 public void DrawShape(Graphics g, Pen p)
 {
     TriangleF.DrawShape(this, g, p);
 }
コード例 #20
0
ファイル: Triangle.cs プロジェクト: tenshino/RainstormStudios
 public static Triangle Truncate(TriangleF value)
 { return new Triangle(Point.Truncate(value.PointA), Point.Truncate(value.PointB), Point.Truncate(value.PointC)); }
コード例 #21
0
 public void FillShape(Graphics g, Brush b)
 {
     TriangleF.FillShape(this, g, b);
 }
コード例 #22
0
ファイル: Triangle.cs プロジェクト: tenshino/RainstormStudios
 //***************************************************************************
 // 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]);
 }
コード例 #23
0
 public static void DrawShape(TriangleF tri, Graphics g, Pen p)
 {
     using (GraphicsPath path = tri.GetShape())
         g.DrawPath(p, path);
 }
コード例 #24
0
ファイル: Triangle.cs プロジェクト: tenshino/RainstormStudios
 public static void FillShape(TriangleF tri, Graphics g, Brush b)
 {
     using (GraphicsPath path = tri.GetShape())
         g.FillPath(b, path);
 }
コード例 #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)));
 }