QPointF MapEditor::getIntersectPos(QPointF posA, QPointF posB, QPointF posC, QPointF posD)//返回AB与CD交点,无交点返回(0,0)
{
QLineF line1(posA, posB);
QLineF line2(posC, posD);
QPointF interPos(0,0);
QLineF::IntersectType type = line1.intersect(line2, &interPos);
if (type != QLineF::BoundedIntersection)
interPos = QPointF(0, 0);
return interPos;
}
版权归属:
三味线
许可协议:
本文使用《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》协议授权
评论区