我的算法无法从较小的盒子中提取出最大的盒子,但算法太慢
想象一下一个基于多维数据集的世界(例如Minecraft,Trove或Cube World),其中所有事物都由大小相同的多维数据集组成,并且所有多维数据集都是同一种类。 目标是用最少的矩形框表示世界(通过合并立方体但保留凸形(又称矩形框))。我的算法在此方面取得了成功,但是其性能对于预期的目的而言太慢了。有更快的算法吗? 我算法的伪C#代码基本上是: struct Coordinate { int x,y,z; }; //<-- integer based grid HashSet<Coordinate> world; // <-- contains all the cubes //width, height, and length represent how many cubes it spans struct RectangularBox { Coordinate coord; int width,height,length; } void Begin() { List<RectangularBox> fewestBoxes = new List<RectangularBox>(); while(world.Count > …