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; }
时间: 2024-10-12 18:45:18