System.Drawing.PointF.Subtract C# (CSharp) Метод

Subtract() публичный статический Метод

Translates a by the negative of a given .

public static Subtract ( PointF pt, Size sz ) : PointF
pt PointF
sz Size
Результат PointF
        public static PointF Subtract(PointF pt, Size sz) => new PointF(pt.X - sz.Width, pt.Y - sz.Height);

Same methods

PointF::Subtract ( PointF pt, SizeF sz ) : PointF
PointF::Subtract ( System pt, System sz ) : System.Drawing.PointF

Usage Example

Пример #1
0
        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;
        }
All Usage Examples Of System.Drawing.PointF::Subtract