Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132934 views
License: OTHER
1
\documentclass{article}
2
\usepackage{lmodern}
3
\usepackage[inline]{asymptote}
4
\begin{document}
5
\begin{figure}
6
\begin{asy}
7
settings.prc=false;
8
settings.render=0;
9
import graph3;
10
11
currentprojection=orthographic(camera=(150,900,412),up=(-0.4,-0.7,1.4),target=(100,111,1),zoom=0.5);
12
currentlight=nolight;
13
size(300);size3(300);
14
15
real r1=162;
16
real r2=100;
17
18
triple v1=(0,0,0);
19
triple v2=(250,0,0);
20
21
// from http://mathworld.wolfram.com/Sphere-SphereIntersection.html :
22
real d=arclength(v1--v2); // distance between v1,v2
23
real a=1/2/d*sqrt((2*d*r1)^2-(d^2-r2^2+r1^2)^2);
24
25
triple P=(sqrt(r1^2-a^2),0,-a);
26
27
triple fs1(pair t){
28
return v1+r1*(cos(t.x)*sin(t.y),sin(t.x)*sin(t.y),cos(t.y));
29
}
30
31
triple fs2(pair t){
32
return v2+r2*(cos(t.x)*sin(t.y),sin(t.x)*sin(t.y),cos(t.y));
33
}
34
35
surface s1=surface(fs1,(0,0),(2pi,pi),16,Spline);
36
surface s2=surface(fs2,(0,0),(2pi,pi),16,Spline);
37
38
draw(s1
39
,darkgreen+opacity(0.2)
40
,render(compression=Low,merge=true)
41
);
42
43
draw(s2
44
,darkblue+opacity(0.2)
45
,render(compression=Low,merge=true)
46
);
47
48
dot(v1); label("$V_1$",v1,-X+Z);
49
dot(v2); label("$V_2$",v2,-X+Z);
50
dot(P); label("$P$",P,-X-Z);
51
\end{asy}
52
\end{figure}
53
\end{document}
54
55