本文整理汇总了C#中Point.IsRational方法的典型用法代码示例。如果您正苦于以下问题:C# Point.IsRational方法的具体用法?C# Point.IsRational怎么用?C# Point.IsRational使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point.IsRational方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Line
public Line(Point p1, Point p2)
{
Util.RequireArgument(p1.IsRational(), "p1");
Util.RequireArgument(p2.IsRational(), "p2");
m_p1 = p1;
m_p2 = p2;
}
示例2: DrawLine
/// <param name="angleRadians">The angle, in radians, from 3-o'clock going counter-clockwise.</param>
public static void DrawLine(this DrawingContext drawingContext, Pen pen, Point startPoint, double angleRadians, double length)
{
Util.RequireNotNull(drawingContext, "drawingContext");
Util.RequireArgument(startPoint.IsRational(), "startPoint");
Util.RequireNotNull(pen, "Pen");
drawingContext.DrawLine(pen, startPoint, startPoint + GetVectorFromAngle(angleRadians, length));
}
示例3: Animate
public static bool Animate(
Point currentValue, Vector currentVelocity, Point targetValue,
double attractionFator, double dampening,
double terminalVelocity, double minValueDelta, double minVelocityDelta,
out Point newValue, out Vector newVelocity)
{
Debug.Assert(currentValue.IsRational());
Debug.Assert(currentVelocity.IsRational());
Debug.Assert(targetValue.IsRational());
Debug.Assert(dampening.IsRational());
Debug.Assert(dampening > 0 && dampening < 1);
Debug.Assert(attractionFator.IsRational());
Debug.Assert(attractionFator > 0);
Debug.Assert(terminalVelocity > 0);
Debug.Assert(minValueDelta > 0);
Debug.Assert(minVelocityDelta > 0);
Vector diff = targetValue - currentValue;
if (diff.Length > minValueDelta || currentVelocity.Length > minVelocityDelta)
{
newVelocity = currentVelocity * (1 - dampening);
newVelocity += diff * attractionFator;
newVelocity *= (currentVelocity.Length > terminalVelocity) ? terminalVelocity / currentVelocity.Length : 1;
newValue = currentValue + newVelocity;
return true;
}
else
{
newValue = targetValue;
newVelocity = new Vector();
return false;
}
}
示例4: AngleRad
public static double AngleRad(Point point1, Point point2, Point point3)
{
Debug.Assert(point1.IsRational());
Debug.Assert(point2.IsRational());
Debug.Assert(point3.IsRational());
double rad = AngleRad(point2 - point1, point2 - point3);
double rad2 = AngleRad(point2 - point1, (point2 - point3).RightAngle());
if (rad2 < (Math.PI / 2))
{
return rad;
}
else
{
return (Math.PI * 2) - rad;
}
}