本文整理汇总了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;
}
示例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));
}
示例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);
}
示例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)));
}