本文整理匯總了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)));
}