当前位置: 首页>>代码示例>>C#>>正文


C# Point.IsValid方法代码示例

本文整理汇总了C#中Point.IsValid方法的典型用法代码示例。如果您正苦于以下问题:C# Point.IsValid方法的具体用法?C# Point.IsValid怎么用?C# Point.IsValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Point的用法示例。


在下文中一共展示了Point.IsValid方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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)
        {
            Contract.Requires<ArgumentNullException>(drawingContext != null);
            Contract.Requires<ArgumentException>(startPoint.IsValid());
            Contract.Requires<ArgumentNullException>(pen != null);

            drawingContext.DrawLine(pen, startPoint, startPoint + GeoHelper.GetVectorFromAngle(angleRadians, length));
        }
开发者ID:krikelin,项目名称:torshify-client,代码行数:9,代码来源:WpfUtil.cs

示例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.IsValid(), "startPoint");
              Util.RequireNotNull(pen, "Pen");

              drawingContext.DrawLine(pen, startPoint, startPoint + GeoHelper.GetVectorFromAngle(angleRadians, length));
        }
开发者ID:edealbag,项目名称:bot,代码行数:9,代码来源:WpfUtil.cs

示例3: AngleRad

        public static double AngleRad(Point point1, Point point2, Point point3)
        {
            Debug.Assert(point1.IsValid());
            Debug.Assert(point2.IsValid());
            Debug.Assert(point3.IsValid());

            double rad = AngleRad(point2.Subtract(point1), point2.Subtract(point3));

            double rad2 = AngleRad(point2.Subtract(point1), (point2.Subtract(point3)).RightAngle());

            if (rad2 < (Math.PI / 2))
            {
                return rad;
            }
            else
            {
                return (Math.PI * 2) - rad;
            }
        }
开发者ID:hungdluit,项目名称:bot,代码行数:19,代码来源:GeoHelper.cs

示例4: Subtract

 public static Vector Subtract(this Point point, Point other)
 {
     Contract.Requires(point.IsValid());
     Contract.Requires(other.IsValid());
     Contract.Ensures(Contract.Result<Vector>().IsValid());
     return new Vector(point.X - other.X, point.Y - other.Y);
 }
开发者ID:heartszhang,项目名称:WeiZhi3,代码行数:7,代码来源:GeoHelper.cs

示例5: 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.IsValid());
            Debug.Assert(currentVelocity.IsValid());
            Debug.Assert(targetValue.IsValid());

            Debug.Assert(dampening.IsValid());
            Debug.Assert(dampening > 0 && dampening < 1);

            Debug.Assert(attractionFator.IsValid());
            Debug.Assert(attractionFator > 0);

            Debug.Assert(terminalVelocity > 0);

            Debug.Assert(minValueDelta > 0);
            Debug.Assert(minVelocityDelta > 0);

            Vector diff = targetValue.Subtract(currentValue);

            if (diff.Length > minValueDelta || currentVelocity.Length > minVelocityDelta)
            {
                newVelocity = currentVelocity * (1 - dampening);
                newVelocity += diff * attractionFator;
                if (currentVelocity.Length > terminalVelocity)
                {
                    newVelocity *= terminalVelocity / currentVelocity.Length;
                }

                newValue = currentValue + newVelocity;

                return true;
            }
            else
            {
                newValue = targetValue;
                newVelocity = new Vector();
                return false;
            }
        }
开发者ID:heartszhang,项目名称:WeiZhi3,代码行数:43,代码来源:GeoHelper.cs

示例6: GetCurrentValueCore

      /// <summary/>
      protected override Point GetCurrentValueCore(Point baseFromValue, Point baseToValue, AnimationClock animationClock) {
         var progress = animationClock.CurrentProgress;
         if (!progress.HasValue || Interpolator == null) {
            return base.GetCurrentValueCore(baseFromValue, baseToValue, animationClock);
         }

         var fromValue = new Point();
         var toValue = new Point();
         var offset = new Vector();
         var isValid = true;

         if (From.HasValue) {
            fromValue = From.Value;
            if (To.HasValue) {
               // from ... to 
               toValue = To.Value;
               if (IsAdditive) {
                  offset = (Vector)baseFromValue;
                  isValid = offset.IsValid();
               }
            } else if (By.HasValue) {
               // from ... from+by
               toValue = fromValue + (Vector)By.Value;
               if (IsAdditive) {
                  offset = (Vector)baseFromValue;
                  isValid = offset.IsValid();
               }
            } else {
               // from ... base
               toValue = baseToValue;
               isValid = toValue.IsValid();
            }
         } else if (To.HasValue) {
            // base ... to
            fromValue = baseFromValue;
            toValue = To.Value;
            isValid = fromValue.IsValid();
         } else if (By.HasValue) {
            // base ... base+by
            toValue = By.Value;
            offset = (Vector)baseFromValue;
            isValid = offset.IsValid();
         } else {
            // base ... base
            fromValue = baseFromValue;
            toValue = baseToValue;
            isValid = fromValue.IsValid() && toValue.IsValid();
         }
         if (!isValid) {
            throw new InvalidOperationException("GetCurrentValueCore");
         }

         if (IsCumulative) {
            var iteration = animationClock.CurrentIteration;
            if (iteration.HasValue && iteration.Value > 1) {
               offset += (toValue - fromValue) * (iteration.Value - 1);
            }
         }

         var interpolator = Interpolator ?? Interpolators.Linear;
         return fromValue + (toValue - fromValue) * interpolator(progress.Value, 0.0, 1.0) + offset;
      }
开发者ID:borkaborka,项目名称:gmit,代码行数:63,代码来源:PointInterpolation.cs


注:本文中的Point.IsValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。