Doubt in Bounding Rectangle Algorithm

Hello!
I had reproduced these issues in the test folder using visual studio 2022 which was made during the end of the build.

for this example

I tried the code given originally in the issue:

I think that I have implemented the code in a wrong place
Ideally where should have I implemented the code ??

Sorry for late reply