Пример #1
0
        public bool Transfer(IMotionTarget target, object context)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            RaiseEvent(new NativeMotionTransferEventArgs(MotionInfo, NativeRemainder)
            {
                RoutedEvent = TransferingEvent
            });

            if (Math.Sign(NativeRemainder) == MotionInfo.NativeDirection)
            {
                var converter   = (INativeMotionConverter)MotionInfo.Source;
                var sourceDelta = converter.NativeToNormalized(NativeRemainder);
                var targetDelta = target.Coerce(MotionInfo, context, sourceDelta);
                if (!DoubleEx.IsZero(targetDelta))
                {
                    target.Move(MotionInfo, context, targetDelta);
                    EndTransfer(converter.NormalizedToNative(targetDelta), converter.NativeResolutionFrequency);
                }
            }
            return(target.CanMove(MotionInfo, context));
        }
Пример #2
0
        /// <summary>
        /// Gets a hash code for this instance.
        /// </summary>
        /// <returns>The hash code for this instance.</returns>
        public override int GetHashCode()
        {
            DoubleEx doubleEx = Number64.ToDoubleEx(this);

            return(doubleEx.GetHashCode());
        }
Пример #3
0
 public override bool                        CanMove(IMotionInfo info, object context)
 {
     return(!DoubleEx.IsZero(GetScrollableDisplacement(info.Direction)));
 }
Пример #4
0
 public double X(double y)
 {
     return(DoubleEx.IsZero(this.Slope) ? double.NaN : (y - this.YIntercept) / this.Slope);
 }
Пример #5
0
 public double X(double y)
 {
     return DoubleEx.IsZero(Slope) ? double.NaN : (y - YIntercept)/Slope;
 }
Пример #6
0
 public virtual bool     CanMove(IMotionInfo info, object context)
 {
     return(!DoubleEx.IsZero(Coerce(info, context, info.Direction)));
 }
Пример #7
0
        /// <summary>
        /// Calculate the x-coordinate for the point with maximum separation from the diagonal (sag point)
        /// </summary>
        /// <param name="span">The span</param>
        /// <param name="center">The center of the catenary (lower point)</param>
        /// <param name="w">The unit weight</param>
        /// <param name="H">The horizontal tension</param>
        /// <returns>A x-coordinate value</returns>
        public static double MaximumSagX(Vector2 span, Vector2 center, double w, double H)
        {
            double a = H / w;

            return(center.X + a * DoubleEx.Asinh(span.Y / span.X));
        }