2
我试图使用帕尔马多面体图书馆[1]枚举(凸)多面体的顶点,例如,我有四个限制指定的矩形:帕尔马多面体库:顶点枚举
Constraint_System cs;
cs.insert(x >= 0);
cs.insert(x <= 3);
cs.insert(y >= 0);
cs.insert(y <= 3);
C_Polyhedron ph(cs);
如何生成顶点?
我试图使用帕尔马多面体图书馆[1]枚举(凸)多面体的顶点,例如,我有四个限制指定的矩形:帕尔马多面体库:顶点枚举
Constraint_System cs;
cs.insert(x >= 0);
cs.insert(x <= 3);
cs.insert(y >= 0);
cs.insert(y <= 3);
C_Polyhedron ph(cs);
如何生成顶点?
PPL中的每个形状都有双重表示:1)Constraint_System,2)Generator_System。对于凸多面体,发电机系统将包含可以是1)Point,2)Line,3)Rays的发电机组。对于凸多面体,这组发生器将是所有点。你可以得到发电机的代表如下:
Generator_System gs = ph.generators(); // Use ph.minimized_generators() to minimal set of points for the polytope
for(Generator_System::const_iterator it = gs.begin(); it != gs.end(); it++) {
const Generator& g = *it;
assert(g.is_point()); // Assertions will fail for unbounded polyhedra
std::cout << g;
}
感谢您的回答。我必须添加'使用命名空间Parma_Polyhedra_Library :: IO_Operators;否则'std :: cout'不起作用。 –