Welcome.
You can use this curve packer as your starting point:
There are plenty of other goodies related to your requirement in that tread… have a look.
Good luck.