本文整理汇总了C#中System.Drawing.PointF.IsOut方法的典型用法代码示例。如果您正苦于以下问题:C# PointF.IsOut方法的具体用法?C# PointF.IsOut怎么用?C# PointF.IsOut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.PointF
的用法示例。
在下文中一共展示了PointF.IsOut方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Solve
public static long Solve()
{
PointF p0 = new PointF(0f, 10.1f);
PointF p1 = new PointF(1.4f, -9.6f);
long count = 0;
while (!p1.IsOut())
{
double oriAngle = Math.Atan(GetOriginalAngle(p0, p1));
double tanAngle = Math.Atan(m(p1));
double refAngle = tanAngle + Math.PI - (oriAngle - tanAngle);
// Reflection line equation: y = a.x + b
var a = Math.Tan(refAngle);
var b = p1.Y - a * p1.X;
// 4x^2 + y^2 = 100
// 4x^2 + (a.x + b)^2 = 100
// (4 + a^2^)x^2 + (2ab)x + (b^2 - 100) = 0
double A = 4 + a * a;
double B = 2 * a * b;
double C = b * b - 100;
double delta = (float)Math.Sqrt(B * B - 4 * A * C);
double x0 = (-B + delta) / (2 * A);
double x1 = (-B - delta) / (2 * A);
p0 = p1;
if (Math.Abs(p1.X - x0) > Math.Abs(p1.X - x1))
p1 = new PointF((float)x0, (float)a * (float)x0 + (float)b);
else
p1 = new PointF((float)x1, (float)a * (float)x1 + (float)b);
count++;
}
return count;
}