擅长:python、mysql、java
<p>第一个代码部分验证第二个矩形最初是否适合第一个矩形,这很好。您可以找到其他方法来执行此操作<a href="https://math.stackexchange.com/questions/190410/find-if-one-rectangle-can-fit-inside-the-other">here</a></p>
<blockquote>
<p>"It's possible only to rotate the second rectangle to see if it can cover the first one."</p>
</blockquote>
<p>如果这是一个约束,您可以查看这个<a href="https://math.stackexchange.com/questions/2581058/rotating-rectangle-by-its-center">topic</a>来旋转第二个矩形。你知道吗</p>
<p>作为开发的<a href="https://stackoverflow.com/questions/27768039/find-out-if-a-rectangle-is-inside-another-rectangle-c">here</a>,我认为迭代验证第二个矩形在旋转时是否适合第一个矩形的一个好方法是检查<em>“内矩形的两个相对的角是否在外矩形中。”</em></p>
<p>我知道这不是一个确切的答案,但我希望它会有所帮助。你知道吗</p>