使用maxima計算結果如下
設半徑4的球心\(A(0,0,0)\),半徑9的球心\(B(13,0,0)\),半徑16的球心\(\displaystyle C\left(-\frac{28}{13},\frac{48\sqrt{29}}{13},0\right)\)
外公切平面方程式為\(30\sqrt{29}x+271y\pm 13\sqrt{455}z+312\sqrt{29}=0\)
和半徑4的球相切於\(\displaystyle A' \left(-\frac{20}{13},-\frac{542}{39\sqrt{29}},-\frac{2\sqrt{455}}{3\sqrt{29}}\right)\)
和半徑9的球相切於\(\displaystyle B' \left(\frac{124}{13},-\frac{813}{26\sqrt{29}},-\frac{3\sqrt{455}}{2\sqrt{29}}\right)\)
和半徑16的球相切於\(\displaystyle C' \left(-\frac{108}{13},\frac{2008}{39\sqrt{29}},-\frac{8\sqrt{455}}{3\sqrt{29}}\right)\)
程式碼
# Default code
mod = Sketchup.active_model # Open model
ent = mod.entities # All entities in model
sel = mod.selection # Current selection
###########先產生動畫所需的各個群組###########
#半徑10的圓
circle=ent.add_circle [0,0,0],[0,0,1],10
#將圓的各頂點形成面
cv_arr = []
circle.each do |c|
cv_arr << c.vertices[0]
end
face = ent.add_face cv_arr
#新增一個圓的群組
group=ent.add_group(face.all_connected)
group.name="圓"
#新增積分體積群組
pt1=[-10,0,0]
pt2=[-9,Math.sqrt(100-(-9)**2),0]
pt3=[-9,-Math.sqrt(100-(-9)**2),0]
pt4=[-9,0,Math.sqrt(300-3*(-9)**2)]
face=ent.add_face pt1,pt4,pt2
edges=face.edges
for edge in edges
edge.visible=false#將邊隱藏
end
#增加為三角形面
face=ent.add_face pt1,pt4,pt3
edges=face.edges
for edge in edges
edge.visible=false#將邊隱藏
end
#新增正三角形群組
for i in -9..9
x=i
pt1=[i,Math.sqrt(100-i**2),0]
pt2=[i,-Math.sqrt(100-i**2),0]
pt3=[i,0,Math.sqrt(300-3*i**2)]
group = ent.add_group
group.entities.add_curve [pt1,pt2,pt3,pt1]
group.name="正三角形x=#{i}"
group.visible=false
if x==9
break
end
pt4=[i+1,Math.sqrt(100-(i+1)**2),0]
pt5=[i+1,-Math.sqrt(100-(i+1)**2),0]
pt6=[i+1,0,Math.sqrt(300-3*(i+1)**2)]
#增加為四邊形面
face1=ent.add_face pt1 , pt3 , pt6,pt4
edges=face1.edges
for edge in edges
edge.visible=false#將邊隱藏
end
#增加為四邊形面
face2=ent.add_face pt2 , pt3 , pt6,pt5
edges=face2.edges
for edge in edges
edge.visible=false#將邊隱藏
end
end
pt1=[10,0,0]
pt2=[9,Math.sqrt(100-9**2),0]
pt3=[9,-Math.sqrt(100-9**2),0]
pt4=[9,0,Math.sqrt(300-3*9**2)]
face=ent.add_face pt1,pt2,pt4
edges=face.edges
for edge in edges
edge.visible=false#將邊隱藏
end
face=ent.add_face pt1,pt3,pt4
edges=face.edges
for edge in edges
edge.visible=false#將邊隱藏
end
group = ent.add_group(face.all_connected)
group.name="積分體積"
group.visible=false
#只留下x=-6的正三角形,其餘正三角形隱藏
for i in 2..6
ent[ i ].visible=false
end
for i in 8..20
ent[ i ].visible=false
end
pages=mod.pages.add "場景號23"
#改顯示積分體積(刪除一半的面)
ent[21].visible=false
ent[22].visible=true
pages=mod.pages.add "場景號24"
程式碼
# Default code
mod = Sketchup.active_model # Open model
ent = mod.entities # All entities in model
sel = mod.selection # Current selection
###########先產生動畫所需的各個群組###########
#半徑30的圓
circle=ent.add_circle [0,0,0],[0,0,1],30
#將圓的各頂點形成面
cv_arr = []
circle.each do |c|
cv_arr << c.vertices[0]
end
face = ent.add_face cv_arr
#新增一個圓的群組
group=ent.add_group(face.all_connected)
#縮成一個橢圓
t = Geom::Transformation.scaling(1.0, 0.6666, 1.0)
group.transform!(t)
group.name="橢圓"
#增加為正方形面
face=ent.add_face pt0,pt1,pt2
face=ent.add_face pt0,pt2,pt3
face=ent.add_face pt0,pt3,pt4
#將所有連接平面的邊都隱藏起來
for edge in face.all_connected.grep(Sketchup::Edge)
edge.visible=false#將邊隱藏
end
#將所有連接平面的面都反轉過來
for faces in face.all_connected.grep(Sketchup::Face)
faces.reverse!
end
group = ent.add_group(face.all_connected)
group.name="積分體積"
group.visible=false
#複製原本的積分體積群組後再手動刪除一半的面
group2=group.copy
group2.name="積分體積(刪除一半的面)"
group2.visible=false
###########新增場景,依序顯示各個群組###########
#顯示橢圓
ent[0].visible=true
pages=mod.pages.add "場景號1"
#顯示x軸y軸
ent[1].visible=true
ent[2].visible=true
pages=mod.pages.add "場景號2"
for i in 3..21
ent[ i ].visible=true#顯示正方形
pages=mod.pages.add "場景號#{i+1}"
end
#顯示積分體積
ent[22].visible=true
pages=mod.pages.add "場景號22"
#只留下x=-12的正方形,其餘正方形隱藏
for i in 3..7
ent[ i ].visible=false
end
for i in 9..21
ent[ i ].visible=false
end
pages=mod.pages.add "場景號23"
#改顯示積分體積(刪除一半的面)
ent[22].visible=false
ent[23].visible=true
pages=mod.pages.add "場景號24"
程式碼
# Default code, use or delete...
mod = Sketchup.active_model # Open model
ent = mod.entities # All entities in model
sel = mod.selection # Current selection
#ent.add_face [5,5,0],[5,-5,0],[-5,-5,0],[-5,5,0]
r=5*Math.sqrt(2)
group = ent.add_group
group.entities.add_arc [0,0,0],[1,1,0],[1,-1,0],r,0.degrees,180.degrees
group.name="半圓形1"
group.visible=false
group = ent.add_group
group.entities.add_arc [0,0,0],[-1,1,0],[1,1,0],r,0.degrees,180.degrees
group.name="半圓形2"
group.visible=false
face=ent.add_face [5,5,0],[-5,5,0],[-5,-5,0],[5,-5,0]
for z in 0..6
x=Math.sqrt((r**2-z**2)/2)
y=x
pt1=[x,y,z]
pt2=[-x,y,z]
pt3=[-x,-y,z]
pt4=[x,-y,z]
group = ent.add_group
group.entities.add_curve [pt1,pt2,pt3,pt4,pt1]
group.name="正方形z=#{z}"
group.visible=false
if z==6
break
end
x=Math.sqrt((r**2-(z+1)**2)/2)
y=x
pt5=[x,y,z+1]
pt6=[-x,y,z+1]
pt7=[-x,-y,z+1]
pt8=[x,-y,z+1]
#增加為四邊形面
face=ent.add_face pt1,pt5,pt8,pt4
face=ent.add_face pt1,pt2,pt6,pt5
face=ent.add_face pt2,pt3,pt7,pt6
face=ent.add_face pt3,pt4,pt8,pt7
end
pt9=[0,0,r]
face=ent.add_face pt9,pt1,pt2
face=ent.add_face pt9,pt2,pt3
face=ent.add_face pt9,pt3,pt4
face=ent.add_face pt9,pt4,pt1
#將所有連接平面的邊都隱藏起來
for edge in face.all_connected.grep(Sketchup::Edge)
edge.visible=false#將邊隱藏
end
group = ent.add_group(face.all_connected)
group.name="積分體積"
group.visible=false
ent[ 0 ].visible=true#顯示半圓形1
mod.pages.add "場景號2"
ent[ 1 ].visible=true#顯示半圓形2
mod.pages.add "場景號3"
for i in 3..8
ent[ i ].visible=true#顯示正方形
pages=mod.pages.add "場景號#{i+4}"
end
#顯示積分體積
ent[9].visible=true
pages=mod.pages.add "場景號11"
#只留下z=3的正方形,其餘正方形隱藏
for i in 2..4
ent[ i ].visible=false
end
for i in 6..8
ent[ i ].visible=false
end
pages=mod.pages.add "場景號12"
#改顯示積分體積(刪除一半的面)
ent[9].visible=false
ent[10].visible=true
pages=mod.pages.add "場景號13"
#顯示z軸
ent[11].visible=true
pages=mod.pages.add "場景號14"
#顯示直角三角形
ent[12].visible=true
pages=mod.pages.add "場景號15"
程式碼
# Default code, use or delete...
mod = Sketchup.active_model # Open model
ent = mod.entities # All entities in model
sel = mod.selection # Current selection
#產生拋物線x=y^2線段
pts=[]
13.downto(0){|x| pts << [x, Math::sqrt(10.0*x), 0]}
1.upto(13) {|x| pts << [x,-Math::sqrt(10.0*x), 0]}
group = ent.add_group
group.entities.add_curve pts
group.name="拋物線x=y^2"
group.visible=false
#產生正方形框框
for i in 1..14
x=2.0*i
#i=1~5拋物線為x=y^2
#i=6~14拋物線為x=3-2y^2
i<=5?y=Math::sqrt(10.0*x):y=Math::sqrt(150.0-5*x)
z=2.0*y
pt1=[x,y,0]
pt2=[x,y,z]
pt3=[x,-y,z]
pt4=[x,-y,0]
group = ent.add_group
group.entities.add_curve [pt1,pt2,pt3,pt4,pt1]
group.name="正方形x=#{x/10.0}"
group.visible=false
end
#產生積分體積
ptStart=[0,0,0]
x=1
y=Math::sqrt(10.0*x)
z=2.0*y
pt1=[x,y,0]
pt2=[x,y,z]
pt3=[x,-y,z]
pt4=[x,-y,0]
face=ent.add_face ptStart,pt1,pt2
face=ent.add_face ptStart,pt2,pt3
face=ent.add_face ptStart,pt3,pt4
for i in 2..29
x=i
i<=10?y=Math::sqrt(10.0*x):y=Math::sqrt(150.0-5*x)
z=2.0*y
pt5=[x,y,0]
pt6=[x,y,z]
pt7=[x,-y,z]
pt8=[x,-y,0]
face=ent.add_face pt1,pt5,pt6,pt2
face=ent.add_face pt2,pt3,pt7,pt6
face=ent.add_face pt4,pt3,pt7,pt8
pt1=pt5
pt2=pt6
pt3=pt7
pt4=pt8
end
ptEnd=[30,0,0]
face=ent.add_face ptEnd,pt1,pt2
face=ent.add_face ptEnd,pt2,pt3
face=ent.add_face ptEnd,pt3,pt4
#將所有連接平面的邊都隱藏起來
for edge in face.all_connected.grep(Sketchup::Edge)
edge.visible=false#將邊隱藏
end
#將所有連接平面的面都反轉過來
for faces in face.all_connected.grep(Sketchup::Face)
faces.reverse!
end
group = ent.add_group(face.all_connected)
group.name="積分體積"
group.visible=false
#只留下x=0.6,2.0的正方形
for i in 3..16
ent[ i ].visible=false#隱藏正方形
end
ent[ 5 ].visible=true#顯示x=0.6的正方形
ent[ 12].visible=true#顯示x=2.0的正方形
pages=mod.pages.add "場景號19"