if (x1 === 0) {
          theta = Math.PI / 2;
          xsign = 0;
        }
        else {