The +
opeator could be used to combine two shapes into a single one.
What if we want to add multiple shapes togeter in one go?
combine
functionThe combine
function takes a list of shapes and combines all of the together into a single shape.
c1 = circle(r=50)
c2 = circle(r=100)
c3 = circle(r=150)
shape = combine([c1, c2, c3])
show(shape)
Combining a list of shapes into a single one is going to be very handy when start making more complex shapes and applying various transformations on them.
Write a program to combine multiple squares as shown in the figure below into a single shape and show it.