How to put a shape into a bigger one

I want to know how to put a small figure into a square or other figure. The location of the small figure is not important. It can go to the corner or it can be located in the center. However, objects should not be deformed. To get into a large figure, you just have to turn, move, or flip the object. Also, small figures should not protrude out of the large figure. What can I do with the grasshopper?

You have 3 options:

  1. Find some working shape packing algo/solution and put small things into a container.
  2. Recursively move the small around until no ccx events occur (that’s a bit naive and time consuming).
  3. Pixelate (LOL) the small and the big (using the same size “pixels/voxels”) and use classic Matrix related ops to find cells in the big that have the same “layout/pattern” as the cells in the small. For instance this is using a random density (user controlled) Matrix of ones and attempts to locate a given search pattern:

Thank you for your answer.
Your answer inspired me again.^o^

As a challenge try to do this:

That said this “match” approach shown has NOTHING to do with packing in the classic sense (is written for totally different reasons).