本文整理汇总了C++中Intersections::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ Intersections::isEmpty方法的具体用法?C++ Intersections::isEmpty怎么用?C++ Intersections::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Intersections
的用法示例。
在下文中一共展示了Intersections::isEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processIntersections
void QTessellatorPrivate::processIntersections()
{
QDEBUG() << "PROCESS INTERSECTIONS";
// process intersections
while (!intersections.isEmpty()) {
Intersections::iterator it = intersections.begin();
if (it.key().y != y)
break;
// swap edges
QDEBUG() << " swapping intersecting edges ";
int min = scanline.size;
int max = 0;
Q27Dot5 xmin = INT_MAX;
Q27Dot5 xmax = INT_MIN;
int num = 0;
while (1) {
const Intersection &i = it.key();
int next = it->next;
int edgePos = scanline.findEdge(i.edge);
if (edgePos >= 0) {
++num;
min = qMin(edgePos, min);
max = qMax(edgePos, max);
Edge *edge = scanline.edges[edgePos];
xmin = qMin(xmin, edge->positionAt(y));
xmax = qMax(xmax, edge->positionAt(y));
}
Intersection key;
key.y = y;
key.edge = next;
it = intersections.find(key);
intersections.remove(i);
if (it == intersections.end())
break;
}
if (num < 2)
continue;
Q_ASSERT(min != max);
QDEBUG() << "sorting between" << min << "and" << max << "xpos=" << xmin << xmax;
while (min > 0 && scanline.edges[min - 1]->positionAt(y) >= xmin) {
QDEBUG() << " adding edge on left";
--min;
}
while (max + 1 < scanline.size && scanline.edges[max + 1]->positionAt(y) <= xmax) {
QDEBUG() << " adding edge on right";
++max;
}
qSort(scanline.edges + min, scanline.edges + max + 1, EdgeSorter(y));
#ifdef DEBUG
for (int i = min; i <= max; ++i)
QDEBUG() << " " << scanline.edges[i]->edge << "at pos" << i;
#endif
for (int i = min; i <= max; ++i) {
Edge *edge = scanline.edges[i];
edge->intersect_left = true;
edge->intersect_right = true;
edge->mark = true;
}
}
}