(stream)
| 132936 | // intersections 2 - there were intersections, and the first and last segments |
| 132937 | // should be rejoined. |
| 132938 | function clipLine(stream) { |
| 132939 | var point0, c0, v0, v00, clean; // no intersections |
| 132940 | return { |
| 132941 | lineStart: function() { |
| 132942 | v00 = v0 = false; |
| 132943 | clean = 1; |
| 132944 | }, |
| 132945 | point: function(lambda, phi) { |
| 132946 | var point1 = [ |
| 132947 | lambda, |
| 132948 | phi |
| 132949 | ], point2, v = visible(lambda, phi), c = smallRadius ? v ? 0 : code1(lambda, phi) : v ? code1(lambda + (lambda < 0 ? (0, _mathJs.pi) : -(0, _mathJs.pi)), phi) : 0; |
| 132950 | if (!point0 && (v00 = v0 = v)) stream.lineStart(); |
| 132951 | if (v !== v0) { |
| 132952 | point2 = intersect(point0, point1); |
| 132953 | if (!point2 || (0, _pointEqualJsDefault.default)(point0, point2) || (0, _pointEqualJsDefault.default)(point1, point2)) point1[2] = 1; |
| 132954 | } |
| 132955 | if (v !== v0) { |
| 132956 | clean = 0; |
| 132957 | if (v) { |
| 132958 | // outside going in |
| 132959 | stream.lineStart(); |
| 132960 | point2 = intersect(point1, point0); |
| 132961 | stream.point(point2[0], point2[1]); |
| 132962 | } else { |
| 132963 | // inside going out |
| 132964 | point2 = intersect(point0, point1); |
| 132965 | stream.point(point2[0], point2[1], 2); |
| 132966 | stream.lineEnd(); |
| 132967 | } |
| 132968 | point0 = point2; |
| 132969 | } else if (notHemisphere && point0 && smallRadius ^ v) { |
| 132970 | var t; |
| 132971 | // If the codes for two points are different, or are both zero, |
| 132972 | // and there this segment intersects with the small circle. |
| 132973 | if (!(c & c0) && (t = intersect(point1, point0, true))) { |
| 132974 | clean = 0; |
| 132975 | if (smallRadius) { |
| 132976 | stream.lineStart(); |
| 132977 | stream.point(t[0][0], t[0][1]); |
| 132978 | stream.point(t[1][0], t[1][1]); |
| 132979 | stream.lineEnd(); |
| 132980 | } else { |
| 132981 | stream.point(t[1][0], t[1][1]); |
| 132982 | stream.lineEnd(); |
| 132983 | stream.lineStart(); |
| 132984 | stream.point(t[0][0], t[0][1], 3); |
| 132985 | } |
| 132986 | } |
| 132987 | } |
| 132988 | if (v && (!point0 || !(0, _pointEqualJsDefault.default)(point0, point1))) stream.point(point1[0], point1[1]); |
| 132989 | point0 = point1, v0 = v, c0 = c; |
| 132990 | }, |
| 132991 | lineEnd: function() { |
| 132992 | if (v0) stream.lineEnd(); |
| 132993 | point0 = null; |
| 132994 | }, |
| 132995 | // Rejoin first and last segments if there were intersections and the first |
no test coverage detected