3 つの 3D ポイント p1、p2、p3 と球の半径があります。3 点と半径から球の中心を見つけるにはどうすればよいですか?
要件を満たす球が 2 つあるため、ソリューションとして 2 つの 3D ポイントが必要です。
ありがとう。
3 点すべてを含む平面 P を見つけます。その平面では、これらの点が三角形を決定します。
この三角形の周りの円を見つけてください。この円の中心を C とします。
P に垂直で C で交差する線を見つけます。
この線で、円から目的の距離にある 2 つの点を見つけます。
私は退化したケースを無視しました。
There are a number of ways to formalize this. Here's one of them (basically the same as Ali suggested, but with more math): you want to find points
(a) equidistant from p1, p2, p3, with
(b) the distance being exactly R.
First off, find a center of the circumscribed circle as per http://en.wikipedia.org/wiki/Circumscribed_circle (see the part about "the circumcircle of a triangle embedded in d dimensions"):
p0 = cross(
dot(p21, p21) * p31 - dot(p31, p31) * p21,
n
) / 2 / dot(n, n) + p1,
with p21=p2-p1
, p31=p3-p1
, n=cross(p21,p31)
.
The points from item (a) lie on a line that passes through this point, and is orthogonal to the plane containing p1, p2, p3, so its equation is
p(t) = p0 + n * t
Substitute this into
dist(p1, p)^2 = dot(p - p1, p - p1) = R^2
to get the quadratic equation
dot(n, n) * t^2 - 2*dot(n, p0-p1) * t + dot(p0-p1, p0-p1) = R^2
Actually, n
and (p0-p1)
are orthogonal, so the second addend on the left is 0, and
t1 = sqrt((R^2 - dot(p0-p1, p0-p1))/ dot(n, n)),
t2 = -sqrt((R^2 - dot(p0-p1, p0-p1))/ dot(n, n))
(note how p1
in p0
cancels out). Substitute these into p(t)
to get the answer.