CapsuleShape
✖
CapsuleShape
represents the filled capsule between points {xi,yi,zi} and radius r.
Details and Options

- CapsuleShape can be used as a geometric region and graphics primitive.
- CapsuleShape[] is equivalent to CapsuleShape[{{-1,0,0},{1,0,0}},1].
- CapsuleShape[r] is equivalent to CapsuleShape[{{-1,0,0},{1,0,0}},r].
- CapsuleShape[{p1,p2},r] represents the region {pRegionDistance[Line[p1,p2],p]≤r}.
- CapsuleShape can be used in Graphics3D.
- In graphics, the points {xi,yi,zi} and radius r can be Dynamic expressions.
- Graphics rendering is affected by directives such as FaceForm, EdgeForm, Specularity, Opacity, and color.

Examples
open allclose allBasic Examples (2)Summary of the most common use cases
The standard capsule centered at the origin:

https://wolfram.com/xid/0k7y41qrt5z92-hqtlth


https://wolfram.com/xid/0k7y41qrt5z92-c7o


https://wolfram.com/xid/0k7y41qrt5z92-7wedhk


https://wolfram.com/xid/0k7y41qrt5z92-kxw6nj

Scope (19)Survey of the scope of standard use cases
Graphics (9)
Specification (4)

https://wolfram.com/xid/0k7y41qrt5z92-e64f58


https://wolfram.com/xid/0k7y41qrt5z92-btz1q2

Capsules with different endpoints:

https://wolfram.com/xid/0k7y41qrt5z92-g96s5y

Capsules with different radii:

https://wolfram.com/xid/0k7y41qrt5z92-l0hn2

Short form for a capsule at the origin:

https://wolfram.com/xid/0k7y41qrt5z92-37iz6

Styling (4)

https://wolfram.com/xid/0k7y41qrt5z92-cdxdbh

Different properties can be specified for the front and back of faces using FaceForm:

https://wolfram.com/xid/0k7y41qrt5z92-vb6wx

Capsules with different specular exponents:

https://wolfram.com/xid/0k7y41qrt5z92-d1tyd0


https://wolfram.com/xid/0k7y41qrt5z92-ca9zt

Opacity specifies the face opacity:

https://wolfram.com/xid/0k7y41qrt5z92-v6995

Coordinates (1)
Regions (10)
Embedding dimension is the dimension of the space in which the capsule lives:

https://wolfram.com/xid/0k7y41qrt5z92-y220

Geometric dimension is the dimension of the shape itself:

https://wolfram.com/xid/0k7y41qrt5z92-bx9tom


https://wolfram.com/xid/0k7y41qrt5z92-c7lq97

https://wolfram.com/xid/0k7y41qrt5z92-f70gib

Get conditions for point membership:

https://wolfram.com/xid/0k7y41qrt5z92-inebf9


https://wolfram.com/xid/0k7y41qrt5z92-se0twe

https://wolfram.com/xid/0k7y41qrt5z92-e06l44


https://wolfram.com/xid/0k7y41qrt5z92-gwq4b4


https://wolfram.com/xid/0k7y41qrt5z92-oknxhk


https://wolfram.com/xid/0k7y41qrt5z92-jcsb4b

https://wolfram.com/xid/0k7y41qrt5z92-8aexdg


https://wolfram.com/xid/0k7y41qrt5z92-kjgbyj

https://wolfram.com/xid/0k7y41qrt5z92-zognbt


https://wolfram.com/xid/0k7y41qrt5z92-d7g53y

https://wolfram.com/xid/0k7y41qrt5z92-mtue

Nearest points to an enclosing sphere:

https://wolfram.com/xid/0k7y41qrt5z92-e29k5d

https://wolfram.com/xid/0k7y41qrt5z92-5ksoo8

https://wolfram.com/xid/0k7y41qrt5z92-uv1cfm


https://wolfram.com/xid/0k7y41qrt5z92-dym4fu

https://wolfram.com/xid/0k7y41qrt5z92-i3tfrr


https://wolfram.com/xid/0k7y41qrt5z92-l3exhn


https://wolfram.com/xid/0k7y41qrt5z92-bx1r15

Integrate over a capsule region:

https://wolfram.com/xid/0k7y41qrt5z92-fivgav

https://wolfram.com/xid/0k7y41qrt5z92-banwkr

Optimize over a capsule region:

https://wolfram.com/xid/0k7y41qrt5z92-nf9ton

https://wolfram.com/xid/0k7y41qrt5z92-hyz4dq

Solve equations in a capsule region:

https://wolfram.com/xid/0k7y41qrt5z92-bnrw6

https://wolfram.com/xid/0k7y41qrt5z92-lhnpf3

