如何计算一个长方体与其相邻长方体的接触面积

发布于 2024-10-08 20:34:34 字数 707 浏览 0 评论 0原文

我试图将不同大小的矩形长方体彼此相邻放置,以使它们之间的接触面积最大化。

以一种蛮力的方式,我正在寻找每个长方体在空间中放置的可能位置,该位置不与任何其他长方体相交。我使用Java 3D的BoundingBox 类,可以检查给定框是否与给定的其他框集合相交。现在我有很多可能的位置,我需要从中选择与其他盒子接触面积最大的位置。

我的问题是我不知道如何有效地计算这个面积。一个小例子......

方框1:左下点x=0,y=0,z=0;右上点x=10,y=10,z=10

框2:左下点x=10,y=0,z=0;右上角点 x=15,y=5,z=5

方框 3 与方框 1 具有相同的尺寸,并且应以最大接触面积定位

在本例中,方框 3 的一侧与除方框 1 的右侧以外的任何一侧相匹配的所有位置框 1(框 2 所在的位置)是最优解。

如果有人有想法甚至解决方案,我将非常高兴。如果免费图书馆不是太大的话,我也很满意。

谢谢!

I'm trying to position different-sized rectangular cuboids next to each other such that the area of contact between those is maximized.

In a brute-force kind of way I'm searching for a possible position for each to be positioned cuboid in space which doesn't intersect with any other cuboids. I realized this using Java 3D's BoundingBox class where it's possible to check whether a given box intersects with a given collection of other boxes. Now I got many possible locations from which I need to choose the one with the highest area of contact to other boxes.

My problem is that I don't know how to calculate this area efficiently. A little example...

Box 1: lower left point x=0,y=0,z=0; upper right point x=10,y=10,z=10

Box 2: lower left point x=10,y=0,z=0; upper right point x=15,y=5,z=5

Box 3 has the same dimensions as Box 1 and should be positioned with maximum area of contact

In this example all positions where one side of Box 3 matches any except the right side of Box 1 (where Box 2 is) are optimal solutions.

I would be very glad if someone has an idea or even a solution. I'm also happy with free libraries if they are not too huge.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

巴黎夜雨 2024-10-15 20:34:34

依次考虑每对潜在的接触面。

将框 2 放置在与框 1 接触的任何位置。然后递归搜索。对于每个位置,您识别所有相交的长方体,然后找到上下左右的最小移动,以防止与这些相交的长方体之一相交。这建立了四个新的搜索位置。然后你也可以根据这些进行锻炼。

澄清一下,如果您向左移动,您会找到相交长方体的最右边的左面并移动,以便该面不再相交。其他长方体可能仍然会相交,但我们将递归地远离它们。

如果没有交叉路口,您就有一个停车位置,并记下该区域并继续搜索。

如果一个移动使得你无法触及原来的盒子,你就不会沿着这条路线进一步探索。

对于每张面,您会发现要么没有可能的位置,要么至少有一个与该面具有最大接触面积的位置。

然后对其他 5 个面重复该过程。

Consider each potential pair of touching faces in turn.

Place box 2 anywhere in contact with box 1. You then recursively search. For each location you identify all the intersecting cuboids and then find minimum movement up, down, left and right that would prevent an intersection with one of those intersecting cuboids. This establishes four new places to search from. You then work out from these as well.

To clarify, if you are moving left, you find the rightmost left face of an intersecting cuboid and move so that face no longer intersects. Other cuboids will probably still intersect but we will recursively move away from them.

If there are no intersections, you have a stop location and you note the area and carry on searching.

If a move make it impossible to touch the original box, you don't explore further along that route.

For each face you can find that either no locations are possible, or there is at least one with a maximal are of contact for that face.

You then repeat the process for the other 5 faces.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文