當前位置: 首頁>>代碼示例>>C#>>正文


C# PointF.Subtract方法代碼示例

本文整理匯總了C#中System.Drawing.PointF.Subtract方法的典型用法代碼示例。如果您正苦於以下問題:C# PointF.Subtract方法的具體用法?C# PointF.Subtract怎麽用?C# PointF.Subtract使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Drawing.PointF的用法示例。


在下文中一共展示了PointF.Subtract方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ApplyPoint

        public void ApplyPoint(PointF point)
        {
            var offset = point.Subtract(_startPoint);

            if (points.Count == 0)
            {
                points.Add(new GesturePoint { X = offset.X, Y = offset.Y, threshold = 10 });
            }
            else
            {
                var last = points.Last();
                var lastPoint = new PointF(last.X, last.Y);

                // first check distance from last point
                if (lastPoint.DistanceTo(offset) > 10)
                {
                    var currentAngle = _previousOffset.AngleTo(offset);
                    var previousAngle = lastPoint.AngleTo(_previousOffset);

                    var da = currentAngle - previousAngle;
                    if (da < -Math.PI) da += 2 * Math.PI;
                    if (da > Math.PI) da -= 2 * Math.PI;

                    if (da > 0.1)
                    {
                        AddPoint(_previousOffset);
                    }
                }
            }

            _previousOffset = offset;
        }
開發者ID:Tesserex,項目名稱:MouseGestures,代碼行數:32,代碼來源:GestureFactory.cs

示例2: Subtend

 public static float Subtend(this PointF point, PointF a1, PointF a2)
 {
     a1 = a1.Subtract(point);
     a2 = a2.Subtract(point);
     float angleA = a1.Angle(), angleB = a2.Angle();
     if (angleA > angleB)
     {
         float swap = angleA;
         angleA = angleB;
         angleB = swap;
     }
     return (float)((angleB - angleA + (Math.PI * 2)) % (Math.PI * 2));
 }
開發者ID:Quackmatic,項目名稱:Challenge168Hard,代碼行數:13,代碼來源:PointExtensionMethods.cs

示例3: TestCrossing

        private bool TestCrossing(GestureQuad quad, PointF p, PointF p2)
        {
            var q = quad.C;
            var q2 = quad.D;

            var r = p2.Subtract(p);
            var s = q2.Subtract(q);

            var qp = q.Subtract(p);
            var rs = r.Cross(s);

            // parallel case
            if (rs == 0) return false;

            var t = qp.Cross(s) / rs;
            var u = qp.Cross(r) / rs;

            return (t >= 0 && t <= 1 && u >= 0 && u <= 1);
        }
開發者ID:Tesserex,項目名稱:MouseGestures,代碼行數:19,代碼來源:Gesture.cs

示例4: FromCenterSize

 public static Rectangle FromCenterSize(PointF Center, PointF Size)
 {
     Size = Size.Divide(2);
     return new Rectangle(new Line(Center.Subtract(Size), Center.Add(Size)));
 }
開發者ID:Shayan-To,項目名稱:OpenMesh,代碼行數:5,代碼來源:Rectangle.cs


注:本文中的System.Drawing.PointF.Subtract方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。