Line circle intersection: Difference between revisions
Content added Content deleted
(→{{header|Wren}}: Added stretch goal.) |
(→{{header|Go}}: Added stretch goal.) |
||
Line 982: | Line 982: | ||
fmt.Println("\n a segment starting at (7, 4) and ending at (11, 8) is/are:") |
fmt.Println("\n a segment starting at (7, 4) and ending at (11, 8) is/are:") |
||
fmt.Println(" ", intersects(point{7, 4}, point{11, 8}, cp, r, true)) |
fmt.Println(" ", intersects(point{7, 4}, point{11, 8}, cp, r, true)) |
||
cp = point{10, 10} |
|||
r = 5.0 |
|||
fmt.Println("\n A circle, center (10, 10) with radius 5, and:") |
|||
fmt.Println("\n a vertical line containing the points (5, 0) and (5, 20) is/are:") |
|||
fmt.Println(" ", intersects(point{5, 0}, point{5, 20}, cp, r, false)) |
|||
fmt.Println("\n a horizontal segment starting at (-5, 10) and ending at (5, 10) is/are:") |
|||
fmt.Println(" ", intersects(point{-5, 10}, point{5, 10}, cp, r, true)) |
|||
}</syntaxhighlight> |
}</syntaxhighlight> |
||
Line 1,014: | Line 1,021: | ||
a segment starting at (7, 4) and ending at (11, 8) is/are: |
a segment starting at (7, 4) and ending at (11, 8) is/are: |
||
[(8, 5)] |
[(8, 5)] |
||
A circle, center (10, 10) with radius 5, and: |
|||
a vertical line containing the points (5, 0) and (5, 20) is/are: |
|||
[(5, 10)] |
|||
a horizontal segment starting at (-5, 10) and ending at (5, 10) is/are: |
|||
[(5, 10)] |
|||
</pre> |
</pre> |
||