Function Repository Resource:

# RoundedCylinder

Represent a cylinder with rounded edges

Contributed by: Jaroslav Kysela
 ResourceFunction["RoundedCylinder"][{{x1,y1,z1},{x2,y2,z2}},r] represents a rounded cylinder of radius r around the line from (x1,y1,z1) to (x2,y2,z2). ResourceFunction["RoundedCylinder"][{{x1,y1,z1},{x2,y2,z2}}] represents a rounded cylinder of radius 1.

## Details and Options

ResourceFunction["RoundedCylinder"][] is equivalent to ResourceFunction["RoundedCylinder"][{{0,0,-1},{0,0,1}},1].
ResourceFunction["RoundedCylinder"] can be used in Graphics3D.
Graphics rendering is affected by directives such as FaceForm, Specularity, Opacity, and color.
The following option can be given:

## Examples

### Basic Examples (3)

A unit radius and two units height rounded cylinder:

 In[1]:=
 Out[1]=

A rounded cylinder from the origin to {1,1,1} with radius 1/2:

 In[2]:=
 Out[2]=

Differently styled rounded cylinders:

 In[3]:=
 Out[3]=

### Scope (6)

Rounded cylinders with different endpoints:

 In[4]:=
 Out[4]=

 In[5]:=
 Out[5]=

Rounded cylinders with different rounding radii:

 In[6]:=
 Out[6]=

Colored cylinders:

 In[7]:=
 Out[7]=

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

 In[8]:=
 Out[8]=

Opacity specifies the face opacity:

 In[9]:=
 Out[9]=

### Options (1)

Adjust how rounded the edges are:

 In[10]:=
 Out[10]=

### Applications (1)

A simple 3D bar chart:

 In[11]:=
 In[12]:=
 Out[12]=

### Properties and Relations (2)

For small rounding radii, RoundedCylinder is effectively equivalent to Cylinder:

 In[13]:=
 Out[13]=

When the rounding radius is set to the cylinder radius, RoundedCylinder closely resembles CapsuleShape as well as Tube with rounded caps:

 In[14]:=
 Out[15]=

### Possible Issues (3)

When the two endpoints coincide, no cylinder is created:

 In[16]:=
 Out[16]=

When the rounding radius exceeds that of the cylinder, a warning is issued and artifacts appear:

 In[17]:=
 Out[17]=
 In[18]:=
 Out[18]=

When the double of the rounding radius exceeds the height of the cylinder, a warning is issued and artifacts appear:

 In[19]:=
 Out[19]=
 In[20]:=
 Out[20]=

### Neat Examples (2)

Random unit rounded cylinders:

 In[21]:=
 Out[21]=

Bouncing cylinders:

 In[22]:=
 In[23]:=
 In[24]:=
 Out[24]=

Jaroslav Kysela

## Version History

• 1.0.0 – 20 December 2021