Pyramid[{p1,…,p5}]
represents a filled pyramid with base {p1,…,p4} and top p5.
Pyramid
Pyramid[{p1,…,p5}]
represents a filled pyramid with base {p1,…,p4} and top p5.
Details and Options
- Pyramid can be used as a geometric region and a graphics primitive.
- Pyramid represents a filled polyhedron given by the polygon faces {p4,p3,p2,p1}, {p1,p2,p5}, {p2,p3,p5}, {p3,p4,p5}, and {p4,p1,p5}.
- CanonicalizePolyhedron can be used to convert a pyramid to an explicit Polyhedron object.
- Pyramid can be used in Graphics3D.
- In graphics, the points pi can be Scaled and Dynamic expressions.
- Graphics rendering is affected by directives such as FaceForm, EdgeForm, Opacity, Texture, and color.
- The following options and settings can be used in graphics:
-
VertexColors Automatic vertex colors to be interpolated VertexNormals Automatic effective vertex normals for shading VertexTextureCoordinates None coordinates for textures
Examples
open all close allBasic Examples (3)
Graphics3D[Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}]]ℛ = Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}];Graphics3D[{EdgeForm[{Thick, Dashed, Blue}], FaceForm[{Pink, Opacity[0.7]}], ℛ}, Boxed -> False]{Graphics3D[{Pink, ℛ}], Graphics3D[{EdgeForm[Thick], ℛ}], Graphics3D[{EdgeForm[Dashed], ℛ}], Graphics3D[{EdgeForm[Directive[Thick, Dashed, Blue]], Pink, ℛ}]}Volume[Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}]]RegionCentroid[Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}]]Scope (18)
Graphics (8)
Specification (2)
Styling (3)
FaceForm and EdgeForm can be used to specify the styles of the faces and edges:
ℛ = Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}];Graphics3D[{EdgeForm[{Thick, Dashed, Blue}], FaceForm[{Pink, Opacity[0.7]}], ℛ}, Boxed -> False]Apply a Texture to the faces:
ℛ = Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}, {0.5, 0.5}}];Graphics3D[{Texture[[image]], ℛ}, Lighting -> "Neutral"]Assign VertexColors to vertices:
Graphics3D[Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, VertexColors -> {Cyan, Magenta, Yellow, Black, White}]]Coordinates (3)
Specify coordinates by fractions of the plot range:
ℛ = Pyramid[{Scaled[{0., 0., 0.}], Scaled[{1., 0., 0.}], Scaled[{1., 1., 0.}], Scaled[{0., 1., 0.}], Scaled[{0.5, 0.5, 1.}]}];Graphics3D[ℛ, PlotRange -> {{0, 10}, {0, 10}, {0, 10}}, Axes -> True]Specify scaled offsets from the ordinary coordinates:
ℛ = Pyramid[{Scaled[{0, 0, 0.5}, {0, 0, 0}], Scaled[{0, 0, 0.5}, {2, 0, 0}], Scaled[{0, 0, 0.5}, {2, 2, 0}], Scaled[{0, 0, 0.5}, {0, 2, 0}], Scaled[{0, 0, 0.5}, {1, 1, 2}]}] ;Graphics3D[ℛ, PlotRange -> {{0, 2}, {0, 2}, {0, 4}}, Axes -> True]Points can be Dynamic:
DynamicModule[{x}, {VerticalSlider[Dynamic[x], {-2, 2}], Graphics3D[Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, Dynamic[x]}}]]}]Regions (10)
Embedding dimension is the dimension of the space in which the pyramid lives:
ℛ = Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}];RegionEmbeddingDimension[ℛ]Geometric dimension is the dimension of the shape itself:
RegionDimension[ℛ]ℛ = Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}];{RegionMember[ℛ, {1, 1, 1}], RegionMember[ℛ, {1, 2, 3}]}Get conditions for membership:
RegionMember[ℛ, {x, y, z}]ℛ = Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}];{Volume[ℛ], RegionMeasure[ℛ]}c = RegionCentroid[ℛ]Graphics3D[{{Opacity[0.5], LightBlue, ℛ}, {PointSize[Large], Red, Point[c]}}, Boxed -> False]ℛ = Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}];{RegionDistance[ℛ, {1, 2, 3}], RegionDistance[ℛ, {1, 1, 1}]}The equidistance contours for a pyramid:
ContourPlot3D[Evaluate@RegionDistance[ℛ, {x, y, z}], {x, -1, 3}, {y, -1.5, 3}, {z, -1, 3}, Mesh -> None, Contours -> {0.25, 0.5, 1}, ContourStyle -> ColorData[94, "ColorList"], Lighting -> "Neutral", BaseStyle -> Opacity[0.5], BoxRatios -> Automatic]ℛ = Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}];{SignedRegionDistance[ℛ, {1, 2, 3}], SignedRegionDistance[ℛ, {1, 1, 1}]}ℛ = Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}];{RegionNearest[ℛ, {1, 2, 3}], RegionNearest[ℛ, {(1/3), (1/4), (1/5)}]}Nearest points to an enclosing sphere:
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"}]]ℛ = Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}];BoundedRegionQ[ℛ]r = RegionBounds[ℛ]Graphics3D[{{EdgeForm[White], Opacity[0.2, Yellow], Cuboid@@Transpose[r]}, ℛ},
Boxed -> False]Integrate over a pyramid region:
ℛ = Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}];Integrate[x + y + z, {x, y, z}∈ℛ]Optimize over a pyramid region:
ℛ = Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}];MinValue[{x y z - x y, {x, y, z}∈ℛ}, {x, y, z}]Solve equations in a pyramid region:
ℛ = Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {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}]Applications (2)
Define a regular pyramid by radius and height:
RegularPyramid[r_, h_] := Pyramid[{{r, 0, 0}, {0, r, 0}, {-r, 0, 0}, {0, -r, 0}, {0, 0, h}}]Volume[RegularPyramid[r, h]]SurfaceArea[RegularPyramid[r, h]]Graphics3D /@ {RegularPyramid[2, 3], RegularPyramid[3, 2], RegularPyramid[2, -3]}Find the minimum surface area for a regular pyramid with volume
:
ℛ = Pyramid[{{r, 0, 0}, {0, r, 0}, {-r, 0, 0}, {0, -r, 0}, {0, 0, h}}];Minimize[{SurfaceArea[ℛ], Volume[ℛ] == 2Pi && r > 0 && h > 0}, {r, h}]Compare with some other pyramids of the same volume:
Graphics3D[#, PlotLabel -> SurfaceArea[N@#]]& /@ Diagonal@Table[ℛ, {r, {1 / 2, 1, 2}}, {h, {8, 2, 1 / 2}}]Properties & Relations (2)
A pyramid can be represented as the union of two tetrahedra:
pts = {{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}};Graphics3D[Pyramid[pts], Boxed -> False]Point index list of tetrahedra vertices:
ti = {{1, 2, 3, 5}, {1, 3, 4, 5}};Graphics3D[{Opacity@0.4, Table[Tetrahedron[pts[[i]]], {i, ti}]}, Boxed -> False]ImplicitRegion can represent any Pyramid region:
Subscript[ℛ, 1] = ImplicitRegion[2 Subscript[t, 2] ≥ Subscript[t, 3] && 2 Subscript[t, 1] + Subscript[t, 3] ≤ 4 && 2 Subscript[t, 2] + Subscript[t, 3] ≤ 4 && 2 Subscript[t, 1] ≥ Subscript[t, 3] && Subscript[t, 3] ≥ 0, {Subscript[t, 1], Subscript[t, 2], Subscript[t, 3]}];
Subscript[ℛ, 2] = Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}];RegionEqual[Subscript[ℛ, 1], Subscript[ℛ, 2]]Neat Examples (1)
Sweep a pyramid around an axis:
ℛ = Pyramid[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}];Graphics3D[{Opacity[0.3], EdgeForm[], Table[{ColorData["Rainbow"][Rescale[c, {0, 2Pi}]], GeometricTransformation[ℛ, RotationTransform[c, {0, 1, 1}, {1, 0, 0}]]}, {c, 0, 2Pi, 2Pi / 16}]}]Related Guides
Text
Wolfram Research (2014), Pyramid, Wolfram Language function, https://reference.wolfram.com/language/ref/Pyramid.html (updated 2019).
CMS
Wolfram Language. 2014. "Pyramid." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/Pyramid.html.
APA
Wolfram Language. (2014). Pyramid. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Pyramid.html
BibTeX
@misc{reference.wolfram_2026_pyramid, author="Wolfram Research", title="{Pyramid}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/Pyramid.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_pyramid, organization={Wolfram Research}, title={Pyramid}, year={2019}, url={https://reference.wolfram.com/language/ref/Pyramid.html}, note=[Accessed: 12-June-2026]}