| 4038 | /// @endcond |
| 4039 | |
| 4040 | void intersectSurfaces(std::vector<Space>& t_spaces) { |
| 4041 | std::vector<Space> spaces(t_spaces); |
| 4042 | std::sort(spaces.begin(), spaces.end(), [](const Space& a, const Space& b) -> bool { return a.floorArea() < b.floorArea(); }); |
| 4043 | |
| 4044 | std::vector<BoundingBox> bounds; |
| 4045 | for (const Space& space : spaces) { |
| 4046 | bounds.push_back(space.transformation() * space.boundingBox()); |
| 4047 | } |
| 4048 | |
| 4049 | for (unsigned i = 0; i < spaces.size(); ++i) { |
| 4050 | for (unsigned j = i + 1; j < spaces.size(); ++j) { |
| 4051 | if (!bounds[i].intersects(bounds[j])) { |
| 4052 | continue; |
| 4053 | } |
| 4054 | spaces[i].intersectSurfaces(spaces[j]); |
| 4055 | } |
| 4056 | } |
| 4057 | } |
| 4058 | |
| 4059 | void matchSurfaces(std::vector<Space>& spaces) { |
| 4060 | std::vector<BoundingBox> bounds; |