Ball
更多信息和选项
- Ball 也称作中心区间、圆盘、球和和超球.
- Ball 可用作几何区域和图形基元.
- Ball[] 等价于 Ball[{0,0,0}].
- 对于整数 n,Ball[n] 等价于 Ball[{0,…,0}],在
中的单位球. - Ball 表示实心球
. 对于长度为
的点 p,区域是
维的. - Ball 允许 p 为
中的任意点,r 为任意正实数. - Ball 可用于 Graphics 和 Graphics3D.
- 在图形中,点 p、pi 和半径 r 可以是 Scaled 和 Dynamic 表达式.
- 图形渲染受指令 FaceForm、EdgeForm、Specularity、Opacity 和颜色等影响.
- Ball[{p1,p2,…},{r1,r2,…}] 表示中心为 pi、半径为 ri 的一组球体.
背景
- Ball 是一个图形和几何基元,表示一个在
维空间的球. 尤其是,Ball[p,r] 表示一个在
中的(填充的)球
,其中心为 p,半径为 r,r 可以是任何非负实数,p 可以有任何正长度
. 速记形式 Ball[p] 等同于 Ball[p,1],Ball[n] 等同于 Ball[ConstantArray[0, n],1],其中 Ball[] 自动计算为 Ball[{0,0,0}]. - 共同半径
的球对象(多个球)收集可以使用 Ball[{p1,…,pk},r] 高效表示,有多种半径的球可以用 Ball[{p1,…,pk},{r1,…,rk}] 表示. - Ball 对象可以分别使用 Graphics 和 Graphics3D 在二维和三维中进行可视格式化. 图形中的 Ball 对象外观的修改可以通过指定边指令 EdgeForm (2D) 或面指令 FaceForm (3D),颜色指令例如,Red,透明度和镜面反射度 Opacity 和 Specularity,样式选项 Antialiasing.
- Ball 也可以作为在其上执行计算的区域规范. 例如,Integrate[1,{x,y,z}∈Ball[{0,0,0},r]] 和 Volume[Ball[{0,0,0},r]] 均返回半径为
的 3D 球的体积 
. - Ball 还与其他符号相关. Sphere 表示球的边界,可以用 RegionBoundary[Ball[{x,y,z},r]] 计算. Ball 是 Interval 和 Disk 到任意维数的推广,Ellipsoid 是 Ball 的推广,在某种意义上,对于所有
,Ball[{p1,…,pk},1] 等同于 Ellipsoid[{p1,…,pk},ConstantArray[1,k]]. SphericalShell 给出了从较大的同心球的内部去除一个小球而获得的填充的壳. 3D 中的 Ball 对象可以表示为 ImplicitRegion[(x-u)2+(y-v)2+(z-w)2≤r2,{u,v,w}] 或 ParametricRegion[a{Cos[θ]Sin[ϕ],Sin[θ]Sin[ϕ],Cos[ϕ]}-{x,y,z},{{θ,0,2π},{ϕ,0,π},{a,0,r}}]. 3D 球的预计算属性和其在标准位置上的变体可使用 SolidData["entity", "property"] 或 EntityValue[Entity["Ball","entity"],"property"],其中"entity" 是 "Ball" 或 "HalfBall" 中的一个.
范例
打开所有单元 关闭所有单元基本范例 (2)
范围 (22)
图形 (12)
指定 (4)
Graphics3D[Ball[]]Graphics[Ball[2]]Graphics3D[Ball[3]]Graphics3D[{Ball[{-1, -1, -1}], Ball[{1, 2, 3}, 2]}]Graphics3D[Ball[{{0, 0, 0}, {1, 1, 1}}, 1 / 2]]样式化 (4)
Table[Graphics3D[{Orange, Specularity[White, n], Ball[]}], {n, {5, 20, 100}}]Graphics3D[{Glow[Red], Black, Ball[]}]Opacity 指定面的不透明度:
Table[Graphics3D[{Opacity[o], Ball[]}], {o, {0.3, 0.5, 0.9}}]Graphics[{EdgeForm[{Thick, Dashed, Blue}], Brown, Ball[2]}]坐标 (4)
Graphics[Ball[Scaled[{0.5, 0.75}], 1], PlotRange -> {{0, 4}, {0, 4}}, Frame -> True]Graphics3D[Ball[Scaled[{0.5, 0.5, 0.75}], 1], PlotRange -> {{0, 4}, {0, 4}, {0, 4}}, Axes -> True]Graphics[Ball[{2, 2}, Scaled[0.25]], Frame -> True]Graphics3D[Ball[{0, 0, 0}, Scaled[0.25]], Axes -> True]Graphics[Ball[ Scaled[{0.5, 0.25}, {1, 1}], 0.5], Frame -> True]Graphics3D[Ball[Scaled[{0, 0, 0.5}, {1, 1, 1}]], PlotRange -> {{0, 4}, {0, 4}, {0, 4}}, Axes -> True]点可以是 Dynamic:
DynamicModule[{x}, {Slider[Dynamic[x], {-0.5, 0.5}], Graphics3D[{Ball[], Ball[{Dynamic[x], 1, 1}, 0.3]}]}]区域 (10)
RegionEmbeddingDimension[Ball[{Subscript[c, 1], Subscript[c, 2], Subscript[c, 3]}, r]]RegionDimension[Ball[{Subscript[c, 1], Subscript[c, 2], Subscript[c, 3]}, r]]ℛ = Ball[{0, 0, 0}, 1];{RegionMember[ℛ, {(1/3), (1/3), (1/3)}], RegionMember[ℛ, {1, 1, 1}]}RegionMember[ℛ, {x, y, z}]ℛ = Ball[{0, 0, 0}, 1];{Volume[ℛ], RegionMeasure[ℛ]}c = RegionCentroid[ℛ]Graphics3D[{{Opacity[0.5], LightBlue, ℛ}, {PointSize[Large], Red, Point[c]}}]ℛ = Ball[{0, 0, 0}, 1];{RegionDistance[ℛ, {(1/3), (1/4), (1/5)}], RegionDistance[ℛ, {1, 1, 1}]}Plot3D[RegionDistance[Ball[{0, 0}, 1], {x, y}], {x, -2, 2}, {y, -2, 2}, MeshFunctions -> {#3&}, Mesh -> 5]ContourPlot3D[Evaluate@RegionDistance[ℛ, {x, y, z}], {x, -2, 2}, {y, 0, 2}, {z, -2, 2}, Mesh -> None, Contours -> {0.25, 0.5, 1}, ContourStyle -> ColorData[94, "ColorList"], Lighting -> "Neutral", BaseStyle -> Opacity[0.5], BoxRatios -> Automatic]ℛ = Ball[{0, 0, 0}, 1];{SignedRegionDistance[ℛ, {1, 1, 1}], SignedRegionDistance[ℛ, {1 / 2, 1 / 2, 1 / 2}]}Plot3D[SignedRegionDistance[Ball[{0, 0}, 1], {x, y}], {x, -2, 2}, {y, -2, 2}, MeshFunctions -> {#3&}, Mesh -> {{0}}, MeshShading -> {Red, Green}]ℛ = Ball[{0, 0, 0}, 1];{RegionNearest[ℛ, {1, 1, 1}], RegionNearest[ℛ, {1 / 2, 1 / 2, 1 / 2}]}spherePoints[{n_, m_}, c_, r_] :=
Flatten[Table[c + r{Cos[k 2π / n]Sin[l π / m], Sin[k 2π / n]Sin[l π / m], Cos[l π / m]}, {k, 0., n - 1}, {l, 0., m - 1}], 1];pl = spherePoints[{16, 8}, RegionCentroid[ℛ], 2];
npl = Table[RegionNearest[ℛ, p], {p, pl}];Legended[Graphics3D[{ℛ, {Thin, Gray, Line[Transpose[{pl, npl}]]}, {Red, Point[pl]}, {PointSize[Medium], Blue, Point[npl]}}, Lighting -> "Neutral", Boxed -> False], PointLegend[{Red, Blue}, {"start", "nearest"}]]ℛ = Ball[{0, 0, 0}, 1];BoundedRegionQ[ℛ]r = RegionBounds[ℛ]Graphics3D[{{EdgeForm[White], Opacity[0.2, Yellow], Cuboid@@Transpose[r]}, ℛ}, Boxed -> False]ℛ = Ball[{Subscript[c, 1], Subscript[c, 2], Subscript[c, 3]}, r];Integrate[x y z, {x, y, z}∈ℛ]ℛ = Ball[{1, 2, 3}, 4];MinValue[{x y z - x y, {x, y, z}∈ℛ}, {x, y, z}]ℛ = Ball[{1, 2, 3}, 3];Reduce[x^2 + y^2 + z^2 == 1 && x - y - z == -(1/2) && z^2 == x y + (1/4) && {x, y, z}∈ℛ, {x, y, z}]应用 (3)
ℛ = Ball[{0, 0, 0}, r];Minimize[{Area[RegionBoundary[ℛ]], Volume[ℛ] == 2π && r > 0}, {r}]ℛ = Ball[{a, b, c}, r];Integrate[x y z, {x, y, z}∈ℛ, Assumptions -> r > 0 && (a | b | c)∈Reals]ℛ = Ball[{0, 0, 0}, Quantity[3, "Centimeters"]];d = ChemicalData["Caffeine", "Density"]v = Volume[ℛ]FormulaData["MassDensity", {"ρ" -> d, "V" -> N[v]}]属性和关系 (5)
RegionMember[Disk[{0, 0}, 1], {x, y}]RegionMember[Ball[{0, 0}, 1], {x, y}]Sphere 是 Ball 的 RegionBoundary:
RegionBoundary[Ball[{x, y, z}, r]]Subscript[ℛ, 1] = Ellipsoid[{Subscript[c, 1], Subscript[c, 2], Subscript[c, 3], Subscript[c, 4]}, {1, 1, 1, 1}];
Subscript[ℛ, 2] = Ball[{Subscript[c, 1], Subscript[c, 2], Subscript[c, 3], Subscript[c, 4]}, 1];RegionEqual[Subscript[ℛ, 1], Subscript[ℛ, 2]]ImplicitRegion 可以表示任何 Ball:
Subscript[ℛ, 1] = ImplicitRegion[(Subscript[t, 1] - Subscript[c, 1])^2 + (Subscript[t, 2] - Subscript[c, 2])^2 + (Subscript[t, 3] - Subscript[c, 3])^2 + (Subscript[t, 4] - Subscript[c, 4])^2 ≤ 1, {Subscript[t, 1], Subscript[t, 2], Subscript[t, 3], Subscript[t, 4]}];
Subscript[ℛ, 2] = Ball[{Subscript[c, 1], Subscript[c, 2], Subscript[c, 3], Subscript[c, 4]}, 1];RegionEqual[Subscript[ℛ, 1], Subscript[ℛ, 2]]Ball 是欧几里德范数的范数球:
ℛ = Ball[{0, 0, 0, 0}, 1];Reduce[{Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[x, 4]}∈ℛ⧦Norm[{Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[x, 4]}] ≤ 1, {Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[x, 4]}, Reals]文本
Wolfram Research (2014),Ball,Wolfram 语言函数,https://reference.wolfram.com/language/ref/Ball.html.
CMS
Wolfram 语言. 2014. "Ball." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/Ball.html.
APA
Wolfram 语言. (2014). Ball. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/Ball.html 年
BibTeX
@misc{reference.wolfram_2026_ball, author="Wolfram Research", title="{Ball}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/Ball.html}", note=[Accessed: 12-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_ball, organization={Wolfram Research}, title={Ball}, year={2014}, url={https://reference.wolfram.com/language/ref/Ball.html}, note=[Accessed: 12-September-2026]}