Finding center and radius of sphere

14 次查看(过去 30 天)
I'm looking to calculate the radius of a sphere knowing only 3 points on the circumference. I know its mathematically possible I just don't know how to write a program that will do this. I intend to use the equation of a sphere:
(sqrt((x-xc)^2)+((y-yc)^2)+((z-zc)^2))) = r
Where the center is (xc,yz,zc) and a point on the circumference is (x,y,z). I will select 3 points on the sphere to plug into this equation.
I need to calculate the center and the radius. Does anyone know how to write a program that will do this?
  1 个评论
OCDER
OCDER 2017-9-11
Were you referring to selecting 3 points on the circumference of a circular plane that intersects the center of a sphere? https://math.stackexchange.com/questions/1076177/3d-coordinates-of-circle-center-given-three-point-on-the-circle
If so, might want to put the last equation required to solve this.

请先登录,再进行评论。

回答(2 个)

Image Analyst
Image Analyst 2017-9-12
This will give you the center (xCenter, yCenter, zCenter) and the radius given 3 points on the circumference (widest part, not like on some small cap) of the sphere. So that's all you need to define a sphere.

Walter Roberson
Walter Roberson 2017-9-11
Three points are not sufficient for that. You have four unknowns, not three: xc, yc, zc, and r makes four.
  2 个评论
Walter Roberson
Walter Roberson 2017-9-11
syms x x1 x2 x3 x4 y y1 y2 y3 y4 z z1 z2 z3 z4 xc yc zc real
syms r nonnegative
eqn = (sqrt((x-xc)^2)+((y-yc)^2)+((z-zc)^2)) == r^2;
eqn1 = subs(eqn, [x y z], [x1 y1 z1]);
eqn2 = subs(eqn, [x y z], [x2 y2 z2]);
eqn3 = subs(eqn, [x y z], [x3 y3 z3]);
eqn4 = subs(eqn, [x y z], [x4 y4 z4]);
sol = solve([eqn1, eqn2, eqn3, eqn4],[xc yc zc r])
This will find 28 solutions: four points are not enough to determine the which side of the given points the centre is; you need five points for that.
Image Analyst
Image Analyst 2017-9-12
I'm not sure I buy that you need 4. Three points define a circle, and since the points are on the circumference (widest part of the sphere, not any old place, you got everything you need.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by