Applications (6)Sample problems that can be solved with this function
Visualize the Platonic solids using CapsuleShape for the edges:

https://wolfram.com/xid/0k7y41qrt5z92-2qjdfs

Use CapsuleShape to render edges in a GraphPlot3D:

https://wolfram.com/xid/0k7y41qrt5z92-u52ea

Use CapsuleShape to render edges in 3D for Graph objects:

https://wolfram.com/xid/0k7y41qrt5z92-bd33w

Embed the graph in 3D and use CapsuleShape:

https://wolfram.com/xid/0k7y41qrt5z92-8og3p

Use CapsuleShape to render edges in 3D BoundaryMeshRegion and MeshRegion objects:

https://wolfram.com/xid/0k7y41qrt5z92-ha3ypo

Using a series of capsules (and a ball), you can create a stick figure:

https://wolfram.com/xid/0k7y41qrt5z92-kjzjdr

https://wolfram.com/xid/0k7y41qrt5z92-kuwjtr

https://wolfram.com/xid/0k7y41qrt5z92-jscy64

Furthermore, you can use RotationTransform to make the stick figure's limbs pivot:

https://wolfram.com/xid/0k7y41qrt5z92-yffc4

https://wolfram.com/xid/0k7y41qrt5z92-dkc9x1

CO2 cartridges have many applications, ranging from sports to soda-making to life jackets. A 12g CO2 cartridge is about 18.6 mm in diameter and 82.5 mm long, with a neck about 12 mm long and 7.3 mm in diameter:

https://wolfram.com/xid/0k7y41qrt5z92-fnusxy
It can be approximated as a capsule and a cylinder:

https://wolfram.com/xid/0k7y41qrt5z92-brp46l

https://wolfram.com/xid/0k7y41qrt5z92-mgksm

Knowing that the ideal gas law states , where
is the universal gas constant, find the volume of the gas within the cartridge at standard temperature and pressure (273.15 K and 1 bar):

https://wolfram.com/xid/0k7y41qrt5z92-p8o0ho

Find the ratio of the normal to compressed volume:

https://wolfram.com/xid/0k7y41qrt5z92-cybbw9

Properties & Relations (6)Properties of the function, and connections to other functions
The 2D version of CapsuleShape is StadiumShape:

https://wolfram.com/xid/0k7y41qrt5z92-w9d5pi

Ball is the limit of CapsuleShape as p1 approaches p2:

https://wolfram.com/xid/0k7y41qrt5z92-nbfmqu

A CapsuleShape formed from the RegionUnion of balls and a cylinder:

https://wolfram.com/xid/0k7y41qrt5z92-kqbrp8

https://wolfram.com/xid/0k7y41qrt5z92-fnab5w

The volume is the sum of ball and cylinder volumes:

https://wolfram.com/xid/0k7y41qrt5z92-g2pbs1


https://wolfram.com/xid/0k7y41qrt5z92-3skz2

CapsuleShape is all points at most from a Line:

https://wolfram.com/xid/0k7y41qrt5z92-buaxwa

https://wolfram.com/xid/0k7y41qrt5z92-j7ugz8

ImplicitRegion can represent any CapsuleShape:

https://wolfram.com/xid/0k7y41qrt5z92-dxgz06

https://wolfram.com/xid/0k7y41qrt5z92-x052kg

https://wolfram.com/xid/0k7y41qrt5z92-w46t89

A rounded Tube looks like a CapsuleShape:

https://wolfram.com/xid/0k7y41qrt5z92-je7ia

Neat Examples (3)Surprising or curious use cases
Wolfram Research (2015), CapsuleShape, Wolfram Language function, https://reference.wolfram.com/language/ref/CapsuleShape.html.
Text
Wolfram Research (2015), CapsuleShape, Wolfram Language function, https://reference.wolfram.com/language/ref/CapsuleShape.html.
Wolfram Research (2015), CapsuleShape, Wolfram Language function, https://reference.wolfram.com/language/ref/CapsuleShape.html.
CMS
Wolfram Language. 2015. "CapsuleShape." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CapsuleShape.html.
Wolfram Language. 2015. "CapsuleShape." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CapsuleShape.html.
APA
Wolfram Language. (2015). CapsuleShape. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CapsuleShape.html
Wolfram Language. (2015). CapsuleShape. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CapsuleShape.html
BibTeX
@misc{reference.wolfram_2025_capsuleshape, author="Wolfram Research", title="{CapsuleShape}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/CapsuleShape.html}", note=[Accessed: 29-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_capsuleshape, organization={Wolfram Research}, title={CapsuleShape}, year={2015}, url={https://reference.wolfram.com/language/ref/CapsuleShape.html}, note=[Accessed: 29-April-2025
]}