Example #1
0
 /// <summary>
 ///   Create a complex number based on an existing complex number
 /// </summary>
 /// <param name = "c"></param>
 public ComplexF(ComplexF c)
 {
     Re = c.Re;
     Im = c.Im;
 }
Example #2
0
        //-----------------------------------------------------------------------------------
        //-----------------------------------------------------------------------------------

        /// <summary>
        ///   Determine whether two complex numbers are almost (i.e. within the tolerance) equivalent.
        /// </summary>
        /// <param name = "a"></param>
        /// <param name = "b"></param>
        /// <param name = "tolerance"></param>
        /// <returns></returns>
        public static bool IsEqual(ComplexF a, ComplexF b, float tolerance)
        {
            return
                ((Math.Abs(a.Re - b.Re) < tolerance) &&
                 (Math.Abs(a.Im - b.Im) < tolerance));
        }