[Date Index]
[Thread Index]
[Author Index]
Re: Sphere formula
*To*: mathgroup at smc.vnet.net
*Subject*: [mg109500] Re: Sphere formula
*From*: "Alexander Elkins" <alexander_elkins at hotmail.com>
*Date*: Sat, 1 May 2010 06:51:03 -0400 (EDT)
*References*: <hr65rj$jq6$1@smc.vnet.net>
"S. B. Gray" <stevebg at ROADRUNNER.COM> wrote in message
news:hr65rj$jq6$1 at smc.vnet.net...
> 1. The center of a sphere through 4 points has a very nice determinant
> form. (http://mathworld.wolfram.com/Sphere.html) What I want is a nice
> formula for the center of a sphere through 3 points, where the center is
> in the plane of the three points. I have a formula but it's a horrible
> mess of hundreds of lines, even after FullSimplify.
>
> 2. (Unlikely) Is there a way to get Mathematica to put a long formula into
a
> matrix/determinant form if there is a nice one?
>
> Any tips will be appreciated.
>
> Steve Gray
The center point of a sphere through three distinct non-collinear points,
where the center is in the same plane as the three points, is given by the
intersection of that plane and the planes normal to direction of any two of
the three pairs of points equidistant from their pair of points.
1. The equation for the plane containing three points {p1,p2,p3}, where p is
a point in that plane, is given by:
Det[PadRight[{p,p1,p2,p3},{4,4},1]]==0
2. The equation for a plane normal to the direction of the pair of points
{p1,p2} through the midpoint of {p1,p2}, where p is a point in that plane,
is given by:
(p1-p2).(p-(p1+p2)/2)==0
3. Likewise for another pair of points {p1,p3} the equation is:
(p1-p3).(p-(p1+p3)/2)==0
4. The center point of the sphere is the solution point p of these three
equations:
With[{p={x,y,z},p1={x1,y1,z1},p2={x2,y2,z2},p3={x3,y3,z3}},
p/.Solve[{Det[PadRight[{p,p1,p2,p3},{4,4},1]]==0,
(p1-p2).(p-(p1+p2)/2)==0,(p1-p3).(p-(p1+p3)/2)==0},p]]
5. To use Inverse instead of Solve, the equations can be rewritten as
follows:
Inverse[{p1,p2,p3}].{1,1,1}.p==1
(p1-p2).p==(p1-p2).(p1+p2)/2
(p1-p2).p==(p1-p2).(p1+p2)/2
6. Then symbolic form of the center point p of the sphere is given by:
With[{p={x,y,z},p1={x1,y1,z1},p2={x2,y2,z2},p3={x3,y3,z3}},
Inverse[{Inverse[{p1,p2,p3}].{1,1,1},p1-p2,p1-p3}].
{1,(p1-p2).(p1+p2)/2,(p1-p3).(p1+p3)/2}]
7. A test using Ray Koopman's posted values for {p1,p2,p3} gives the
expected center point {1,2,3} as the result:
In[1]:=With[{p={x,y,z},p1={0.018473,-1.1359,-0.768653},
p2={2.51514,5.25315,6.48158},p3={0.818313,-0.881007,-1.0825}},
Inverse[{Inverse[{p1,p2,p3}].{1,1,1},p1-p2,p1-p3}].
{1,(p1-p2).(p1+p2)/2,(p1-p3).(p1+p3)/2}]
Out[1]={{1.,2.,3.}}
8. Another test using a random center point and Ray Koopman's method of
selecting three random points:
In[2]:=Module[{c=RandomReal[{-10,10},3],
r=5Orthogonalize@RandomReal[NormalDistribution[0,1],{3,3}],
p={x,y,z},p1,p2,p3},{p1,p2,p3}=
Table[{Cos@#,Sin@#,0}&@RandomReal[{-Pi,Pi}].r+c,{3}];
{c, #, c == #} &[Inverse[{Inverse[{p1,p2,p3}].{1,1,1},p1-p2,p1-p3}].
{1,(p1-p2).(p1+p2)/2,(p1-p3).(p1+p3)/2}]]
Out[2]={{2.78647, 4.4668, -1.64474}, {2.78647, 4.4668, -1.64474}, True}
Perhaps this is the nice formula you are looking for!
Hope this helps...
Prev by Date:
**Re: How to disable Integrate[] ?**
Next by Date:
**Evaluating a sum from terms generated by the Array function**
Previous by thread:
**Re: Sphere formula**
Next by thread:
**Re: Sphere formula**
| |