Finding center and radius of sphere

8 views (last 30 days)
Robert Smith
Robert Smith on 11 Sep 2017
Answered: Image Analyst on 12 Sep 2017
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 Comment
OCDER
OCDER on 11 Sep 2017
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.

Sign in to comment.

Answers (2)

Image Analyst
Image Analyst on 12 Sep 2017
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 on 11 Sep 2017
Three points are not sufficient for that. You have four unknowns, not three: xc, yc, zc, and r makes four.
  2 Comments
Walter Roberson
Walter Roberson on 11 Sep 2017
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 on 12 Sep 2017
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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!