I would like to get an image like the this:

enter image description here

with two intersecting spheres, marked centers , one point on the intersection should also be marked and a highlighted intersection.

I've tried to get this work with pst-solides3d, but it took me some hours to get the example working (link) and it there it seems as if the intersection was marked manually. I could not get this cylinder/sphere intersection transformed to a sphere/sphere intersection. And the result looks not very nice.

  • 2
    Would you consider the use of asymptote instead? asymptote.sourceforge.net – pluton Jun 30 '13 at 15:45
  • 1
    @pluton: Yes. Everything that (i) produces vector graphics, (ii) is for free and (iii) is available for Linux is ok. – Martin Thoma Jun 30 '13 at 16:02
  • you should have a look at asymptote.sourceforge.net/gallery/index.html and the impact.asy example that you could adapt. It takes some time to get used to asymptote but it is probably a relevant solution for such 3D figures. – pluton Jun 30 '13 at 16:14

       lightsrc=viewpoint,viewpoint=20 20 20 rtp2xyz,Decran=40}
\psSolid[object=sphere,r=2,ngrid=36 36,fillcolor=lightgray,
\psSolid[object=sphere,r=2,ngrid=36 36,fillcolor=lightgray,
\psSolid[object=fusion,base=sph1 sph2,opacity=0.5,action=draw**](0,0,0)


enter image description here

  • Nice work :-) Is it possible to mark the intersection (a circle)? (By the way, I've added this to my repository as I don't know many pstricks examples and I know many others would like to have some examples, too) – Martin Thoma Jul 2 '13 at 13:51

enter image description here

This solution uses http://mathworld.wolfram.com/Sphere-SphereIntersection.html to get the coordinates of the intersection point P. spheres.tex:

import graph3;


real r1=162;
real r2=100;

triple v1=(0,0,0);
triple v2=(250,0,0);

// from http://mathworld.wolfram.com/Sphere-SphereIntersection.html :
real d=arclength(v1--v2); // distance between v1,v2
real a=1/2/d*sqrt((2*d*r1)^2-(d^2-r2^2+r1^2)^2);

triple P=(sqrt(r1^2-a^2),0,-a);

triple fs1(pair t){
  return v1+r1*(cos(t.x)*sin(t.y),sin(t.x)*sin(t.y),cos(t.y));

triple fs2(pair t){
  return v2+r2*(cos(t.x)*sin(t.y),sin(t.x)*sin(t.y),cos(t.y));

surface s1=surface(fs1,(0,0),(2pi,pi),16,Spline);
surface s2=surface(fs2,(0,0),(2pi,pi),16,Spline);



dot(v1); label("$V_1$",v1,-X+Z);
dot(v2); label("$V_2$",v2,-X+Z);
dot(P); label("$P$",P,-X-Z);

To process it with latexmk, create file latexmkrc:

sub asy {return system("asy '$_[0]'");}

and run latexmk -pdf spheres.tex.

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.