Sphere-Sphere Intersection

Author

Eric W. Weisstein
September 23, 2007

This notebook downloaded from http://mathworld.wolfram.com/notebooks/SolidGeometry/Sphere-SphereIntersection.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Sphere-SphereIntersection.html.

©2007 Wolfram Research, Inc. except for portions noted otherwise

Graphic

Graphics3D[{Opacity[.9],Sphere[],Sphere[{1,0,0},.6]}]

LiveGraphics3D

<<Utilities`LiveGraphics3D`

WriteLiveForm[sphsph.m,Show[NonIntersectingPolygons[Graphics3D[{Sphere[1],TranslateShape[Sphere[.6],{1,0,0}]}]],Boxed->False]]

Volume of Intersection

v5.1.0 (?)

(vol=Integrate[Boole[x^2+y^2+z^2<R^2&&(x-d)^2+y^2+z^2<r^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->r>0&&R>0&&d∈Reals])//Timing

v5.1.1

(vol=Integrate[Boole[x^2+y^2+z^2<R^2&&(x-d)^2+y^2+z^2<r^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->r>0&&R>0&&d∈Reals])//Timing

v6

(vol=Integrate[Boole[x^2+y^2+z^2<R^2&&(x-d)^2+y^2+z^2<r^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->r>0&&R>0&&d∈Reals])//Timing

vol=(Piecewise[{{((4 π (r^3))/3), (d+r-R==0&&d>0&&d-r<0)||(d+r-R==0&&d>0&&d-r>0)||(d<0&&d-r+R==0&&d+r>0)||(d<0&&d-r+R==0&&d+r<0)}, {(1/3) ((d^3) π-3 d π (r^2)+2 π (r^3)-2 (d^2) π (Sqrt[-(d^2)+(r^2)])+2 π (r^2) (Sqrt[-(d^2)+(r^2)])), d>0&&d-r<0&&(Sqrt[-(d^2)+(r^2)])-R==0}, {(1/3) (-(d^3) π+3 d π (r^2)+2 π (r^3)-2 (d^2) π (Sqrt[-(d^2)+(r^2)])+2 π (r^2) (Sqrt[-(d^2)+(r^2)])), d<0&&d+r>0&&(Sqrt[-(d^2)+(r^2)])-R==0}, {((π (R^3))/6), (d-r==0&&d+r-R==0&&d>0)||(d<0&&d+r==0&&d-r+R==0)}, {((π (R^4) (6 d r-(R^2)))/(24 (r^3))), d>0&&d-r==0&&d+r-R>0}, {((π (R^4) (6 d r+(R^2)))/(24 (d^3))), d<0&&d+r==0&&d-r+R<0}, {-((π (R^2) (3 (d^2)-3 (r^2)-4 d R+3 (R^2)))/(6 d)), (d>0&&d-r<0&&d-((r^2)/d)+((R^2)/d)>0&&d-r+R>0&&(Sqrt[-(d^2)+(r^2)])-R>0&&(d/R)-((r^2)/(d R))+(R/d)<2&&d-((r^2)/d)-2 R+((R^2)/d)<0)||(d>0&&d-r<0&&d-((r^2)/d)+((R^2)/d)>0&&(Sqrt[-(d^2)+(r^2)])-R<0&&(d/R)-((r^2)/(d R))+(R/d)<2&&d-((r^2)/d)-2 R+((R^2)/d)<0&&d+r-R>0)}, {((π ((d^4)+4 d (r^3)+3 (r^4)+3 (d^2) (R^2)-3 (r^2) (R^2)))/(6 d)), (d+r>0&&d-((r^2)/d)+((R^2)/d)>0&&d<0&&d+r-R<0&&(Sqrt[-(d^2)+(r^2)])-R>0&&(d/(d+r))-((r^2)/(d (d+r)))+((R^2)/(d (d+r)))<2&&d+2 r+((r^2)/d)-((R^2)/d)>0)||(d+r>0&&d-((r^2)/d)+((R^2)/d)>0&&d<0&&(Sqrt[-(d^2)+(r^2)])-R<0&&(d/(d+r))-((r^2)/(d (d+r)))+((R^2)/(d (d+r)))<2&&d+2 r+((r^2)/d)-((R^2)/d)>0&&d-r+R<0)}, {(((d^4) π-6 (d^2) π (r^2)+8 d π (r^3)-3 π (r^4)-6 (d^2) π (R^2)+6 π (r^2) (R^2)+8 d π (R^3)-3 π (R^4))/(12 d)), d>0&&d-r>0&&d-r-R<0&&d+r-R>0}, {((-(d^4) π+6 (d^2) π (r^2)+8 d π (r^3)+3 π (r^4)+6 (d^2) π (R^2)-6 π (r^2) (R^2)+8 d π (R^3)+3 π (R^4))/(12 d)), d<0&&d+r<0&&d+r+R>0&&d-r+R<0}, {((4 (d^2) π-12 (d^3) π+18 (d^4) π-12 (d^5) π+3 (d^6) π+12 (d^2) π r-36 (d^3) π r+36 (d^4) π r-12 (d^5) π r+18 (d^2) π (r^2)-36 (d^3) π (r^2)+15 (d^4) π (r^2)+12 (d^2) π (r^3)-15 (d^2) π (r^4)+12 d π (r^5)-3 π (r^6)-6 (d^2) π (R^2)+12 (d^3) π (R^2)-6 (d^4) π (R^2)-12 (d^2) π r (R^2)+12 (d^3) π r (R^2)-12 d π (r^3) (R^2)+6 π (r^4) (R^2)+3 (d^2) π (R^4)-3 π (r^2) (R^4))/(6 d ((d^2)-2 d r+(r^2)-(R^2)))), (d>0&&d-r<0&&d-r+R>0&&(Sqrt[-(d^2)+(r^2)])-R>0)||(d>0&&d-r<0&&(Sqrt[-(d^2)+(r^2)])-R<0&&d+r-R>0)}, {(((d^6) π-3 (d^4) π (r^2)+3 (d^2) π (r^4)-π (r^6)-9 (d^4) π (R^2)+6 (d^2) π (r^2) (R^2)+3 π (r^4) (R^2)+16 (d^3) π (R^3)-9 (d^2) π (R^4)-3 π (r^2) (R^4)+π (R^6))/(24 (d^3))), (d>0&&d-r<0&&d-r+R>0&&(Sqrt[-(d^2)+(r^2)])-R>0&&d-((r^2)/d)+((R^2)/d)≤0)||(d>0&&d-r<0&&d-r+R>0&&(Sqrt[-(d^2)+(r^2)])-R>0&&(d/R)-((r^2)/(d R))+(R/d)≥2)||(d>0&&d-r<0&&d-r+R>0&&(Sqrt[-(d^2)+(r^2)])-R>0&&d-((r^2)/d)-2 R+((R^2)/d)≥0)||(d>0&&d-r<0&&(Sqrt[-(d^2)+(r^2)])-R<0&&d-((r^2)/d)+((R^2)/d)≤0&&d+r-R>0)||(d>0&&d-r<0&&(Sqrt[-(d^2)+(r^2)])-R<0&&(d/R)-((r^2)/(d R))+(R/d)≥2&&d+r-R>0)||(d>0&&d-r<0&&(Sqrt[-(d^2)+(r^2)])-R<0&&d-((r^2)/d)-2 R+((R^2)/d)≥0&&d+r-R>0)}, {((-(d^6) π+9 (d^4) π (r^2)+16 (d^3) π (r^3)+9 (d^2) π (r^4)-π (r^6)+3 (d^4) π (R^2)-6 (d^2) π (r^2) (R^2)+3 π (r^4) (R^2)-3 (d^2) π (R^4)-3 π (r^2) (R^4)+π (R^6))/(24 (d^3))), (d+r>0&&d<0&&d+r-R<0&&(Sqrt[-(d^2)+(r^2)])-R>0&&d-((r^2)/d)+((R^2)/d)≤0)||(d+r>0&&d<0&&d+r-R<0&&(Sqrt[-(d^2)+(r^2)])-R>0&&(d/(d+r))-((r^2)/(d (d+r)))+((R^2)/(d (d+r)))≥2)||(d+r>0&&d<0&&d+r-R<0&&(Sqrt[-(d^2)+(r^2)])-R>0&&d+2 r+((r^2)/d)-((R^2)/d)≤0)||(d+r>0&&d<0&&(Sqrt[-(d^2)+(r^2)])-R<0&&d-((r^2)/d)+((R^2)/d)≤0&&d-r+R<0)||(d+r>0&&d<0&&(Sqrt[-(d^2)+(r^2)])-R<0&&(d/(d+r))-((r^2)/(d (d+r)))+((R^2)/(d (d+r)))≥2&&d-r+R<0)||(d+r>0&&d<0&&(Sqrt[-(d^2)+(r^2)])-R<0&&d+2 r+((r^2)/d)-((R^2)/d)≤0&&d-r+R<0)}, {((-4 (d^2) π-12 (d^2) π R-12 (d^2) π (R^2)+3 (d^4) π (R^2)-6 (d^2) π (r^2) (R^2)+3 π (r^4) (R^2)+12 (d^3) π (R^3)-12 d π (r^2) (R^3)+18 (d^2) π (R^4)-6 π (r^2) (R^4)+12 d π (R^5)+3 π (R^6))/(6 d ((d^2)-(r^2)+2 d R+(R^2)))), (d+r>0&&d<0&&d+r-R<0&&(Sqrt[-(d^2)+(r^2)])-R>0)||(d+r>0&&d<0&&(Sqrt[-(d^2)+(r^2)])-R<0&&d-r+R<0)}}]);

FullSimplify[vol,r>0&&R>0&&d∈Reals]//Timing

Disjoint

FullSimplify[vol,R>0&&r>0&&(d>r+R||d<-(r+R))]

FullSimplify[vol,R>0&&r>0&&Abs[d]>r+R&&d∈Reals]

r inside R

FullSimplify[vol,R>0&&r>0&&(d>0&&d+r<R||d<0&&d-r>-R)]

Overlapping

FullSimplify[vol,0<d<R+r&&r>0&&R>0]

Overlapping and Equal

FullSimplify[vol /. r->R,0<d<2R&&R>0]

Integrate[Boole[x^2+y^2+z^2<R^2&&(x-d)^2+y^2+z^2<R^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->R>0&&0<d<2R]//Timing

Integrate[Boole[x^2+y^2+z^2<R^2&&(x-R)^2+y^2+z^2<R^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->R>0]//Timing

Tangent

FullSimplify[vol,d==-(r+R)&&r>0&&R>0&&d<0]

FullSimplify[vol,d==r+R&&r>0&&R>0&&d==0]

FullSimplify[vol,d==r+R&&r>0&&R>0&&d>0]

Overlapping Volume Equal to 1/2 Volume

Solve[(1/12) π (((d-2 R))^2) (d+4 R)==(1/2)(4/3)π (R^3)/.R->1]//FullSimplify

N[%]

Reduce[((1/12) π (((d-2 R))^2) (d+4 R)==(1/2)(4/3)π (R^3)/.R->1)&&0<d<1,d]

FullSimplify[Root[8-12 #1+((#1)^3)&,2]]

ToRadicals[%]//FullSimplify

N[Root[8-12 #1+((#1)^3)&,2],20]

FullSimplify[(1/12) π (((d-2 R))^2) (d+4 R)/.d->(-2 Cos[((2 π)/9)]+2 (Sqrt[3]) Sin[((2 π)/9)])R]