Line circle intersection: Difference between revisions
→{{header|Wren}}: Added stretch goal.
m (add tangent edge cases as stretch task) |
(→{{header|Wren}}: Added stretch goal.) |
||
Line 2,898:
p2 = Point.new(11, 8)
System.print(" a segment starting at %(p1) and ending at %(p2) is/are:")
System.print(" %(intersects.call(p1, p2, cp, r, true))")
cp = Point.new(10, 10)
r = 5
System.print(" A circle, center %(cp) with radius %(r), and:")
p1 = Point.new( 5, 0)
p2 = Point.new( 5, 20)
System.print(" a vertical line containing the points %(p1) and %(p2) is/are:")
System.print(" %(intersects.call(p1, p2, cp, r, false))")
p1 = Point.new(-5, 10)
p2 = Point.new( 5, 10)
System.print(" a horizontal segment starting at %(p1) and ending at %(p2) is/are:")
System.print(" %(intersects.call(p1, p2, cp, r, true))")</syntaxhighlight>
Line 2,920 ⟶ 2,934:
a segment starting at (7, 4) and ending at (11, 8) is/are:
[(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>
|