我想要得到这样的图像:
有两个相交的球体,标记中心,交点上的一个点也应标记,并突出显示交点。
我曾尝试使用 来使这个工作pst-solides3d
,但我花了几个小时才使这个示例工作起来(关联),看起来好像是手动标记了交点。我无法将此圆柱体/球体交点转换为球体/球体交点。结果看起来不太好。
答案1
\documentclass{minimal}
\usepackage{pst-solides3d}
\begin{document}
\psframebox{\begin{pspicture}(-4.5,-4)(5.5,2)
\psset{solidmemory,unit=0.55,
lightsrc=viewpoint,viewpoint=20 20 20 rtp2xyz,Decran=40}
\psSolid[object=sphere,r=2,ngrid=36 36,fillcolor=lightgray,
incolor=lightgray,hollow,name=sph1,action=none](3,0,0)
\psSolid[object=sphere,r=2,ngrid=36 36,fillcolor=lightgray,
incolor=lightgray,hollow,name=sph2,action=none](1,3,0)
\psSolid[object=fusion,base=sph1 sph2,opacity=0.5,action=draw**](0,0,0)
\end{pspicture}}
\end{document}
答案2
该解决方案使用http://mathworld.wolfram.com/Sphere-SphereIntersection.html
获取交点的坐标P
。spheres.tex
:
\documentclass{article}
\usepackage{lmodern}
\usepackage[inline]{asymptote}
\begin{document}
\begin{figure}
\begin{asy}
settings.prc=false;
settings.render=0;
import graph3;
currentprojection=orthographic(camera=(150,900,412),up=(-0.4,-0.7,1.4),target=(100,111,1),zoom=0.5);
currentlight=nolight;
size(300);size3(300);
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);
draw(s1
,darkgreen+opacity(0.2)
,render(compression=Low,merge=true)
);
draw(s2
,darkblue+opacity(0.2)
,render(compression=Low,merge=true)
);
dot(v1); label("$V_1$",v1,-X+Z);
dot(v2); label("$V_2$",v2,-X+Z);
dot(P); label("$P$",P,-X-Z);
\end{asy}
\end{figure}
\end{document}
为了处理它latexmk
,请创建文件latexmkrc
:
sub asy {return system("asy '$_[0]'");}
add_cus_dep("asy","eps",0,"asy");
add_cus_dep("asy","pdf",0,"asy");
add_cus_dep("asy","tex",0,"asy");
然后运行latexmk -pdf spheres.tex
。