Function Repository Resource:

Trapezoid

Source Notebook

Create quadrilateral polygon with two parallel sides

Contributed by: Nikolay Murzin

ResourceFunction["Trapezoid"][a,α,b,β]

represents a filled trapezoid with parallel sides with lengths a and b, and base angles α and β.

Details and Options

The parameters a, b, α and β used in ResourceFunction["Trapezoid"] are as shown in the following diagram:
ResourceFunction["Trapezoid"] returns a Polygon with A at the origin and D on the positive x-axis.
The shorter of the parallel sides of the trapezoid is always on top. With a<b, line BC lies in the half-plane y>0; otherwise, it lies in the y<0 half-plane.

Examples

Basic Examples (3) 

A trapezoid with sides 2 and 6 and base angles of 60° and 30°:

In[1]:=
trap = ResourceFunction["Trapezoid"][2, 60 \[Degree], 6, 30 \[Degree]]
Out[1]=

Visualize it:

In[2]:=
Graphics[trap, GridLines -> Automatic, Frame -> True]
Out[2]=

Compute the area of this shape:

In[3]:=
Area[trap]
Out[3]=

Scope (1) 

Get symbolically-computed coordinates for the vertices of a trapezoid:

In[4]:=
ResourceFunction["Trapezoid"][a, \[Alpha], b, \[Beta]]
Out[4]=

Applications (1) 

Use a trapezoid in a GeometricScene computation:

In[5]:=
RandomInstance@
 GeometricScene[{{"A", "B", "C", "D"}, {\[Alpha], \[Beta]}},
  {
   Polygon[{"A", "B", "C", "D"}] == ResourceFunction["Trapezoid"][5, \[Alpha], 8, \[Beta]]
   }
  ]
Out[5]=

Properties and Relations (1) 

A trapezoid with a base side of length 0 may represent a triangle:

In[6]:=
tri = ResourceFunction["Trapezoid"][0, 45 \[Degree], 8, 30 \[Degree]]
Out[6]=
In[7]:=
Graphics[tri, GridLines -> Automatic, Frame -> True]
Out[7]=

Possible Issues (3) 

A trapezoid with equal sides is ambiguous; therefore, it degenerates into a line:

In[8]:=
ResourceFunction["Trapezoid"][2, 60 \[Degree], 2, 30 \[Degree]]
Out[8]=

A trapezoid with parallel left and right sides stretches out to infinity:

In[9]:=
ResourceFunction["Trapezoid"][2, 60 \[Degree], 3, 120 \[Degree]]
Out[9]=

A trapezoid with equal base sides and parallel left-right sides is indeterminate:

In[10]:=
ResourceFunction["Trapezoid"][2, 60 \[Degree], 2, 120 \[Degree]]
Out[10]=

Publisher

N. Murzin

Version History

  • 1.0.0 – 10 September 2019

Related Resources

License Information