Centre and radius of a circle passing through 3 points in a plane: Difference between revisions
Content added Content deleted
m (replaced the 22.82 in task description with 22.83, since that's what all 3 entries are currently using.) |
m (→{{header|Wren}}: No need for second paragraph of preamble now.) |
||
Line 50: | Line 50: | ||
=={{header|Wren}}== |
=={{header|Wren}}== |
||
This follows the lines of the C++ code [https://www.geeksforgeeks.org/equation-of-circle-when-three-points-on-the-circle-are-given/ here]. |
This follows the lines of the C++ code [https://www.geeksforgeeks.org/equation-of-circle-when-three-points-on-the-circle-are-given/ here]. |
||
I've used [22.83, 2.07] for the first point, rather than [22.82, 2.07] as stated in the task description, to give agreement on the centre with the F# and Phix examples. However, my radius is twice theirs and looks right to me. |
|||
<syntaxhighlight lang="wren">var findCircle = Fn.new { |x1, y1, x2, y2, x3, y3| |
<syntaxhighlight lang="wren">var findCircle = Fn.new { |x1, y1, x2, y2, x3, y3| |
||
var x12 = x1 - x2 |
var x12 = x1 - x2 |