Function Repository Resource:

# RoundedFrame3D

Represent a 3D frame with rounded edges

Contributed by: Jaroslav Kysela
 ResourceFunction["RoundedFrame3D"][{dx,dy,dz}] represents a 3D frame with dimensions {dx,dy,dz}. ResourceFunction["RoundedFrame3D"][{dx,dy,dz},{tx,ty}] sets the thickness of the frame in x- and y-directions.

## Details and Options

ResourceFunction["RoundedFrame3D"] can be used in Graphics3D.
Graphics rendering is affected by directives such as FaceForm, Opacity, and color.
ResourceFunction["RoundedFrame3D"][] is equivalent to ResourceFunction["RoundedFrame3D"][{1,1,1}, {0.4,0.4}].
ResourceFunction["RoundedFrame3D"][d] is equivalent to ResourceFunction["RoundedFrame3D"][{d,d,d}].
ResourceFunction["RoundedFrame3D"][{dx,dy}] is equivalent to ResourceFunction["RoundedFrame3D"][{dx,dy,0.2}].
ResourceFunction["RoundedFrame3D"][{dx,dy,dz}] is equivalent to ResourceFunction["RoundedFrame3D"][{dx,dy,dz}, 0.4].
ResourceFunction["RoundedFrame3D"][{dx,dy,dz}, t] is equivalent to ResourceFunction["RoundedFrame3D"][{dx,dy,dz}, {t,t}].
The following options can be given:
 RoundingRadius Automatic radii of rounded edges "JoinForm" "Bevel" form of frame joins Method "GraphicsComplex" internal representation setting
The RoundingRadius setting can have the following forms:
 rr same radius for interior and exterior edges {inrr, outrr} separate radii for the interior and exterior edges
The rr setting can have the following forms:
 None rounding radii set to zero Automatic rounding radii set to 0.1 r all radii set to r {rx,ry} equivalent to {rx,ry,0.1} {rx,ry,rz} set rounding radius for each direction separately
The "JoinForm" setting can have the following forms:
 jf same form for interior and exterior edges {injf, outjf} separate specification for the interior and exterior edges
The jf setting can have the following values:
 "Bevel" blunt joins and corners "Miter" sharp joins and corners "Round" round joins Automatic equivalent to "Bevel"
The Method setting can have the following forms:
 "GraphicsComplex" represent the frame as a GraphicsComplex "List" represent the frame as a List of individual graphics primitives

## Examples

### Basic Examples (7)

A unit rounded frame:

 In[1]:=
 Out[1]=

Rounded frames with different sizes:

 In[2]:=
 Out[2]=

Differently styled rounded frames:

 In[3]:=
 Out[3]=

Rotated rounded frame:

 In[4]:=
 Out[4]=

Simple frame:

 In[5]:=
 Out[5]=

Rounded edges:

 In[6]:=
 Out[6]=

Different join forms:

 In[7]:=
 Out[7]=

### Scope (12)

#### Dimensions (3)

A rounded frame parallel to each axis:

 In[8]:=
 Out[8]=

Modify thickness in the x-direction:

 In[9]:=
 Out[9]=

Modify thickness in the y-direction:

 In[10]:=
 Out[10]=

#### Position and rotation (3)

The frame is centered at the origin:

 In[11]:=
 Out[11]=

Use Translate to move the frame away from the center:

 In[12]:=
 Out[12]=

Use Rotate to rotate the frame:

 In[13]:=
 Out[13]=

#### Styling (6)

Color directives specify the face colors of frames:

 In[14]:=
 Out[14]=

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

 In[15]:=
 Out[15]=

Opacity specifies the face opacity:

 In[16]:=
 Out[16]=

Suppress display of the bounding box:

 In[17]:=
 Out[17]=

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

 In[18]:=
 Out[19]=

Apply textures:

 In[20]:=
 Out[21]=

### Options (10)

 In[22]:=
 Out[22]=

Different radius for the interior and exterior edges:

 In[23]:=
 Out[23]=

Only interior edges rounded:

 In[24]:=
 Out[24]=

Rounded radius only in some directions:

 In[25]:=
 Out[25]=

Specify radii for each direction for both interior and exterior edges separately:

 In[26]:=
 Out[26]=

#### JoinForm (2)

Choose the join form of the corners:

 In[27]:=
 Out[27]=

Interior and exterior edges can have different join form:

 In[28]:=
 Out[28]=

The internal structure of the frame differs for each "JoinForm":

 In[29]:=
 Out[30]=

#### Method (3)

By default, the frame is returned as a single instance of GraphicsComplex:

 In[31]:=
 Out[32]=
 In[33]:=
 Out[33]=

To get access to individual parts of the frame, set Method to "List":

 In[34]:=
 Out[35]=

This way, each part can be styled differently:

 In[36]:=
 Out[36]=

### Applications (5)

Cube with a hole:

 In[37]:=
 Out[37]=

Door frame:

 In[38]:=
 Out[38]=

Window bars:

 In[39]:=
 Out[39]=

Simple model of a house with a chimney:

 In[40]:=
 Out[41]=

Picture frame:

 In[42]:=
 Out[42]=

### Properties and Relations (5)

RoundedFrame3D can mimic Torus:

 In[43]:=
 Out[43]=

RoundedFrame3D can mimic RoundedAnnulus3D:

 In[44]:=
 Out[44]=

RoundedFrame3D can mimic RoundedCylinder:

 In[45]:=
 Out[45]=

RoundedFrame3D can mimic RoundedCuboid:

 In[46]:=
 Out[46]=

RoundedFrame3D can mimic Tube with a rectangular layout:

 In[47]:=
 Out[47]=

### Possible Issues (3)

When dimensions, thicknesses and rounding radii are inconsistent, no frame is produced and an error message is printed:

 In[48]:=
 Out[48]=

Here, the x-axis thickness exceeds half the x-axis dimension. Adjust the thickness:

 In[49]:=
 Out[49]=

The chosen "JoinForm" value affects the constraints:

 In[50]:=
 Out[50]=

The flat-face surface has a different structure when "JoinForm" is set to {"Round","Round"}:

 In[51]:=
 Out[51]=

This allows for narrow corners:

 In[52]:=
 Out[52]=

### Neat Examples (2)

Interlaced frames:

 In[53]:=
 Out[54]=

 In[55]:=
 Out[55]=

Jaroslav Kysela

## Version History

• 1.0.0 – 22 March 2023

## Author Notes

Scaled coordinates are not supported.