Complex constructor

Complex(
  1. double re,
  2. double im
)

Default constructor Cartesian form (z = re + im*i)

Implementation

Complex(double re, double im)
  : _re = re,
    _im = im,
    // Calculate the modulus (distance from the origin)
    _modulus = (math.sqrt((re * re) + (im * im))),
    // Calculate the principal argument theta in (-π, π]
    _theta1 = calculateTheta1(re, im),
    // Calculate the principal argument theta in [0, 2π)
    _theta2 = calculateTheta2(calculateTheta1(re, im));