Centre and radius of a circle passing through 3 points in a plane: Difference between revisions

Content added Content deleted
(New post.)
(Added Uiua solution)
Line 794: Line 794:
</pre>
</pre>


=={{header|Uiua}}==

<syntaxhighlight lang="uiua">
# Find centre of circle given 3 points on its radius.

Ps ← [[22.83 2.07] [14.39 30.24] [33.65 17.31]]
Diffs ← ↻¯1-↻¯1.Ps
Squares ← ≡(/+≡(×.))Ps
Tops ← ⇌÷2/+×Squares Diffs
Bots ← /+ ×Ps ≡⇌Diffs
&p $"Centre of circle\n_\n" .÷ Bots Tops
≡(√/+×.-)Ps ¤
&p $"The distances to the 3 points (i.e. r)\n_"
</syntaxhighlight>
{{out}}
<pre>
Centre of circle
[18.978515660148815 16.26541079771587]

The distances to the 3 points (i.e. r)
[14.70862397833418 14.708623978334176 14.708623978334177]
</pre>
=={{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].