Function Repository Resource:

# RoundedCuboid

Represent a cuboid with rounded edges

Contributed by: Jaroslav Kysela
 ResourceFunction["RoundedCuboid"][pmin] represents a unit cube with rounded edges and with its lower corner at pmin. ResourceFunction["RoundedCuboid"][pmin,pmax] represents an axis-aligned cuboid with rounded edges and with lower corner pmin and upper corner pmax.

## Details and Options

ResourceFunction["RoundedCuboid"] can be used in Graphics3D.
Graphics rendering is affected by directives such as FaceForm, Opacity, and color.
ResourceFunction["RoundedCuboid"][] is equivalent to ResourceFunction["RoundedCuboid"][{0,0,0}].
The following options can be given:
The RoundingRadius setting can have the following forms:
 r use r for radii in all three directions {rx,ry,rz} separate setting for each radius

## Examples

### Basic Examples (4)

A unit rounded cuboid:

 In[1]:=
 Out[1]=

Rounded cuboids with different sizes:

 In[2]:=
 Out[2]=

Differently styled rounded cuboids:

 In[3]:=
 Out[3]=

Rotated rounded cuboid:

 In[4]:=
 Out[4]=

### Scope (8)

#### Specification (3)

A rounded unit cube:

 In[5]:=
 Out[5]=

A rounded cuboid parallel to each axis:

 In[6]:=
 Out[6]=

Short form for a rounded unit cube cornered at the origin:

 In[7]:=
 Out[7]=

#### Styling (5)

Color directives specify the face colors of cuboids:

 In[8]:=
 Out[8]=

FaceForm can be used to specify the styles of the faces:

 In[9]:=
 Out[9]=

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

 In[10]:=
 Out[10]=

Opacity specifies the face opacity:

 In[11]:=
 Out[11]=

Decompose the cuboid into its components and apply different styling to each:

 In[12]:=
 In[13]:=
 Out[13]=

### Options (3)

Adjust how rounded the edges are:

 In[14]:=
 Out[14]=

Adjust the edges in each direction independently:

 In[15]:=
 Out[15]=

Leave some edges sharp:

 In[16]:=
 Out[16]=

### Applications (1)

A simple 3D bar chart:

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

### Properties and Relations (7)

Use Rotate to get all possible rounded cuboids in Graphics3D:

 In[19]:=
 Out[19]=

Rectangle with a non-zero value for RoundingRadius is a 2D version of RoundedCuboid:

 In[20]:=
 Out[20]=

Cuboid is a special case of RoundedCuboid:

 In[21]:=
 Out[21]=

Cylinder can be viewed as a special case of RoundedCuboid:

 In[22]:=
 Out[22]=

Sphere can be viewed as a special case of RoundedCuboid:

 In[23]:=
 Out[23]=

BarChart3D or RectangleChart3D can be used to create rounded cuboids:

 In[24]:=
 Out[24]=

Get the graphical primitive for BarChart3D:

 In[25]:=
 In[26]:=
 Out[26]=

Compare with RoundedCuboid:

 In[27]:=
 Out[27]=

The two cuboids have a very different internal structure:

 In[28]:=
 Out[28]=

### Possible Issues (2)

When the width of the cuboid is zero in at least one dimension, no cuboid is created:

 In[29]:=
 Out[29]=

When any length of the cuboid is less than twice the corresponding setting for RoundingRadius, a warning is issued and artifacts appear:

 In[30]:=
 Out[30]=

### Neat Examples (2)

Random rounded cuboid collections:

 In[31]:=
 Out[31]=

 In[32]:=
 Out[32]=

Jaroslav Kysela

## Version History

• 1.0.0 – 03 January 2022