My panels are not fit into the calculated boundary

https://codesandbox.io/p/sandbox/charming-tdd-nkf64x?file=%2Fsrc%2FobjViewer.tsx%3A1810%2C27-1810%2C38

here is the code

while I am making the polygon my panels need to calculate how many I will fit into it and how can I fit into this boundary

image
red is the boundary

thanks