Exemple #1
0
        public bool CompareNormalized(VectorF2D other, double epsilon)
        {
            VectorF2D vectorF2D1 = this.Normalize();
            VectorF2D vectorF2D2 = other.Normalize();

            return(System.Math.Abs(vectorF2D1[0] - vectorF2D2[0]) + System.Math.Abs(vectorF2D1[1] - vectorF2D2[1]) < epsilon);
        }
Exemple #2
0
        /// <summary>
        /// Compares the two vectors just based on their direction.
        /// </summary>
        /// <param name="other">The other vector to compare to.</param>
        /// <param name="epsilon">The tolerance on the total difference between the normalized vectors.</param>
        /// <returns></returns>
        public bool CompareNormalized(VectorF2D other, double epsilon)
        {
            VectorF2D normalizedThis  = this.Normalize();
            VectorF2D normalizedOther = other.Normalize();

            double difference = System.Math.Abs(normalizedThis[0] - normalizedOther[0]) +
                                System.Math.Abs(normalizedThis[1] - normalizedOther[1]);

            return(difference < epsilon);
        }
Exemple #3
0
        /// <summary>
        /// Compares the two vectors just based on their direction.
        /// </summary>
        /// <param name="other">The other vector to compare to.</param>
        /// <param name="epsilon">The tolerance on the total difference between the normalized vectors.</param>
        /// <returns></returns>
        public bool CompareNormalized(VectorF2D other, double epsilon)
        {
            VectorF2D normalizedThis = this.Normalize();
            VectorF2D normalizedOther = other.Normalize();

            double difference = System.Math.Abs(normalizedThis[0] - normalizedOther[0]) +
                System.Math.Abs(normalizedThis[1] - normalizedOther[1]);
            return difference < epsilon;
        }