15 double DeltaX = dc2.
x() - dc1.
x();
16 double DeltaY = dc2.
y() - dc1.
y();
17 double DistanceOfCenters = std::hypot(DeltaX, DeltaY);
18 if (DistanceOfCenters == 0.) {
19 std::cout <<
" TangentToCircles::tangentLines >>> ERROR same tube on input " << std::endl;
22 double Alpha0 = std::atan2(DeltaY, DeltaX);
25 if (dc1.
r() == 0. && dc2.
r() == 0.) {
31 double RSum = dc1.
r() + dc2.
r();
33 double ratio = RSum / DistanceOfCenters;
36 double Alpha1 = std::asin(
ratio);
38 double line_phi = Alpha0 + Alpha1;
40 lines.emplace_back(pos1, line_phi);
42 line_phi = Alpha0 - Alpha1;
44 lines.emplace_back(pos2, line_phi);
47 if (dc1.
r() == 0. || dc2.
r() == 0.)
return lines;
50 double DeltaR = std::abs(dc2.
r() - dc1.
r());
55 double Alpha2 = asin(
ratio);
57 if (dc1.
r() < dc2.
r()) {
58 line_phi = Alpha0 + Alpha2;
60 lines.emplace_back(pos3, line_phi);
62 line_phi = Alpha0 - Alpha2;
64 lines.emplace_back(pos4, line_phi);
67 line_phi = Alpha0 + Alpha2;
69 lines.emplace_back(pos3, line_phi);
71 line_phi = Alpha0 - Alpha2;
73 lines.emplace_back(pos4, line_phi);