4
$\begingroup$

I use RegionIntersection to find the circle between 2 spheres, but Mathematica returns :

RegionIntersection[
Sphere[Point[{-(1/4) Sqrt[3 + 6/Sqrt[5]], -(Sqrt[3]/4), Sqrt[
   3/4 + 3/(2 Sqrt[5])]}], 0.3], 
Sphere[{0, 0, 0}, 1/4 (Sqrt[3] + Sqrt[15])]] 

and not Cirlce[...] . And if it is not possible is there a way to display this intersection in a Graphics3D , Mathematica says "RegionIntersection is not a Graphics3D primitive or directive." Thank you.

$\endgroup$
  • $\begingroup$ "not Circle[...]" - because Circle[] as it is currently defined in Mathematica cannot be used to represent an object living in three dimensions. If you want to see it, look at DiscretizeRegion[]. $\endgroup$ – J. M.'s technical difficulties May 31 at 12:40
7
$\begingroup$

Do not use Graphics3D with regions. You cannot get Circle as simplified version, as it is 2D primitive in Wolfram Language (read docs on it), and you got 3D space. But the long expression you get after RegionIntersection is a 2D circle embedded in 3D:

Region[reg=RegionIntersection[
    Sphere[{-(1/4) Sqrt[3+6/Sqrt[5]],-(Sqrt[3]/4),Sqrt[3/4+3/(2 Sqrt[5])]},.3],
    Sphere[{0,0,0},1/4 (Sqrt[3]+Sqrt[15])]],
Boxed->True,Axes->True,SphericalRegion->True]

enter image description here

You can even compute its measure, which is 1D:

In[]:= RegionMeasure[reg]
Out[]= 1.87412

In[]:= ArcLength[reg]
Out[]= 1.87412
| improve this answer | |
$\endgroup$
5
$\begingroup$

If you'd also like a solution that gives you the position, radius and orientation of the circle you can use this:

getcircle[s1_, s2_] := 
 Block[{p1 = s1[[1]], p2 = s2[[1]], r1 = s1[[2]], r2 = s2[[2]],
   d = EuclideanDistance[s2[[1]], s1[[1]]],
   ori = Normalize[s2[[1]] - s1[[1]]]},
  {(*orientation*) ori,
   (*position*)p1 + ori*Sqrt[(d^2 + r1^2 - r2^2)^2/d^2]/2,
   (*radius*)Sqrt[4 d^2 r2^2 - (d^2 - r1^2 + r2^2)^2]/(2 d)
   }]

ms1 = Sphere[{-(1/4) Sqrt[3 + 6/Sqrt[5]], -(Sqrt[3]/4), Sqrt[3/4 + 3/(2 Sqrt[5])]}, 0.3];
ms2 = Sphere[{0, 0, 0}, 1/4 (Sqrt[3] + Sqrt[15])];

{ori, pos, rad} = getcircle[ms2, ms1];
Graphics3D[{ Opacity[.25], ms1, ms2,
  Opacity[1], Arrow[{pos, pos + ori}],
  FaceForm[None], EdgeForm[{Thick, Blue}], 
  Cylinder[{pos, pos + 0.0001*ori}, rad]}]

sphere sphere intersection

| improve this answer | |
$\endgroup$
  • 3
    $\begingroup$ Replacing 0.3 by 3/10 in the above, one obtains the exact solution {-((Sqrt[3+6/Sqrt[5]] (339/400+3/(2 Sqrt[5])+1/16 (3+6/Sqrt[5])+1/16 (Sqrt[3]+Sqrt[15])^2))/(8 (15/16+3/(2 Sqrt[5])+1/16 (3+6/Sqrt[5])))),-((Sqrt[3] (339/400+3/(2 Sqrt[5])+1/16 (3+6/Sqrt[5])+1/16 (Sqrt[3]+Sqrt[15])^2))/(8 (15/16+3/(2 Sqrt[5])+1/16 (3+6/Sqrt[5])))),(Sqrt[3/4+3/(2 Sqrt[5])] (339/400+3/(2 Sqrt[5])+1/16 (3+6/Sqrt[5])+1/16 (Sqrt[3]+Sqrt[15])^2))/(2 (15/16+3/(2 Sqrt[5])+1/16 (3+6/Sqrt[5])))}. for the center and the radius. $\endgroup$ – user64494 May 31 at 17:38
  • $\begingroup$ ^ which in turn simplifies to: {-Sqrt[(3*(23545 + 9691*Sqrt[5]))/10]/200, -Sqrt[(3*(4163 + 273*Sqrt[5]))/2]/200, Sqrt[(3*(23545 + 9691*Sqrt[5]))/10]/100} $\endgroup$ – flinty May 31 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.