Find the intersection of two lines: Difference between revisions
Content added Content deleted
(→Using a geometric algebra library: narrowing is actually not needed here) |
m (→{{header|Ruby}}: no more + -20) |
||
Line 2,270: | Line 2,270: | ||
def to_s |
def to_s |
||
"y = #{@a}x + #{@b}" |
"y = #{@a}x #{@b.positive? ? '+' : '-'} #{@b.abs}" |
||
end |
end |
||
Line 2,281: | Line 2,281: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre>Line y = 5.0x |
<pre>Line y = 5.0x - 20.0 intersects line y = 0.4x + 3.0 at #<struct Point x=5.0, y=5.0>.</pre> |
||
=={{header|Rust}}== |
=={{header|Rust}}== |