Line circle intersection: Difference between revisions

Line 1,579:
a segment starting at (7, 4) and ending at (11, 8) is/are:
[(8, 5)]</pre>
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<lang Mathematica>LineCircleIntersections[p1_, p2_, c_, r_, type_] := RegionIntersection[Circle[c, r], type[{p1, p2}]]
LineCircleIntersections[{-1, 1}, {1, 1}, {0, 0}, 1, Line]
LineCircleIntersections[{-1, 0}, {2, 0.4}, {0, 0}, 1, Line]
LineCircleIntersections[{-1.5, 0}, {-2, 0.4}, {0, 0}, 1, Line]
LineCircleIntersections[{-1.5, 0}, {-2, 0.4}, {0, 0}, 1, InfiniteLine]</lang>
{{out}}
<pre>Point[{{0,1}}]
Point[{{-1,0},{0.965066,0.262009}}]
EmptyRegion[2]
Point[{{-0.858057,-0.513554},{-0.312675,-0.94986}}]</pre>
 
=={{header|Nim}}==
1,111

edits