Cylinder
更多信息和选项
范例
打开所有单元 关闭所有单元基本范例 (4)
Graphics3D[Cylinder[]]Graphics3D[Cylinder[{{0, 0, 0}, {1, 1, 1}}, 1 / 2]]{Graphics3D[{Yellow, Cylinder[]}], Graphics3D[{EdgeForm[Thick], Cylinder[]}], Graphics3D[{EdgeForm[Dashed], Cylinder[]}], Graphics3D[{EdgeForm[Directive[Thick, Dashed, Blue]], Yellow, Cylinder[]}]}Volume[Cylinder[{{Subscript[x, 1], Subscript[y, 1], Subscript[z, 1]}, {Subscript[x, 2], Subscript[y, 2], Subscript[z, 2]}}, r]]RegionCentroid[Cylinder[{{Subscript[x, 1], Subscript[y, 1], Subscript[z, 1]}, {Subscript[x, 2], Subscript[y, 2], Subscript[z, 2]}}, r]]范围 (23)
图形 (13)
规范 (5)
Graphics3D[Cylinder[{{0, 0, 0}, {0, 0, 1}}]]Graphics3D[{Cylinder[{{0, 0, 3}, {0, 0, -3}}, 1], Cylinder[{{5, 0, 3}, {5, 0, -3}}, 3]}]Graphics3D[{Cylinder[{{0, 0, 0}, {1, 0, 0}}], Cylinder[{{1, 1, 1}, {2, 3, 1}}]}]Graphics3D[Cylinder[], Axes -> True]s = {{0, 0, 0}, {0, 0, 2}};Graphics3D[Cylinder[{s, s + 2}]]样式化 (5)
Table[Graphics3D[{c, Cylinder[]}], {c, {Red, Green, Blue, Yellow}}]FaceForm 和 EdgeForm 可用于指定表面和边缘的样式:
Graphics3D[{FaceForm[Pink], EdgeForm[Directive[Dashed, Thick, Blue]], Cylinder[]}]使用 FaceForm 可以指定前面和背面的不同属性:
Graphics3D[{FaceForm[Yellow, Blue], Cylinder[]}, PlotRange -> {{-1, 1}, {-.8, 1}, {-1, 1}}]Table[Graphics3D[{Orange, Specularity[White, n], Cylinder[]}, Lighting -> {{"Point", White, Scaled[{2, -1, 1.2}]}}], {n, {5, 20, 100}}]Graphics3D[{Glow[Red], Black, Cylinder[]}]Opacity 指定表面不透明度:
Table[Graphics3D[{Opacity[o], Cylinder[]}], {o, {0.3, 0.5, 0.9}}]坐标 (3)
使用 Scaled 坐标:
Graphics3D[Cylinder[{Scaled[{.5, .5, .2}], Scaled[{.5, .5, .8}]}, 3], PlotRange -> {{0, 10}, {0, 10}, {0, 10}}, Axes -> True]使用 Scaled 半径:
Graphics3D[Cylinder[{{0, 0, -1}, {0, 0, 1}}, Scaled[0.25]], Axes -> True, PlotRange -> 1]点可以是 Dynamic:
DynamicModule[{x}, {VerticalSlider[Dynamic[x], {0, 1}], Graphics3D[Cylinder[{Dynamic[x{0, 0, 1}], {0, 0, -1}}, 1]]}]区域 (10)
ℛ = Cylinder[{{0, 0, 0}, {1, 1, 1}}, 2];RegionEmbeddingDimension[ℛ]RegionDimension[ℛ]ℛ = Cylinder[{{0, 0, 0}, {1, 1, 1}}, 2];{RegionMember[ℛ, {(1/3), (1/3), (1/3)}], RegionMember[ℛ, {5, 5, 5}]}RegionMember[ℛ, {x, y, z}]ℛ = Cylinder[{{0, 0, 0}, {1, 1, 1}}, 2];{Volume[ℛ], RegionMeasure[ℛ]}c = RegionCentroid[ℛ]Graphics3D[{{Opacity[0.5], LightBlue, ℛ}, {PointSize[Large], Red, Point[c]}}]ℛ = Cylinder[{{0, 0, 0}, {1, 1 / 2, 1}}, 2];{RegionDistance[ℛ, {1., 2, 3}], RegionDistance[ℛ, {(1/3), (1/4), (1/5)}]}ContourPlot3D[Evaluate@RegionDistance[ℛ, {x, y, z}], {x, -3, 4}, {y, -3, 4}, {z, -3, 4}, Mesh -> None, Contours -> {0.25, 0.5, 1}, ContourStyle -> ColorData[94, "ColorList"], Lighting -> "Neutral", BaseStyle -> Opacity[0.5], BoxRatios -> Automatic]ℛ = Cylinder[{{0, 0, 0}, {1, 1, 1}}, 2];{SignedRegionDistance[ℛ, {1, 2, 3}], SignedRegionDistance[ℛ, {(1/3), (1/4), (1/5)}]}ℛ = Cylinder[{{0, 0, 0}, {1, 1, 1}}, 2];{RegionNearest[ℛ, {1, 2, 3}], RegionNearest[ℛ, {(1/3), (1/4), (1/5)}]}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[ℛ], 3];
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"}]]ℛ = Cylinder[{{0, 0, 0}, {1, 1, 1}}, 2];BoundedRegionQ[ℛ]r = RegionBounds[ℛ]Graphics3D[{{EdgeForm[White], Opacity[0.2, Yellow], Cuboid@@Transpose[r]}, ℛ}, Boxed -> False]ℛ = Cylinder[{{0, 0, 0}, {1, 1, 1}}, 2];Integrate[x + y + z, {x, y, z}∈ℛ]ℛ = Cylinder[{{0, 0, 0}, {1, 1, 1}}, 2];MinValue[{x y z - x y, {x, y, z}∈ℛ}, {x, y, z}]ℛ = Cylinder[{{0, 0, 0}, {1, 1, 1}}, 2];Reduce[x^2 + y^2 + z^2 == 1 && x - y - z == -1 && z^2 == x y && {x, y, z}∈ℛ, {x, y, z}]应用 (6)
ℛ = Cylinder[{{0, 0, 0}, {0, 0, h}}, r];Minimize[{Area[RegionBoundary[ℛ]], Volume[ℛ] == 2π && r > 0 && h > 0}, {r, h}]Graphics3D[#, PlotLabel -> Area[RegionBoundary[#]]]& /@ Diagonal@Table[ℛ, {r, {1 / 2, 1, 2}}, {h, {8, 2, 1 / 2}}]{v, e} = Transpose[PolyhedronData["Platonic", {"Vertices", "Edges"}]];Row@MapThread[Graphics3D[{Specularity[White, 30], EdgeForm[], Orange, GraphicsComplex[#1, {Table[Sphere[i, .2], {i, Length[#1]}], (Cylinder[#, .1]& /@ #2)}]}, Boxed -> False, Method -> {"ShrinkWrap" -> True}]&, {v, e}]data = RandomReal[{1, 10}, {12, 4}];Graphics3D[MapIndexed[{Hue[(Last[#2] - 1) / 4], Cylinder[{Append[{1, 2}#2, 0], Append[{1, 2}#2, #1]}, .4]}&, data, {2}], Axes -> {False, False, True}, Lighting -> "Neutral"]使用 Cylinder 渲染 GraphPlot3D 中的边:
GraphPlot3D[Table[i -> Mod[i ^ 2, 50], {i, 0, 50}], EdgeShapeFunction -> ({Cylinder[#1[[{1, -1}]], 0.1]}&), VertexShapeFunction -> ({Sphere[#, 0.3]}&)]根据 Cylinder 定义 ChartElementFunction:
CylinderBar[{{xmin_, xmax_}, {ymin_, ymax_}, {zmin_, zmax_}}, ___] :=
Cylinder[{{(xmin + xmax) / 2, (ymin + ymax) / 2, zmin}, {(xmin + xmax) / 2, (ymin + ymax) / 2, zmax}}, Min[(xmax - xmin) / 2, (ymax - ymin) / 2]]data = RandomReal[1, {2, 5}];BarChart3D[data, ChartElementFunction -> CylinderBar]BarChart3D 使用 Cylinder 生成三维条形图:
BarChart3D[data, ChartElementFunction -> "Cylinder"]Histogram3D 可以相似地使用 Cylinder:
Histogram3D[RandomReal[NormalDistribution[0, 1], {500, 2}], 10, ChartElementFunction -> "Cylinder"]使用 Cylinder 显示 BubbleChart3D 中的气泡:
BubbleChart3D[RandomReal[1, {3, 10, 4}], ChartElements -> Graphics3D[Cylinder[]]]属性和关系 (5)
使用 Scale 得到椭圆形圆柱体:
Graphics3D[Scale[Cylinder[], {2, 4, 3}, {0, 0, 0}], Axes -> True]使用 ParametricPlot3D 生成的圆柱壳的参数规范:
ParametricPlot3D[{Cos[θ], Sin[θ], z}, {θ, 0, 2π}, {z, -1, 1}, Mesh -> None]由 ContourPlot3D 生成的圆柱壳的隐式规范:
ContourPlot3D[x ^ 2 + y ^ 2 == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, Mesh -> None]ChemicalData 使用球和圆柱体绘制分子:
ChemicalData["Acridone", "MoleculePlot"]ImplicitRegion 可以表示任意 Cylinder 区域:
Subscript[ℛ, 1] = ImplicitRegion[0 ≤ Subscript[t, 1] + Subscript[t, 2] + Subscript[t, 3] ≤ 3 && Subsuperscript[t, 1, 2] + Subsuperscript[t, 2, 2] + Subsuperscript[t, 3, 2] ≤ 6 + Subscript[t, 2]Subscript[t, 3] + Subscript[t, 1](Subscript[t, 2] + Subscript[t, 3]), {Subscript[t, 1], Subscript[t, 2], Subscript[t, 3]}];
Subscript[ℛ, 2] = Cylinder[{{0, 0, 0}, {1, 1, 1}}, 2];RegionEqual[Subscript[ℛ, 1], Subscript[ℛ, 2]]巧妙范例 (3)
Graphics3D[Table[{EdgeForm[Opacity[.3]], Hue[RandomReal[]], Cylinder[RandomReal[10, {2, 3}]]}, {20}]]Graphics3D[{Opacity[0.3], EdgeForm[], Table[{ColorData["Rainbow"][Rescale[c, {0, 2Pi}]], GeometricTransformation[Cylinder[], RotationTransform[c, {-3, 2, -1}, {2, -1, 1}]]}, {c, 0, 2Pi, 2Pi / 18}]}]Graphics3D[{Opacity[.3], EdgeForm[Opacity[.3]], Table[Cylinder[{{0, 0, 0}, {0, 0, 2r}}, r], {r, 1, 5}]}, Boxed -> False]技术笔记
-
▪
- 三维图形基元
文本
Wolfram Research (2007),Cylinder,Wolfram 语言函数,https://reference.wolfram.com/language/ref/Cylinder.html (更新于 2014 年).
CMS
Wolfram 语言. 2007. "Cylinder." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2014. https://reference.wolfram.com/language/ref/Cylinder.html.
APA
Wolfram 语言. (2007). Cylinder. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/Cylinder.html 年
BibTeX
@misc{reference.wolfram_2026_cylinder, author="Wolfram Research", title="{Cylinder}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/Cylinder.html}", note=[Accessed: 11-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_cylinder, organization={Wolfram Research}, title={Cylinder}, year={2014}, url={https://reference.wolfram.com/language/ref/Cylinder.html}, note=[Accessed: 11-September-2026]}