[APL (Dyalog)], 20 bytes
Uses Anders Kaseorg's formula: 0≤(x1−x2)2−(r1−r2)2+(y1−y2)2≤4r1r2
Takes (x1, r1, y1) as left argument and (x2, r2, y2) as right argument.
(-/2*⍨-)(≤∧0≤⊣)×ばつ
[Try it online!][TIO-j5m6uax7]
The overall function's structure is a fork (3-train) where the tines are (-/2*⍨-) and (≤∧0≤⊣) and (×ばつ)*. The middle tine takes as arguments the results of the side tines as arguments. The side tines use the totaloverall function's arguments.
Right tine:
×ばつ multiply the arguments (x1x2, r1r2, y1y2)
2⊃ pick the second element (r1r2)
×ばつ multiply by four (4r1r2)
Left tine:
- subtract the arguments (x1−x2, r1−r2, y1−y2)
2*⍨ square ((x1−x2)2, (r1−r2)2, (y1−y2)2)
-/ minus reduction i.e. alternate sum* ((x1−x2)2−((r1−r2)2−(y1−y2)2))
Now we use these results as arguments to the middle tine:
0≤⊣ is the left argument greater than or equal to zero
∧ and
≤ the left argument smaller than or equal to the right argument?
* due to APL's right associativity [APL (Dyalog)]: https://www.dyalog.com/ [TIO-j5m6uax7]: https://tio.run/##ZVDBTsMwDL33K3xsEQ1JVrcqH4DEnR@oWMWQqnVqUqk7IyGYNInbTpxAgv/Yn@RHiu0K6CBR7Pg9@8VOtWnS5bZq2rtxvF77unP1rQ@PL3F6Yc/C/jNN4vD8Hp4@NLvdW5IdDzbsHo6HcQz713gw57A1MFhydDoKO5tcRtFEEkB0Eg@WYMpIhPCr2tVwv9703oFbtX2zhLb3FILv@nqqNkBrAbIysTkbK1fkDM03PWVMTmqQ6/7y@GtZwcoLCgtYKFtCpjKEXOUFGKVLxlB6gBtpR1ONhp/voYh2ZMiaGcoxRlohkkpZgGb5Gc2YVYZKlc0m@auqcaKPJ/qa5jb/XkXRl6a/uyxntMzAncsgXw "APL (Dyalog Unicode) – Try It Online"
[APL (Dyalog)], 20 bytes
Uses Anders Kaseorg's formula: 0≤(x1−x2)2−(r1−r2)2+(y1−y2)2≤4r1r2
Takes (x1, r1, y1) as left argument and (x2, r2, y2) as right argument.
(-/2*⍨-)(≤∧0≤⊣)×ばつ
[Try it online!][TIO-j5m6uax7]
The overall structure is a fork (3-train) where the tines are (-/2*⍨-) and (≤∧0≤⊣) and (×ばつ). The middle tine takes as arguments the results of the side tines. The side tines use the total function's arguments.
Right tine:
×ばつ multiply the arguments (x1x2, r1r2, y1y2)
2⊃ pick the second element (r1r2)
×ばつ multiply by four (4r1r2)
Left tine:
- subtract the arguments (x1−x2, r1−r2, y1−y2)
2*⍨ square ((x1−x2)2, (r1−r2)2, (y1−y2)2)
-/ minus reduction i.e. alternate sum* ((x1−x2)2−((r1−r2)2−(y1−y2)2))
Now we use these results as arguments to the middle tine:
0≤⊣ is the left argument greater than or equal to zero
∧ and
≤ the left argument smaller than or equal to the right argument?
* due to APL's right associativity [APL (Dyalog)]: https://www.dyalog.com/ [TIO-j5m6uax7]: https://tio.run/##ZVDBTsMwDL33K3xsEQ1JVrcqH4DEnR@oWMWQqnVqUqk7IyGYNInbTpxAgv/Yn@RHiu0K6CBR7Pg9@8VOtWnS5bZq2rtxvF77unP1rQ@PL3F6Yc/C/jNN4vD8Hp4@NLvdW5IdDzbsHo6HcQz713gw57A1MFhydDoKO5tcRtFEEkB0Eg@WYMpIhPCr2tVwv9703oFbtX2zhLb3FILv@nqqNkBrAbIysTkbK1fkDM03PWVMTmqQ6/7y@GtZwcoLCgtYKFtCpjKEXOUFGKVLxlB6gBtpR1ONhp/voYh2ZMiaGcoxRlohkkpZgGb5Gc2YVYZKlc0m@auqcaKPJ/qa5jb/XkXRl6a/uyxntMzAncsgXw "APL (Dyalog Unicode) – Try It Online"
[APL (Dyalog)], 20 bytes
Uses Anders Kaseorg's formula: 0≤(x1−x2)2−(r1−r2)2+(y1−y2)2≤4r1r2
Takes (x1, r1, y1) as left argument and (x2, r2, y2) as right argument.
(-/2*⍨-)(≤∧0≤⊣)×ばつ
[Try it online!][TIO-j5m6uax7]
The overall function's structure is a fork (3-train) where the tines are -/2*⍨- and ≤∧0≤⊣ and ×ばつ*. The middle tine takes the results of the side tines as arguments. The side tines use the overall function's arguments.
Right tine:
×ばつ multiply the arguments (x1x2, r1r2, y1y2)
2⊃ pick the second element (r1r2)
×ばつ multiply by four (4r1r2)
Left tine:
- subtract the arguments (x1−x2, r1−r2, y1−y2)
2*⍨ square ((x1−x2)2, (r1−r2)2, (y1−y2)2)
-/ minus reduction i.e. alternate sum* ((x1−x2)2−((r1−r2)2−(y1−y2)2))
Now we use these results as arguments to the middle tine:
0≤⊣ is the left argument greater than or equal to zero
∧ and
≤ the left argument smaller than or equal to the right argument?
* due to APL's right associativity [APL (Dyalog)]: https://www.dyalog.com/ [TIO-j5m6uax7]: https://tio.run/##ZVDBTsMwDL33K3xsEQ1JVrcqH4DEnR@oWMWQqnVqUqk7IyGYNInbTpxAgv/Yn@RHiu0K6CBR7Pg9@8VOtWnS5bZq2rtxvF77unP1rQ@PL3F6Yc/C/jNN4vD8Hp4@NLvdW5IdDzbsHo6HcQz713gw57A1MFhydDoKO5tcRtFEEkB0Eg@WYMpIhPCr2tVwv9703oFbtX2zhLb3FILv@nqqNkBrAbIysTkbK1fkDM03PWVMTmqQ6/7y@GtZwcoLCgtYKFtCpjKEXOUFGKVLxlB6gBtpR1ONhp/voYh2ZMiaGcoxRlohkkpZgGb5Gc2YVYZKlc0m@auqcaKPJ/qa5jb/XkXRl6a/uyxntMzAncsgXw "APL (Dyalog Unicode) – Try It Online"
APL (Dyalog) [APL (Dyalog)], 20 bytes
Uses Anders Kaseorg's formula : 0≤(x1−x2)2−(r1−r2)2+(y1−y2)2≤4r1r2
Takes (x1, r1, y1) as left argument and (x2, r2, y2) as right argument.
(-/2*⍨-)(≤∧0≤⊣)×ばつ
Try it online! [Try it online!][TIO-j5m6uax7]
The overall structure is a fork (3-train) where the tines are (-/2*⍨-) and (≤∧0≤⊣) and (×ばつ). The middle tine takes as arguments the results of the side tines. The side tines use the total function's arguments.
Right tine:×ばつ multiply the arguments (x1x2, r1r2, y1y2)2⊃ pick the second element (r1r2)×ばつ multiply by four (4r1r2)
Left tine:- subtract the arguments (x1−x2, r1−r2, y1−y2)2*⍨ square ((x1−x2)2, (r1−r2)2, (y1−y2)2)-/ minus reduction i.e. alternate sum* ((x1−x2)2−((r1−r2)2−(y1−y2)2))
Now we use these results as arguments to the middle tine:0≤⊣ is the left argument greater than or equal to zero∧ and≤ the left argument smaller than or equal to the right argument?
* due to APL's right associativity [APL (Dyalog)]: https://www.dyalog.com/ [TIO-j5m6uax7]: https://tio.run/##ZVDBTsMwDL33K3xsEQ1JVrcqH4DEnR@oWMWQqnVqUqk7IyGYNInbTpxAgv/Yn@RHiu0K6CBR7Pg9@8VOtWnS5bZq2rtxvF77unP1rQ@PL3F6Yc/C/jNN4vD8Hp4@NLvdW5IdDzbsHo6HcQz713gw57A1MFhydDoKO5tcRtFEEkB0Eg@WYMpIhPCr2tVwv9703oFbtX2zhLb3FILv@nqqNkBrAbIysTkbK1fkDM03PWVMTmqQ6/7y@GtZwcoLCgtYKFtCpjKEXOUFGKVLxlB6gBtpR1ONhp/voYh2ZMiaGcoxRlohkkpZgGb5Gc2YVYZKlc0m@auqcaKPJ/qa5jb/XkXRl6a/uyxntMzAncsgXw "APL (Dyalog Unicode) – Try It Online"
[APL (Dyalog)], 20 bytes
Uses Anders Kaseorg's formula : 0≤(x1−x2)2−(r1−r2)2+(y1−y2)2≤4r1r2
Takes (x1, r1, y1) as left argument and (x2, r2, y2) as right argument.
(-/2*⍨-)(≤∧0≤⊣)×ばつ
[Try it online!][TIO-j5m6uax7]
The overall structure is a fork (3-train) where the tines are (-/2*⍨-) and (≤∧0≤⊣) and (×ばつ). The middle tine takes as arguments the results of the side tines. The side tines use the total function's arguments.
Right tine:×ばつ multiply the arguments (x1x2, r1r2, y1y2)2⊃ pick the second element (r1r2)×ばつ multiply by four (4r1r2)
Left tine:- subtract the arguments (x1−x2, r1−r2, y1−y2)2*⍨ square ((x1−x2)2, (r1−r2)2, (y1−y2)2)-/ minus reduction i.e. alternate sum* ((x1−x2)2−((r1−r2)2−(y1−y2)2))
Now we use these results as arguments to the middle tine:0≤⊣ is the left argument greater than or equal to zero∧ and≤ the left argument smaller than or equal to the right argument?
* due to APL's right associativity [APL (Dyalog)]: https://www.dyalog.com/ [TIO-j5m6uax7]: https://tio.run/##ZVDBTsMwDL33K3xsEQ1JVrcqH4DEnR@oWMWQqnVqUqk7IyGYNInbTpxAgv/Yn@RHiu0K6CBR7Pg9@8VOtWnS5bZq2rtxvF77unP1rQ@PL3F6Yc/C/jNN4vD8Hp4@NLvdW5IdDzbsHo6HcQz713gw57A1MFhydDoKO5tcRtFEEkB0Eg@WYMpIhPCr2tVwv9703oFbtX2zhLb3FILv@nqqNkBrAbIysTkbK1fkDM03PWVMTmqQ6/7y@GtZwcoLCgtYKFtCpjKEXOUFGKVLxlB6gBtpR1ONhp/voYh2ZMiaGcoxRlohkkpZgGb5Gc2YVYZKlc0m@auqcaKPJ/qa5jb/XkXRl6a/uyxntMzAncsgXw "APL (Dyalog Unicode) – Try It Online"