コード例 #1
0
        /// <summary>
        /// Returns the distance to another point.
        /// </summary>
        /// <param name="other">
        /// The other point.
        /// </param>
        /// <returns>
        /// The <see cref="double"/>.
        /// </returns>
        public double DistanceTo(FuzzyPoint other)
        {
            Validate.NotNull(other, nameof(other));

            var dx = this.X - other.X;
            var dy = this.Y - other.Y;

            var distance = Math.Sqrt(dx.Square() + dy.Square());

            return(distance);
        }
コード例 #2
0
 /// <summary>
 /// Returns the angular coefficient of the two points.
 /// </summary>
 /// <param name="other">
 /// The other <see cref="FuzzyPoint"/>.
 /// </param>
 /// <returns>
 /// The <see cref="double"/>.
 /// </returns>
 public double AngularCoefficient(FuzzyPoint other)
 {
     return((this.Y - other.Y) / Math.Abs(this.X - other.X));
 }
コード例 #3
0
        /// <summary>
        /// Subtracts the given <see cref="FuzzyPoint"/> from this <see cref="FuzzyPoint"/>.
        /// </summary>
        /// <param name="other">
        /// The other point to subtract.
        /// </param>
        /// <returns>
        /// The <see cref="FuzzyPoint"/>.
        /// </returns>
        public FuzzyPoint Subtract(FuzzyPoint other)
        {
            Validate.NotNull(other, nameof(other));

            return(new FuzzyPoint(this.X - other.X, this.Y - other.Y));
        }
コード例 #4
0
        /// <summary>
        /// Adds the given <see cref="FuzzyPoint"/> to this <see cref="FuzzyPoint"/>.
        /// </summary>
        /// <param name="other">
        /// The other point to add.
        /// </param>
        /// <returns>
        /// The <see cref="FuzzyPoint"/>.
        /// </returns>
        public FuzzyPoint Add(FuzzyPoint other)
        {
            Validate.NotNull(other, nameof(other));

            return(new FuzzyPoint(this.X + other.X, this.Y + other.Y));
        }