Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Represent a cylinder with rounded edges
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. |
RoundingRadius | 0.1 | the radius of rounded edges |
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]= | ![]() |
Rounded cylinders with different endpoints:
In[4]:= | ![]() |
Out[4]= | ![]() |
Rounded cylinders with different radii:
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]= | ![]() |
Adjust how rounded the edges are:
In[10]:= | ![]() |
Out[10]= | ![]() |
A simple 3D bar chart:
In[11]:= | ![]() |
In[12]:= | ![]() |
Out[12]= | ![]() |
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]= | ![]() |
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]= | ![]() |
Random unit rounded cylinders:
In[21]:= | ![]() |
Out[21]= | ![]() |
Bouncing cylinders:
In[22]:= | ![]() |
In[23]:= | ![]() |
In[24]:= | ![]() |
Out[24]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License