Curve that touches three points: Difference between revisions
m
→{{header|Julia}}
Line 61:
=={{header|Julia}}==
To make things more specific, find the circle determined by the points. The curve is then the arc between the 3 points.
<lang julia>using Makie
struct Point; x::Float64; y::Float64; end
# Find a circle passing through the 3 points
const p1 = Point(10, 10)
Line 83 ⟶ 84:
println("The circle with center at x = $a, y = $b and radius $r.")
x = a-r:0.25:a+r
y0 = sqrt.(r^2 .- (x .- a).^2)
scene = lines(x, y0 .+ b)
lines!(scene, x, b .- y0)
scatter!(scene, [p.x for p in allp], [p.y for p in allp])
</lang>{{out}}
<pre>
|