本文整理汇总了C++中Polygon2::area方法的典型用法代码示例。如果您正苦于以下问题:C++ Polygon2::area方法的具体用法?C++ Polygon2::area怎么用?C++ Polygon2::area使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polygon2
的用法示例。
在下文中一共展示了Polygon2::area方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isGood
bool isGood() {
stringstream ss;
ss << points.size() << endl;
auto out = [&](const Gmpq& q) {
if (1 != q.denominator()) {
ss << q;
} else {
ss << q.numerator();
}
};
vector<Point2> vp(points.size());
for (const auto& p: points) {
vp[p.second] = p.first;
}
for (const auto& p: vp) {
out(p.x());
ss << ",";
out(p.y());
ss << endl;
}
ss << facets.size() << endl;
map<Point2, Point2> transform;
for (const auto& f: facets) {
ss << f.polygon.size();
Polygon2 transformed;
auto inverse = f.transformation.inverse();
for (auto fp = f.polygon.vertices_begin(); fp != f.polygon.vertices_end(); ++fp) {
auto inv = inverse(*fp);
if (0 == points.count(inv)) {
cout << "point not found" << endl;
return false;
}
ss << " " << points[inv];
transformed.push_back(vp[points[inv]]);
transform[inv] = *fp;
}
ss << endl;
auto area = transformed.area();
if (0 == area) {
cout << "empty facet" << endl;
return false;
}
if (abs(area) != abs(f.polygon.area())) {
cout << "not congruent" << endl;
return false;
}
}
for (const auto& p: vp) {
if (!transform.count(p)) {
cout << "point not found 2" << endl;
return false;
}
auto transformed = transform[p];
out(transformed.x());
ss << ",";
out(transformed.y());
ss << endl;
}
sSolution = ss.str();
// cout << sSolution << endl;
return sSolution.size() < 5000;
}